VAAPI transcoding doesnt work but no error
I compiled TVH 4.3-1251 from source today and although VAAPI support is supposed to be built in, I can't get it to work. Everything seems to work correctly and I get no errors but it just doesnt want to work. Some info:
CPU: Intel Core i7 6700K
OS: Debian Sid x64
Output from ./configure:
checking for pkg libva >=0.38.0 ... ok (detected 1.1.0)
checking for pkg libva-x11 >=0.38.0 ... ok (detected 1.1.0)
checking for pkg libva-drm >=0.38.0 ... ok (detected 1.1.0)
Output from vainfo alone returns this:
error: can't connect to X server!
libva info: VA-API version 1.1.0
libva info: va_getDriverName() returns -1
libva error: va_getDriverName() failed with unknown libva error,driver_name=(null)
vaInitialize failed with error code -1 (unknown libva error),exit
But output from vainfo --display drm --device /dev/dri/renderD129 returns:
libva info: VA-API version 1.1.0
libva info: va_getDriverName() returns 0
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/i965_drv_video.so
libva info: Found init function __vaDriverInit_1_0
libva info: va_openDriver() returns 0
vainfo: VA-API version: 1.1 (libva 2.1.0)
vainfo: Driver version: Intel i965 driver for Intel(R) Skylake - 2.0.0
vainfo: Supported profile and entrypoints
VAProfileMPEG2Simple : VAEntrypointVLD
VAProfileMPEG2Simple : VAEntrypointEncSlice
VAProfileMPEG2Main : VAEntrypointVLD
VAProfileMPEG2Main : VAEntrypointEncSlice
VAProfileH264Main : VAEntrypointVLD
VAProfileH264Main : VAEntrypointEncSlice
VAProfileH264Main : VAEntrypointEncSliceLP
VAProfileH264Main : VAEntrypointFEI
VAProfileH264High : VAEntrypointVLD
VAProfileH264High : VAEntrypointEncSlice
VAProfileH264High : VAEntrypointEncSliceLP
VAProfileH264High : VAEntrypointFEI
VAProfileH264MultiviewHigh : VAEntrypointVLD
VAProfileH264MultiviewHigh : VAEntrypointEncSlice
VAProfileH264StereoHigh : VAEntrypointVLD
VAProfileH264StereoHigh : VAEntrypointEncSlice
VAProfileVC1Simple : VAEntrypointVLD
VAProfileVC1Main : VAEntrypointVLD
VAProfileVC1Advanced : VAEntrypointVLD
VAProfileNone : VAEntrypointVideoProc
VAProfileJPEGBaseline : VAEntrypointVLD
VAProfileJPEGBaseline : VAEntrypointEncPicture
VAProfileVP8Version0_3 : VAEntrypointVLD
VAProfileHEVCMain : VAEntrypointVLD
VAProfileHEVCMain : VAEntrypointEncSlice
So I suppose its okay?
TVH reports this when the stream starts:
2018-04-22 20:43:26.877 transcode: 0011: 01:H264: > Using profile VAAPI
2018-04-22 20:43:26.877 transcode: 0011: 02:AC3: > Filtered out
2018-04-22 20:43:26.877 transcode: 0011: 03:DVBSUB: ==> Filtered out
2018-04-22 20:43:46.886 webui: Stop streaming /stream/channel/c378c5458842e590ab098f13ce5a6934?profile=vaapi, timeout waiting for packets
I have a nvidia GeForce 980 Ti that is on device /dev/dri/renderD128 but my onboard graphics adapter is /dev/dri/renderD129 and thats what I chose on TVH under h264_vaapi codec profile.
Check attached image for the codec profile settings.
Any help will be much appreciated.
Thanks in advance
RE: VAAPI transcoding doesnt work but no error - Added by saen acro about 3 years ago
saen acro wrote:
Do you try to install Media Server Studio Essentials 2017 R3,
and use spawn profile with Intel QSV via ffmpeg?
Intel QSV requires specific kernel versions/modules. However, VA-API uses the same hardware and only requires libva rather than a custom kernel.
To the OP: Does the user that Tvheadend runs as have access to the /dev/dri devices? (As in, is it a member of the video group, and does the group have access to those devices?) If not, then you probably need a udev rule to ensure that those devices are assigned to the video group when created.
Thanks both for your answers,
Since I read that QSV is really a pain to setup, I decided to go for the easier solution of VAAPI.
I did as Robert suggested and since the /dev/dri was already a member of the video group, I added the user hts that TVH runs under to that group as well.
Unfortunately no change.
A bit of more info though...
If I set VAAPI on its default settings, uncheck "Deinterlace" and check "Hardware acceleration" then I get image on kodi but its very very bad like its pixeling terribly every 3-4 seconds and the bitrate isnt going down. VLC will show me like 1-3 frames and then it will freeze. Now if I change any of the other settings then I still don't get any image.
This behaviour was like that even before I add the hts user to the video group.
You did restart the Tvheadend service after adding its user to the video group? (I just tend to keep my setup simple, and the Tvheadend service runs under the video group, obviating the need for some of this setup.)
Actually I hadn't but after I restarted the whole computer, the issue remains. However as I said I'm able to use VAAPI without settings so the problem has to be somewhere else.
What if I run ffmpeg's libx264 with hardware acceleration and a parameter to use my integrated card instead? Is it possible to configure?
EDIT: After playing with ffmpeg, I finally got some errors!
2018-04-23 02:33:00.182 libav: TVHGraph: Impossible to convert between the formats supported by the filter 'Parsed_scale_vaapi_0' and the filter 'auto_scaler_0'
2018-04-23 02:33:00.182 transcode: 0026: 01:H264: [h264 => libx264]: filters: failed to config filter graph
The solution I came up with was to choose ffmpeg software option in TVH and then at the parameters line of the codec, I used this:
-hwaccel vaapi -hwaccel_device /dev/dri/renderD129 -hwaccel_output_format vaapi -c:v h264_vaapi
I also unchecked the hardware transcoding option from the codecs settings
It is working perfectly fine now although the quality is a bit worse than software transcoding