Bug #3570
QSV Transcoding did not work
0%
Description
Hi,
I tried transcoding with QSV for mobile device, but it did not work.
Only voice was work.
H/W : i7-5500U, standalone ffmpeg(with QSV) works well.
Here is the log when I tried.
=========
2016-02-14 10:28:55.932 transcode: 000C: 1:H264 1920x1080 > H264 854x480 (h264_qsv)
2016-02-14 10:28:55.932 transcode: 000C: 2:AC3 > AAC (aac)
2016-02-14 10:28:55.932 transcode: 000C: missing meta data for H264
2016-02-14 10:28:55.954 transcode: 000C: Using preset faster
2016-02-14 10:28:55.955 libav: mfx init: /dev/dri/renderD128 vaInitialize failed
2016-02-14 10:28:55.955 libav: mfx init: /dev/dri/renderD129 fd open failed
2016-02-14 10:28:55.955 libav: mfx init: /dev/dri/renderD130 fd open failed
2016-02-14 10:28:55.955 libav: mfx init: /dev/dri/card0 vaInitialize failed
2016-02-14 10:28:55.955 libav: mfx init: /dev/dri/card1 fd open failed
2016-02-14 10:28:55.955 libav: mfx init: /dev/dri/card2 fd open failed
2016-02-14 10:28:55.957 libav: Error initializing the encoder
2016-02-14 10:28:55.957 transcode: 000C: Unable to open h264_qsv encoder
=========
Also, if I choose the 'ultrafast' preset instead of 'faster' I met the another problem as follow.
=========
2016-02-14 10:41:31.777 transcode: 000E: Using preset ultrafast
2016-02-14 10:41:31.777 libav: Undefined constant or missing '(' in 'ultrafast'
2016-02-14 10:41:31.777 libav: Unable to parse option value "ultrafast"
2016-02-14 10:41:31.777 libav: Error setting option preset to value ultrafast.
=========
Thanks,
History
Updated by MinGyoon Woo over 8 years ago
I found the problem, reference from https://tvheadend.org/issues/3080
It is not the code bugs.
It is related with environment varibales.
Basically, Intel Media Server Studio let set the environment variables for using their SDK tool.
QSV encoding related variables are following.
=================
MFX_HOME=/opt/intel/mediasdk
LIBVA_DRIVERS_PATH=/opt/intel/mediasdk/lib64
LIBVA_DRIVER_NAME=iHD
LD_LIBRARY_PATH=/usr/local/lib
=================
But, TVHeadend do not use this environment variables, and use default values.
However, default value also various by how developer set the '--prefix' when build the libva.
System default, it is '/usr/lib/x86_64-linux-gnu/dri' folder, and driver name is 'i965-drv-video.so'.
So, I need to create symbolic links at the '/usr/lib/x86_64-linux-gnu/dri' (or '/usr/local/lib/dri')
=================
ln -s /opt/intel/mediasdk/lib64/iHD_drv_video_so i965_drv_video.so
ln -s /opt/intel/mediasdk/lib64/libmfxhw64-p.so.1.16 libmfxhw64.so
ln -s /opt/intel/mediasdk/lib64/libmfxsw64-p.so.1.16 libmfxsw64.so
=================
BTW, this is the workaround method to solve current problem. So I believe TVHeadend need to use the environment variables internally.
Thanks,
Updated by Jaroslav Kysela over 8 years ago
- Status changed from New to Invalid
BTW, this is the workaround method to solve current problem. So I believe TVHeadend need to use the environment variables internally.
You may set the environment variables before the tvheadend executable is run. Check your init scripts or systemd unit files....
It looks like system administation issue to me. TVH does not unset any environment variable when it's executed.
The SDK set's the environment variables probably only for login shell not for deaemons.
Updated by Jaroslav Kysela over 8 years ago
Also, you may add path to libraries from SDK to /etc/ld.so.conf or /etc/ld.so.conf.d/ ...
Updated by MinGyoon Woo over 8 years ago
Jaroslav Kysela wrote:
Also, you may add path to libraries from SDK to /etc/ld.so.conf or /etc/ld.so.conf.d/ ...
1. set environment variables in /etc/environment file, it didn't work.
2. already set the library path to /etc/ld.so.conf.d/, but didn't work.
3. set environment variables in /etc/init.d/tvheadend script before execute the tvheadend binary, it also didn't work.
Any other options?
Updated by Jaroslav Kysela over 8 years ago
OK, I overlooked that you changed also .so names.
The libmfxhw64.so and libmfxsw64.so strings are hardcoded in libmfx we use from: https://github.com/lu-zero/mfx_dispatch , so you may report the problem there that the Intel SDK changed. You may also configure tvheadend to use another libmfx - use --disable-libmfx_static for the configure script and make sure that 'pkg-config --version libmfx' works for you.
LIBVA_DRIVERS_PATH and LIBVA_DRIVER_NAME are used in libva.so library. Again, tvheadend does not modify the environment variables, so they should be passed to libva unmodified. Eventually, libva library can read these variables from /etc/libva.conf .
Updated by MinGyoon Woo over 8 years ago
Jaroslav Kysela wrote
OK, I overlooked that you changed also .so names.
Thanks for your kindly help. Yes, I understood this is not a TVHeadend problem.
However, some users - who try to build and install TVHeadend based on Intel's guideline - have same problem with me.
So I hope this record may help to them as like FAQ.
Thanks again.