Project

General

Profile

HELP needed - vaapi and tvheadend

Added by Oli S. 4 months ago

Hi,

I do not know how to proceed - maybe somebody can help.

I have a Gemini Lake R J4125 with installed Intel i965 driver for Intel(R) Gemini Lake - 2.3.0.
Vainfo is showing proper installation. Details attached.
(Kernel 4.19.0-14-amd64, Linux Debian GNU/Linux 10 \n \l )

I have the latest version of tvheadend built and installed (v4.3-1947~gdbaa0f850, enabled static-ffmpeg)

Ordinary, non hw accelerated, codecs are working without problems.

vapi-codec for x264,x265,vp8,vp9 are offered in the stream/codec tab.

I can add the vapi codecs - but they stay disabled. I get no further debug-info!

Any hints?

Thx in advance, Oli

  1. vainfo #################################
    [email protected]:~# vainfo
    error: XDG_RUNTIME_DIR not set in the environment.
    error: can't connect to X server!
    libva info: VA-API version 1.4.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_4
    libva info: va_openDriver() returns 0
    vainfo: VA-API version: 1.4 (libva 2.4.0)
    vainfo: Driver version: Intel i965 driver for Intel(R) Gemini Lake - 2.3.0
    vainfo: Supported profile and entrypoints
    VAProfileMPEG2Simple : VAEntrypointVLD
    VAProfileMPEG2Main : VAEntrypointVLD
    VAProfileH264ConstrainedBaseline: VAEntrypointVLD
    VAProfileH264ConstrainedBaseline: VAEntrypointEncSlice
    VAProfileH264ConstrainedBaseline: VAEntrypointEncSliceLP
    VAProfileH264Main : VAEntrypointVLD
    VAProfileH264Main : VAEntrypointEncSlice
    VAProfileH264Main : VAEntrypointEncSliceLP
    VAProfileH264High : VAEntrypointVLD
    VAProfileH264High : VAEntrypointEncSlice
    VAProfileH264High : VAEntrypointEncSliceLP
    VAProfileH264MultiviewHigh : VAEntrypointVLD
    VAProfileH264MultiviewHigh : VAEntrypointEncSlice
    VAProfileH264StereoHigh : VAEntrypointVLD
    VAProfileH264StereoHigh : VAEntrypointEncSlice
    VAProfileVC1Simple : VAEntrypointVLD
    VAProfileVC1Main : VAEntrypointVLD
    VAProfileVC1Advanced : VAEntrypointVLD
    VAProfileNone : VAEntrypointVideoProc
    VAProfileJPEGBaseline : VAEntrypointVLD
    VAProfileJPEGBaseline : VAEntrypointEncPicture
    VAProfileVP8Version0_3 : VAEntrypointVLD
    VAProfileVP8Version0_3 : VAEntrypointEncSlice
    VAProfileHEVCMain : VAEntrypointVLD
    VAProfileHEVCMain : VAEntrypointEncSlice
    VAProfileHEVCMain10 : VAEntrypointVLD
    VAProfileHEVCMain10 : VAEntrypointEncSlice
    VAProfileVP9Profile0 : VAEntrypointVLD
    VAProfileVP9Profile0 : VAEntrypointEncSlice
    VAProfileVP9Profile2 : VAEntrypointVLD

Replies (16)

RE: HELP needed - vaapi and tvheadend - Added by thermionic valve 4 months ago

What are your build options?

RE: HELP needed - vaapi and tvheadend - Added by Oli S. 4 months ago

here are my build options:

