use system ffmpeg // vaapi support
Added by Hans Müller about 4 years ago
hi,
so I want to use tvheadend with vaapi support on ubuntu 20.04.1. Ubuntu is running on ESXi VMware 7.0.
I got vaapi working and i can use it with ffmpeg. intel_gpu_top shows me, the system is using the intel gpu for transcoding with ffmpeg.
error: XDG_RUNTIME_DIR not set in the environment. error: can't connect to X server! libva info: VA-API version 1.9.0 libva info: User environment variable requested driver 'iHD' libva info: Trying to open /opt/media//lib/dri/iHD_drv_video.so libva info: Found init function __vaDriverInit_1_9 libva info: va_openDriver() returns 0 vainfo: VA-API version: 1.9 (libva 2.9.0.pre1) vainfo: Driver version: Intel iHD driver for Intel(R) Gen Graphics - 20.3.pre (6fbca6ed) vainfo: Supported profile and entrypoints VAProfileNone : VAEntrypointVideoProc VAProfileNone : VAEntrypointStats VAProfileMPEG2Simple : VAEntrypointVLD VAProfileMPEG2Simple : VAEntrypointEncSlice VAProfileMPEG2Main : VAEntrypointVLD VAProfileMPEG2Main : VAEntrypointEncSlice VAProfileH264Main : VAEntrypointVLD VAProfileH264Main : VAEntrypointEncSlice VAProfileH264Main : VAEntrypointFEI VAProfileH264Main : VAEntrypointEncSliceLP VAProfileH264High : VAEntrypointVLD VAProfileH264High : VAEntrypointEncSlice VAProfileH264High : VAEntrypointFEI VAProfileH264High : VAEntrypointEncSliceLP VAProfileVC1Simple : VAEntrypointVLD VAProfileVC1Main : VAEntrypointVLD VAProfileVC1Advanced : VAEntrypointVLD VAProfileJPEGBaseline : VAEntrypointVLD VAProfileJPEGBaseline : VAEntrypointEncPicture VAProfileH264ConstrainedBaseline: VAEntrypointVLD VAProfileH264ConstrainedBaseline: VAEntrypointEncSlice VAProfileH264ConstrainedBaseline: VAEntrypointFEI VAProfileH264ConstrainedBaseline: VAEntrypointEncSliceLP VAProfileVP8Version0_3 : VAEntrypointVLD VAProfileVP8Version0_3 : VAEntrypointEncSlice VAProfileHEVCMain : VAEntrypointVLD VAProfileHEVCMain : VAEntrypointEncSlice VAProfileHEVCMain : VAEntrypointFEI VAProfileHEVCMain10 : VAEntrypointVLD VAProfileHEVCMain10 : VAEntrypointEncSlice VAProfileVP9Profile0 : VAEntrypointVLD VAProfileVP9Profile2 : VAEntrypointVLD
ffmpeg version N-98978-g4cfe8123ea Copyright (c) 2000-2020 the FFmpeg developers built with gcc 9 (Ubuntu 9.3.0-10ubuntu2) configuration: --prefix=/opt/media/ --enable-shared --enable-vaapi --enable-gpl --enable-libx264 --enable-libx265 libavutil 56. 58.100 / 56. 58.100 libavcodec 58.101.101 / 58.101.101 libavformat 58. 51.101 / 58. 51.101 libavdevice 58. 11.101 / 58. 11.101 libavfilter 7. 87.100 / 7. 87.100 libswscale 5. 8.100 / 5. 8.100 libswresample 3. 8.100 / 3. 8.100 libpostproc 55. 8.100 / 55. 8.100 Hyper fast Audio and Video encoder
I want to build tvheadend with autobuild.
the autobuild always fails at ffmpeg step.
make -f Makefile.ffmpeg build make[3]: Entering directory '/tmp/tvheadend' cd /tmp/tvheadend/build.linux/ffmpeg/ffmpeg-4.1.5 && FFMPEG_PREFIX=/tmp/tvheadend/build.linux/ffmpeg/build/ffmpeg PKG_CONFIG=/tmp/tvheadend/support/pkg-config.ffmpeg ./configure --prefix=/ffmpeg --enable-static --disable-shared \ --disable-all \ --enable-gpl \ --enable-nonfree \ --extra-cflags="-I/tmp/tvheadend/build.linux/ffmpeg/build/ffmpeg/include -fPIE" \ --extra-libs="-L/tmp/tvheadend/build.linux/ffmpeg/build/ffmpeg/lib -ldl" \ --pkg-config="/tmp/tvheadend/support/pkg-config.ffmpeg" \ --enable-openssl \ --enable-avutil --enable-avcodec --enable-avformat --enable-swscale --enable-avresample --enable-swresample --enable-avfilter \ --enable-libx264 --enable-libx265 --enable-libvpx --enable-libtheora --enable-libvorbis --enable-libopus --enable-vaapi \ --enable-protocol=file --enable-protocol=http --enable-protocol=https --enable-protocol=hls --enable-protocol=mmsh --enable-protocol=mmst --enable-protocol=rtmp --enable-protocol=rtmpe --enable-protocol=rtmps --enable-protocol=rtmpt --enable-protocol=rtmpte --enable-protocol=rtmpts --enable-protocol=ffrtmpcrypt --enable-protocol=ffrtmphttp --enable-protocol=rtp --enable-protocol=srtp --enable-protocol=tcp --enable-protocol=udp --enable-protocol=udplite --enable-protocol=unix --enable-protocol=crypto \ --enable-decoder=mpeg2video --enable-decoder=mp2 --enable-decoder=aac --enable-decoder=vorbis --enable-decoder=ac3 --enable-decoder=eac3 --enable-decoder=aac_latm --enable-decoder=opus --enable-decoder=h264 --enable-decoder=hevc --enable-decoder=theora --enable-decoder=flac --enable-decoder=libvorbis \ --enable-encoder=mpeg2video --enable-encoder=mp2 --enable-encoder=aac --enable-encoder=vorbis --enable-encoder=flac --enable-encoder=libx264 --enable-encoder=libx265 --enable-encoder=libvpx_vp8 --enable-encoder=libvpx_vp9 --enable-encoder=libtheora --enable-encoder=libvorbis --enable-encoder=libopus --enable-encoder=h264_vaapi --enable-encoder=hevc_vaapi --enable-encoder=vp8_vaapi --enable-encoder=vp9_vaapi \ --enable-demuxer=mpegts --enable-demuxer=matroska --enable-demuxer=hls --enable-demuxer=flv --enable-demuxer=live_flv \ --enable-muxer=mpegts --enable-muxer=matroska --enable-muxer=mp4 --enable-muxer=ogg \ --enable-bsf=h264_mp4toannexb --enable-bsf=hevc_mp4toannexb \ --enable-filter=yadif --enable-filter=format --enable-filter=hwupload --enable-filter=hwdownload --enable-filter=scale --enable-filter=null --enable-filter=aresample --enable-filter=anull --enable-filter=deinterlace_vaapi --enable-filter=scale_vaapi \ --enable-hwaccel=mpeg2_vaapi --enable-hwaccel=h264_vaapi --enable-hwaccel=hevc_vaapi --enable-hwaccel=vp9_vaapi \ --disable-programs \ --disable-doc \ --disable-htmlpages \ --disable-manpages \ --disable-podpages \ --disable-txtpages ERROR: vaapi requested but not found
Is there a way to tell tvheadend autobuild to use the system ffmpeg?
or how can i adjust autobuild just to use the variables i want to use?
I did try the following and this was working.
cd /tmp/tvheadend/build.linux/ffmpeg/ffmpeg-4.1.5 FFMPEG_PREFIX=/tmp/tvheadend/build.linux/ffmpeg/build/ffmpeg PKG_CONFIG=/tmp/tvheadend/support/pkg-config.ffmpeg ./configure --prefix=/ffmpeg --enable-shared --enable-vaapi --enable-gpl --enable-libx264 --enable-libx265
thanks
Replies (17)
RE: use system ffmpeg // vaapi support - Added by saen acro about 4 years ago
RE: use system ffmpeg // vaapi support - Added by Hans Müller about 4 years ago
Checking support/features 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 ... fail 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 WARN: no python binary found checking for py module gzip ... fail 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.1f) 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.34) checking for pkg liburiparser ... ok (detected 0.9.3) 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.9.0) checking for pkg libva-x11 >=0.38.0 ... ok (detected 1.9.0) checking for pkg libva-drm >=0.38.0 ... ok (detected 1.9.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.16) Compiler: Using C compiler: cc Using C flags: -I/opt/media//include -I”/opt/media/”/include Using LD flags: -L/opt/media//lib -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 gmtoff yes recvmmsg yes sendmmsg yes ifnames 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.1f zlib 1.2.11 libpcre2-8 10.34 liburiparser 0.9.3 avahi-client 0.7 libva 1.9.0 libva-x11 1.9.0 libva-drm 1.9.0 dbus-1 1.12.16 Installation paths: Prefix: /usr/local Binaries: ${prefix}/bin Libraries: ${prefix}/lib Data files: ${prefix}/share Man pages: ${datadir}/man Final Binary: /tmp/tvheadend/build.linux/tvheadend Tvheadend Data Directory: /usr/local/share/tvheadend
RE: use system ffmpeg // vaapi support - Added by saen acro about 4 years ago
WARN: no python binary found
https://tvheadend.org/boards/4/topics/24116#Short-version-of-all-needed-packages
RE: use system ffmpeg // vaapi support - Added by Hans Müller about 4 years ago
For anyone using Ubuntu 20 and need to use python2 as well, here is how it's working.
$ sudo apt install python2 OR $ sudo apt install python-minimal
check which python versions you have available
$ ls /usr/bin/python* /usr/bin/python2 /usr/bin/python2.7 /usr/bin/python3
set the python alternatives
$ sudo update-alternatives --install /usr/bin/python python /usr/bin/python2 1 $ sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 2
choose python version you want to use
$ sudo update-alternatives --config python There are 2 choices for the alternative python (providing /usr/bin/python). Selection Path Priority Status ------------------------------------------------------------ * 0 /usr/bin/python3 2 auto mode 1 /usr/bin/python2 1 manual mode 2 /usr/bin/python3 2 manual mode Press to keep the current choice[*], or type selection number: 1
./configure
Checking support/features 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 ... fail 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.1f) 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.34) checking for pkg liburiparser ... ok (detected 0.9.3) 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.9.0) checking for pkg libva-x11 >=0.38.0 ... ok (detected 1.9.0) checking for pkg libva-drm >=0.38.0 ... ok (detected 1.9.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.16) Compiler: Using C compiler: cc Using C flags: -I/opt/media//include Using LD flags: -L/opt/media//lib -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 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.1f zlib 1.2.11 libpcre2-8 10.34 liburiparser 0.9.3 avahi-client 0.7 libva 1.9.0 libva-x11 1.9.0 libva-drm 1.9.0 dbus-1 1.12.16 Installation paths: Prefix: /usr/local Binaries: ${prefix}/bin Libraries: ${prefix}/lib Data files: ${prefix}/share Man pages: ${datadir}/man Final Binary: /tmp/tvheadend/build.linux/tvheadend Tvheadend Data Directory: /usr/local/share/tvheadend
python now working, still stuck at the same point. pretty sure it is directly related to ffmpeg.
RE: use system ffmpeg // vaapi support - Added by saen acro about 4 years ago
in folder where git clone
make distclean ./Autobuild.sh -j$(nproc)
or use auto script
https://tvheadend.org/boards/4/topics/24116#Automated-build-script
with will generate build.log
RE: use system ffmpeg // vaapi support - Added by Hans Müller about 4 years ago
still same problem.
attached the build.log.
RE: use system ffmpeg // vaapi support - Added by saen acro about 4 years ago
20.04 have some problems as I see in lot of forums and ffmpeg mails.
Intel 100% have bigger problems they cannot write software.
They destroyed QSV now offer OneAPI
RE: use system ffmpeg // vaapi support - Added by Hans Müller about 4 years ago
Thank you so far.
But I have 20.04 working with the Intel drivers. So system ffmpeg is working with vaapi.
some variables in the auto script build for ffmpeg seem not to be compatible with the drivers I am running.
As I mentioned, I can build the tvheadend ffmpeg version with the following variables.
$ cd /tmp/tvheadend/build.linux/ffmpeg/ffmpeg-4.1.5 $ FFMPEG_PREFIX=/tmp/tvheadend/build.linux/ffmpeg/build/ffmpeg PKG_CONFIG=/tmp/tvheadend/support/pkg-config.ffmpeg ./configure --prefix=/ffmpeg --enable-shared --enable-vaapi --enable-gpl --enable-libx264 --enable-libx265
there must be a way, either to let tvheadend use the system ffmpeg or to adjust the variables autobuild uses.
RE: use system ffmpeg // vaapi support - Added by saen acro about 4 years ago
https://github.com/tvheadend/tvheadend/blob/master/Makefile.ffmpeg#L593
vaapi check I guess
https://github.com/tvheadend/tvheadend/blob/master/Makefile.ffmpeg#L656
configuration part
do some experiments
RE: use system ffmpeg // vaapi support - Added by Hans Müller about 4 years ago
Update, got tvheadend working at least with h264_vaapi.
hevc_vaapi and vp9_vaapi not working at the moment, not sure why yet.
RE: use system ffmpeg // vaapi support - Added by saen acro about 4 years ago
Hans Müller wrote:
Update, got tvheadend working at least with h264_vaapi.
hevc_vaapi and vp9_vaapi not working at the moment, not sure why yet.
GPU is?
embeded opensource driver in kernel or proprietary used?
RE: use system ffmpeg // vaapi support - Added by Hans Müller about 4 years ago
yep tvheadend is using the gpu for h264 transcoding.
i am using the intel media driver
RE: use system ffmpeg // vaapi support - Added by saen acro about 4 years ago
Hans Müller wrote:
yep tvheadend is using the gpu for h264 transcoding.
i am using the intel media driver
What is a GPU model is question?
lscpu |grep Model
RE: use system ffmpeg // vaapi support - Added by Hans Müller about 4 years ago
Model: 166 Model name: Intel(R) Core(TM) i7-10710U CPU @ 1.10GHz
13:00.0 VGA compatible controller: Intel Corporation Device 9bca (rev 04) (prog-if 00 [VGA controller]) DeviceName: pciPassthru0 Subsystem: Intel Corporation Device 2081 Physical Slot: 224 Flags: bus master, fast devsel, latency 64, IRQ 67 Memory at fb000000 (64-bit, non-prefetchable) [size=16M] Memory at c0000000 (64-bit, prefetchable) [size=512M] I/O ports at 3000 [size=64] Capabilities: [40] Vendor Specific Information: Len=0c <?> Capabilities: [70] Express Endpoint, MSI 00 Capabilities: [ac] MSI: Enable+ Count=1/1 Maskable- 64bit- Capabilities: [d0] Power Management version 2 Capabilities: [100] Process Address Space ID (PASID) Capabilities: [200] Address Translation Service (ATS) Capabilities: [300] Page Request Interface (PRI) Kernel driver in use: i915 Kernel modules: i915
RE: use system ffmpeg // vaapi support - Added by saen acro about 4 years ago
https://en.wikipedia.org/wiki/Intel_Quick_Sync_Video#Hardware_decoding_and_encoding
https://software.intel.com/content/www/us/en/develop/articles/encode-and-decode-capabilities-for-7th-generation-intel-core-processors-and-newer.html
There are some extra packages with must be installed to run proprietary functions
RE: use system ffmpeg // vaapi support - Added by Hans Müller about 4 years ago
Yes I know.
hevc and vp9 works with ffmpeg alone. also tvheadend is showing it in the streams options as hevc_vaapi.
But when I try to use it, it ends with "unknown error detected"
RE: use system ffmpeg // vaapi support - Added by Hans Müller about 4 years ago
I give up for now. I can live with just H246.
Maybe I will try again my setup with Ubuntu 18 in the next weeks.