Peter Tofte wrote:
> Hi Robert
>
> I have the ffmpeg command working with vaapi.
>
>
/usr/bin/ffmpeg -re -y -vaapi_device /dev/dri/card0 -hwaccel vaapi -hwaccel_output_format vaapi -i /home/hts/in.mkv -an -vf 'format=vaapi|nv12,hwupload' -c:v h264_vaapi -qp 20 -f mpegts -tune zerolatency -f mpegts out.ts
>
> When I try to create a pipe in tvheadend (in the url text box) i put
>
>
/usr/bin/ffmpeg -re -y -vaapi_device /dev/dri/card0 -hwaccel vaapi -hwaccel_output_format vaapi -i /home/hts/in.mkv -an -vf 'format=vaapi|nv12,hwupload' -c:v h264_vaapi -qp 20 -f mpegts -tune zerolatency -f mpegts pipe:1
>
> I get the following error message:
>
2017-01-21 09:48:31.621 spawn: Stream #0:0(eng): Video: h264 (High), yuv420p(tv, bt709, progressive), 1920x1080 [SAR 1:1 DAR 16:9], 29.97 fps, 29.97 tbr, 1k tbn, 59.94 tbc (default)
> 2017-01-21 09:48:31.621 spawn: [AVFilterGraph
0x5635f9d5ae00] No such filter: 'format=nv12|vaapi,hwupload'
> 2017-01-21 09:48:31.621 spawn: Error opening filters!
> 2017-01-21 09:48:31.623 iptv: stdin pipe unexpectedly closed: No data@
>
> I was able to make a pipe working with avconv and an online rstp stream, but not with vaapi. So pipe is fundamentally working in tvheadend. Question is, why is it not working with my vaapi command.
>
> I also tried to create a #bin/bash script and calling this script from the pipe url in tvheadend, but no luck.
>
> I am opening the iptv mux with vlc.
>
> Any ideas? Did you get it to work?
You have a couple of problems with your options for
ffmpeg@.
* @-re
– This option is used to slow the reading of on-disk files to real–time for live streaming output. When used with live stream inputs, it can cause problems when
ffmpeg
attempts to re-adjust the framerates. Do
not use this option live/real–time inputs. (Looking at your example, it is hard to tell if you are using the
/home/hts/in.mkv
as a test input, or if you are really using a file for your IPTV mux. If you are really using an on-disk file, then keep the
-re
option.)
*
-vaapi_device /dev/dri/card0
– VA-API hardware encoding does not use the
/dev/dri/card*
device, but rather
/dev/dri/render*@. On my systems the device is @/dev/dri/renderD128@, but it may be different on yours.
* @-tune zerolatency
– The
-tune
options are for using
libx264
as your encoder, and have no effect when using
h264_vaapi
as your encoder.
*
-qp 20
– This is basically unnecessary, as the default
-qp
setting for
h264_vaapi
is already 20. The scale is the same as the
-qp
and
-crf
options for
libx264@: 0-51, with lower numbers having higher quality; sane values should remain between 18–28 if you are going to use this setting.
So, you may want to try this as your URL for the IPTV mux:
@pipe:///usr/bin/ffmpeg -hwaccel vaapi -vaapi_device /dev/dri/renderD128 -re -i /home/hts/in.mkv -vf format=nv12|vaapi,hwupload -an -c:v h264_vaapi -f mpegts -flags +global_header pipe:1
I have had problems with quotes in
pipe://
URLs, so I tend to leave them out as they only seem to make things more difficult, regardless of how I escape them, and regardless of whether they are
'
or
"@. Also, I have had problems with MPEG-TS headers needing to be present for Tvheadend, so I have added the @-flags +global_header
option to ensure those are generated and added into the MPEG-TS.