checking for cc execinfo.h ...                    ok
checking for cc -mmmx ... ok
checking for cc -msse2 ... ok
checking for cc -Wunused-result ... ok
checking for cc -fstack-protector ... ok
checking for cc -fstack-protector-strong ... ok
checking for cc -fstack-check ... ok
checking for cc -fPIE ... ok
checking for cc strlcat ... fail
checking for cc strlcpy ... fail
checking for cc fdatasync ... ok
checking for cc getloadavg ... ok
checking for cc atomic32 ... ok
checking for cc atomic64 ... ok
checking for cc atomic_time_t ... ok
checking for cc atomic_ptr ... ok
checking for cc bitops64 ... ok
checking for cc lockowner ... ok
checking for cc qsort_r ... ok
checking for cc stime ... ok
checking for cc gmtoff ... ok
checking for cc recvmmsg ... ok
checking for cc sendmmsg ... ok
checking for cc libiconv ... fail
^ using build-in glibc iconv routines
checking for cc ifnames ... ok
checking for cc cclang_threadsan ... fail
checking for py module gzip ... ok
checking for pkg-config ... ok
checking for xgettext ... ok
checking for msgmerge ... ok
checking for gzip ... ok
checking for bzip2 ... ok
checking for pkg openssl ... ok (detected 1.1.1d)
checking for cc linux/dvb/version.h ... ok
checking for pkg zlib ... ok (detected 1.2.11)
checking for pkg libpcre2-8 ... ok (detected 10.32)
checking for pkg liburiparser ... ok (detected 0.9.1)
checking for pkg avahi-client ... ok (detected 0.7)
checking for cmake ... ok
checking for cc -lstdc++ ... ok
checking for pkg libva >=0.38.0 ... ok (detected 1.4.0)
checking for pkg libva-drm >=0.38.0 ... ok (detected 1.4.0)
checking for cc sys/inotify.h ... ok
checking for cc inotify_init1 ... ok
checking for cc dvbcsa/dvbcsa.h ... ok
checking for cc -ldvbcsa ... ok
fetching dvb-scan files ... ok
checking for cc epoll_create1 ... ok
checking for pkg dbus-1 ... ok (detected 1.12.20)

Compiler:
Using C compiler: cc
Using LD flags: -ldvbcsa
Build for arch: x86_64

Binaries:
Using PYTHON: python
Using GZIP: gzip
Using BZIP2: bzip2

Options:
pie yes
ccdebug no
cardclient yes
cwc yes
cccam yes
capmt yes
constcw yes
linuxdvb yes
satip_server yes
satip_client yes
hdhomerun_client yes
hdhomerun_static yes
iptv yes
tsfile yes
dvbscan yes
timeshift yes
trace yes
avahi yes
zlib yes
libav yes
ffmpeg_static yes
libx264 yes
libx264_static yes
libx265 yes
libx265_static yes
libvpx yes
libvpx_static yes
libtheora yes
libtheora_static yes
libvorbis yes
libvorbis_static yes
libfdkaac no
libfdkaac_static no
libopus yes
libopus_static yes
nvenc no
vaapi yes
mmal no
omx no
inotify yes
epoll yes
pcre no
pcre2 yes
uriparser yes
ccache no
tvhcsa yes
bundle no
pngquant no
kqueue no
dbus_1 yes
android no
gtimer_check no
slow_memoryinfo no
libsystemd_daemon no
pcloud_cache yes
ddci yes
cclang_threadsan no
gperftools no
execinfo yes
mmx yes
sse2 yes
W_unused_result yes
f_stack_protector yes
f_stack_protector_strong yes
f_stack_check yes
f_PIE yes
fdatasync yes
getloadavg yes
atomic32 yes
atomic64 yes
atomic_time_t yes
atomic_ptr yes
bitops64 yes
lockowner yes
qsort_r yes
stime yes
gmtoff yes
recvmmsg yes
sendmmsg yes
ifnames yes
py_gzip yes
bin_pkg_config yes
bin_xgettext yes
bin_msgmerge yes
bin_gzip yes
bin_bzip2 yes
ssl yes
linuxdvbapi yes
linuxdvb_ca yes
upnp yes
bin_cmake yes
stdcpp yes
libogg_static yes
hwaccels yes
inotify_h yes
inotify_init1 yes
dvbcsa yes
epoll_create1 yes
mpegts yes
mpegts_dvb yes

Packages:
openssl 1.1.1d
zlib 1.2.11
libpcre2-8 10.32
liburiparser 0.9.1
avahi-client 0.7
libva 1.4.0
libva-drm 1.4.0
dbus-1 1.12.20

Installation paths:
Prefix: /usr/local
Binaries: ${prefix}/bin
Libraries: ${prefix}/lib
Data files: ${prefix}/share
Man pages: ${datadir}/man

RE: HELP needed - vaapi and tvheadend - Added by Oli S. 4 months ago

Another remark: pure ffmpeg (installed by apt) is supporting hw accel by vaapi correctly.

RE: HELP needed - vaapi and tvheadend - Added by thermionic valve 4 months ago

could you post the build options from the "About" page.

RE: HELP needed - vaapi and tvheadend - Added by Oli S. 4 months ago

here you are:
Configure arguments:

Compiler:
Using C compiler: cc
Using LD flags: -ldvbcsa
Build for arch: x86_64

Binaries:
Using PYTHON: python
Using GZIP: gzip
Using BZIP2: bzip2

Options:
pie yes
ccdebug no
cardclient yes
cwc yes
cccam yes
capmt yes
constcw yes
linuxdvb yes
satip_server yes
satip_client yes
hdhomerun_client yes
hdhomerun_static yes
iptv yes
tsfile yes
dvbscan yes
timeshift yes
trace yes
avahi yes
zlib yes
libav yes
ffmpeg_static yes
libx264 yes
libx264_static yes
libx265 yes
libx265_static yes
libvpx yes
libvpx_static yes
libtheora yes
libtheora_static yes
libvorbis yes
libvorbis_static yes
libfdkaac no
libfdkaac_static no
libopus yes
libopus_static yes
nvenc no
vaapi yes
mmal no
omx no
inotify yes
epoll yes
pcre no
pcre2 yes
uriparser yes
ccache no
tvhcsa yes
bundle no
pngquant no
kqueue no
dbus_1 yes
android no
gtimer_check no
slow_memoryinfo no
libsystemd_daemon no
pcloud_cache yes
ddci yes
cclang_threadsan no
gperftools no
execinfo yes
mmx yes
sse2 yes
W_unused_result yes
f_stack_protector yes
f_stack_protector_strong yes
f_stack_check yes
f_PIE yes
fdatasync yes
getloadavg yes
atomic32 yes
atomic64 yes
atomic_time_t yes
atomic_ptr yes
bitops64 yes
lockowner yes
qsort_r yes
stime yes
gmtoff yes
recvmmsg yes
sendmmsg yes
ifnames yes
py_gzip yes
bin_pkg_config yes
bin_xgettext yes
bin_msgmerge yes
bin_gzip yes
bin_bzip2 yes
ssl yes
linuxdvbapi yes
linuxdvb_ca yes
upnp yes
bin_cmake yes
stdcpp yes
libogg_static yes
hwaccels yes
inotify_h yes
inotify_init1 yes
dvbcsa yes
epoll_create1 yes
mpegts yes
mpegts_dvb yes

Packages:
openssl 1.1.1d
zlib 1.2.11
libpcre2-8 10.32
liburiparser 0.9.1
avahi-client 0.7
libva 1.4.0
libva-drm 1.4.0
dbus-1 1.12.20

Installation paths:
Prefix: /usr/local
Binaries: ${prefix}/bin
Libraries: ${prefix}/lib
Data files: ${prefix}/share
Man pages: ${datadir}/man

RE: HELP needed - vaapi and tvheadend - Added by saen acro 4 months ago

Plesa use pre button when post messages.

Is that packed are build by you or taken from some repo?
Post startup messages.

RE: HELP needed - vaapi and tvheadend - Added by Oli S. 4 months ago

built by my own.
Thx in advance.

RE: HELP needed - vaapi and tvheadend - Added by saen acro 4 months ago

Where is a startup messages of TVHeadend?

RE: HELP needed - vaapi and tvheadend - Added by Oli S. 4 months ago

ahhhh, sory.
Startup mesasage: you mean a log of the start up? Any special debug settings therefore needed?

RE: HELP needed - vaapi and tvheadend - Added by Oli S. 4 months ago

hopefully that's what you asked for:

2021-03-28 18:24:14.324 [   INFO]:main: Log started
2021-03-28 18:24:14.325 [   INFO]:http: Starting HTTP server 0.0.0.0:9981
2021-03-28 18:24:14.325 [   INFO]:htsp: Starting HTSP server 0.0.0.0:9982
2021-03-28 18:24:14.403 [   INFO]:config: loaded
2021-03-28 18:24:14.404 [   INFO]:config: scanfile (re)initialization with path <none>
2021-03-28 18:24:14.404 [   INFO]:transcode: 'video' context type registered
2021-03-28 18:24:14.404 [   INFO]:transcode: 'audio' context type registered
2021-03-28 18:24:14.404 [   INFO]:transcode: '&TVHH264Decoder' decoder helper registered
2021-03-28 18:24:14.404 [   INFO]:transcode: '&TVHTHEORADecoder' decoder helper registered
2021-03-28 18:24:14.404 [   INFO]:transcode: '&TVHAACDecoder' decoder helper registered
2021-03-28 18:24:14.404 [   INFO]:transcode: '&TVHVORBISDecoder' decoder helper registered
2021-03-28 18:24:14.404 [   INFO]:transcode: '&TVHOPUSDecoder' decoder helper registered
2021-03-28 18:24:14.404 [   INFO]:transcode: '&TVHMPEG2VIDEOEncoder' encoder helper registered
2021-03-28 18:24:14.404 [   INFO]:transcode: '&TVHH264Encoder' encoder helper registered
2021-03-28 18:24:14.404 [   INFO]:transcode: '&TVHHEVCEncoder' encoder helper registered
2021-03-28 18:24:14.404 [   INFO]:transcode: '&TVHAACEncoder' encoder helper registered
2021-03-28 18:24:14.405 [   INFO]:codec: 'mpeg2video' encoder registered
2021-03-28 18:24:14.405 [   INFO]:codec: 'mp2' encoder registered
2021-03-28 18:24:14.405 [   INFO]:codec: 'aac' encoder registered
2021-03-28 18:24:14.405 [   INFO]:codec: 'vorbis' encoder registered
2021-03-28 18:24:14.405 [   INFO]:codec: 'flac' encoder registered
2021-03-28 18:24:14.405 [   INFO]:codec: 'libx264' encoder registered
2021-03-28 18:24:14.405 [   INFO]:codec: 'libx265' encoder registered
2021-03-28 18:24:14.405 [   INFO]:codec: 'libvpx' encoder registered
2021-03-28 18:24:14.405 [   INFO]:codec: 'libvpx-vp9' encoder registered
2021-03-28 18:24:14.405 [   INFO]:codec: 'libtheora' encoder registered
2021-03-28 18:24:14.405 [   INFO]:codec: 'libvorbis' encoder registered
2021-03-28 18:24:14.405 [   INFO]:codec: 'libopus' encoder registered
2021-03-28 18:24:14.405 [   INFO]:codec: 'h264_vaapi' encoder registered
2021-03-28 18:24:14.405 [   INFO]:codec: 'hevc_vaapi' encoder registered
2021-03-28 18:24:14.405 [   INFO]:codec: 'vp8_vaapi' encoder registered
2021-03-28 18:24:14.405 [   INFO]:codec: 'vp9_vaapi' encoder registered
2021-03-28 18:24:14.405 [   INFO]:codec: 'webtv-aac' codec profile created
2021-03-28 18:24:14.405 [   INFO]:codec: 'webtv-vorbis' codec profile created
2021-03-28 18:24:14.405 [   INFO]:codec: 'webtv-vp8' codec profile created
2021-03-28 18:24:14.405 [   INFO]:codec: 'webtv-h264' codec profile created
2021-03-28 18:24:14.408 [   INFO]:capmt: OSCAM @ Localhost active

RE: HELP needed - vaapi and tvheadend - Added by Oli S. 4 months ago

attachec codec profle can be added. But it stay's disabled after adding.

{
    "quality": 0,
    "device": "/dev/dri/renderD128",
    "bit_rate": 1200,
    "qp": 0,
    "deinterlace": false,
    "height": 0,
    "hwaccel": true,
    "pix_fmt": -1,
    "name": "TEST",
    "codec_name": "h264_vaapi",
    "profile": -99
}

RE: HELP needed - vaapi and tvheadend - Added by saen acro 4 months ago

Remove hwaccel check

RE: HELP needed - vaapi and tvheadend - Added by Bart Pstrok 4 months ago

Here is how I made it work. I have also Debian 10 installed on ASRock J4205. tvheadend: version 4.3-1923~gaaca05cc1
1. First absolutely check if in your system exists /dev/dri/renderD128. Then inspect its properties, in particular which group it belongs to, using a command:

$ ls -l /dev/dri/renderD128
crw-rw----+ 1 root render 226, 128 mar 28 14:19 /dev/dri/renderD128

All tutorials I read claims that is should belong to "video" group, but in my case it belongs to "render" group, so my user should also belong to "render" group. I wasted days to find that out. Check if your group was invalid. If so, then add your user to the same group of renderD128 (in my case group "render"), and try if your above solution works. If not:

Configuration/Stream/Stream Profiles/Add:
Type: MPEG-TS Spawn/build-in
In General Settings: as you wish.
In Spawn Settings/Command line:
ffmpeg -init_hw_device vaapi=foo:/dev/dri/renderD128 -hwaccel vaapi -hwaccel_output_format vaapi -hwaccel_device foo -i - -f mpegts -filter_hw_device foo -vf "scale_vaapi=w=-2:h=720,format=nv12|vaapi,hwupload" -c:v hevc_vaapi -b:v 1.5M -maxrate 2M -c:a libopus -b:a 32K pipe:1

Here's some description of that command:
-c:v hevc_vaapi
output format of video, in this case hevc. In my case it works, don't know if it will in yours. Others, like h264_vaapi, are listed in "Supported encoders" table on https://trac.ffmpeg.org/wiki/Hardware/VAAPI

h=720
720p vertical resolution.

-b:v 1.5M
average bandwidth of video, if I remember correctly.

-maxrate 2M
maximum bandwidth of video. If you cut this too short, video will be horrible.

-c:a libopus -b:a 64K
audio encoding with Opus and 64kbps. It can be also -c:a copy to just dump copy original audio without transcoding.

My ffmpeg is standalone ffmpeg from debian repository.

Here are couple of my profiles commandlines:
audio-only-opus:
ffmpeg -i - -f mpegts -vn -c:a libopus -b:a 28K -ac 1 pipe:1

hevc-vaapi-256p:
ffmpeg -init_hw_device vaapi=foo:/dev/dri/renderD128 -hwaccel vaapi -hwaccel_output_format vaapi -hwaccel_device foo -i - -f mpegts -filter_hw_device foo -vf "scale_vaapi=w=-2:h=256,format=nv12|vaapi,hwupload" -c:v hevc_vaapi -b:v 384K -maxrate 480K -c:a libopus -b:a 16K -ac 1 pipe:1

hevc-vaapi-320p:
ffmpeg -init_hw_device vaapi=foo:/dev/dri/renderD128 -hwaccel vaapi -hwaccel_output_format vaapi -hwaccel_device foo -i - -f mpegts -filter_hw_device foo -vf "scale_vaapi=w=-2:h=320,format=nv12|vaapi,hwupload" -c:v hevc_vaapi -b:v 384K -maxrate 512K -c:a libopus -b:a 16K -ac 1 pipe:1

hevc-vaapi-384p:
ffmpeg -init_hw_device vaapi=foo:/dev/dri/renderD128 -hwaccel vaapi -hwaccel_output_format vaapi -hwaccel_device foo -i - -f mpegts -filter_hw_device foo -vf "scale_vaapi=w=-2:h=384,format=nv12|vaapi,hwupload" -c:v hevc_vaapi -b:v 512K -maxrate 512K -c:a libopus -b:a 16K -ac 1 pipe:1

hevc-vaapi-480p:
ffmpeg -init_hw_device vaapi=foo:/dev/dri/renderD128 -hwaccel vaapi -hwaccel_output_format vaapi -hwaccel_device foo -i - -f mpegts -filter_hw_device foo -vf "scale_vaapi=w=-2:h=480,format=nv12|vaapi,hwupload" -c:v hevc_vaapi -b:v 512K -maxrate 512K -c:a libopus -b:a 16K -ac 1 pipe:1

hevc-vaapi-720p:
ffmpeg -init_hw_device vaapi=foo:/dev/dri/renderD128 -hwaccel vaapi -hwaccel_output_format vaapi -hwaccel_device foo -i - -f mpegts -filter_hw_device foo -vf "scale_vaapi=w=-2:h=720,format=nv12|vaapi,hwupload" -c:v hevc_vaapi -b:v 1.5M -maxrate 2M -c:a libopus -b:a 32K pipe:1

Hope this will help.

RE: HELP needed - vaapi and tvheadend - Added by Oli S. 4 months ago

Dear Bart,

many thx for your detailed description. But I think you are describing how to use hwaccel by transcoding with external ffmpeg by spawning. This I already got to run, very similar to your solution.

But I want to enable the hwaccell with internal ffmpeg (via vaaoi codecs). This is still somehow disabled.

Best regards, O

    (1-16/16)