Feature #3080 Transcoding with HW Support 2015-09-15 15:00 - B C
Total Page:16
File Type:pdf, Size:1020Kb
Tvheadend - Feature #3080 Transcoding with HW support 2015-09-15 15:00 - B C Status: Fixed Start date: 2015-09-15 Priority: Normal Due date: Assignee: John Törnblom % Done: 0% Category: Transcoding Estimated time: 0.00 hour Target version: Description Would it be possible to add hwaccelerated transcoding via Intel QuickSync Video to tvheadend? https://www.ffmpeg.org/general.html#Intel-QuickSync-Video Building with the dispatcher was quite easy, but unfortunately it seems it can't be set as default and needs to be enabled in code and I've never done anything on the transcoding layer. As many might run tvh on a recent Intel CPU, this might benefit a lot of people. as always, thank you for this great peace of software History #1 - 2015-09-16 13:57 - C vH You need at least ffmpeg 2.8 and we are talking about speedup of >twice with ~nearly zero cpu usage at all (mainly depends on the used cpu)! #2 - 2015-09-19 10:56 - B C great, I see that libmfx was also included in the recent update to ffmpeg 2.8, so all prerequesites are met, we now "just" need an option to enable hwaccel #3 - 2015-09-19 11:39 - Jaroslav Kysela It won't work. The preliminary codes in Makefile.ffmpeg are there, but the quality of that library is very low (C++, why?). I gave up for the moment. #4 - 2015-09-19 12:09 - B C i know, that's why i put just in quotation marks, but thanks for trying #5 - 2015-09-29 18:22 - Jaroslav Kysela The --enable-libmfx and --enable-libmfx_static options should work now... (For --enable-libffmpeg_static builds).. I've not tested it at the moment. #6 - 2015-09-29 18:23 - Jaroslav Kysela It enabled these decoders/encoders in ffmpeg: DECODERS += mpeg2_qsv h264_qsv hevc_qsv ENCODERS += mpeg2_qsv h264_qsv hevc_qsv #7 - 2015-09-29 22:42 - B C Thank you for your continous support. There seems to be a problem with the pixel format, I get the following messages: 2015-09-29 22:38:40.117 libav: left block unavailable for requested intra4x4 mode -1 at 0 33 2015-09-29 22:38:40.117 libav: error while decoding MB 0 33, bytestream 12216 2015-09-29 22:38:40.117 libav: concealing 1009 DC, 1009 AC, 1009 MV errors in I frame 2015-09-29 22:38:40.120 libav: Specified pixel format yuv420p is invalid or not supported 2015-09-29 22:38:40.120 transcode: 0005: Unable to open h264_qsv encoder Keep up the good work #8 - 2015-09-29 22:45 - The Troll Hi, take a look at https://github.com/TheTroll/tvheadend, specifically in the transcoding.c file. Quicksync transcoding works with this version. #9 - 2015-09-30 08:35 - Jaroslav Kysela 2021-09-24 1/17 @The Troll: Could you create a pull request for a review ? #10 - 2015-09-30 08:54 - B C I did try TheTrolls repository but did not succeed either, although with a slightly different error message. I'm running on an i5-4250U (HD Graphics 5000) 2015-09-30 08:41:30.662 transcode: 000A: Using decoder mpeg2video 2015-09-30 08:41:30.662 transcode: 000A: SD->SD SW scaling crashes, forcing dest height to 600 2015-09-30 08:41:30.662 transcode: 000A: 1:MPEG2VIDEO 720x480 > H264 900x600 (h264_qsv) 2015-09-30 08:41:30.662 transcode: 000A: Using decoder mp2 2015-09-30 08:41:30.662 transcode: 000A: 2:MPEG2AUDIO > AAC (aac) 2015-09-30 08:41:30.959 libav: skipped MB in I frame at 25 23 2015-09-30 08:41:30.959 libav: Warning MVs not available 2015-09-30 08:41:30.960 libav: concealing 180 DC, 180 AC, 180 MV errors in I frame 2015-09-30 08:41:30.964 transcode: Transcode using codec h264_qsv 2015-09-30 08:41:30.966 libav: Error initializing an internal MFX session 2015-09-30 08:41:30.966 transcode: 000A: Unable to open h264_qsv encoder #11 - 2015-09-30 09:51 - Jaroslav Kysela Is Intel Media SDK present in your system ? #12 - 2015-09-30 10:00 - B C not yet, I didn't know I need it, I will install it shortly #13 - 2015-09-30 11:07 - B C still it seems I'm doing something wrong. Installed the SDK, rebooted, distclean, configure.... master and TheTrolls Version still failing to use QSV. Another error message: 2015-09-30 10:53:21.488 [ ERROR] libav: Error initializing an internal MFX session 2015-09-30 10:53:21.488 [ ERROR] transcode: 0001: Unable to decode video (-38, function not imlpemented) ./configure --enable-libffmpeg_static --enable-libmfx_static --enable-libx265 --enable-libmfx BTW, there is nothing like a --enable-libx265_static, and --enable-libmfx_static alone (w/o --enable-libmfx) I no longer have QSV Decoders available.. #14 - 2015-09-30 11:49 - B C a suspect my multiple libva and libdrm versions on the system are spoiling things, I will have to sort this out without killing everything, so I will need some time #15 - 2015-09-30 23:22 - B C found it, I need kernel 3.14.5 for the Media SDK patches (I really should have gone through the whole guide), will see if all my hardware is happy with it in the next view days. #16 - 2015-10-30 16:34 - Felix Wittke Hi. I tried intel quick sync on both. CentOS and Ubuntu and all times i get this error. libav: Error initializing an internal MFX session by trolls version. The official tvheadend git i get Unable to open h264_qsv encoder So what should i do to get Quicksync working? do you have any ideas? Happy to get an answer Regards Felix #17 - 2015-10-30 19:54 - B C first of all make sure samples from mediasdk are working. if that is the case i should have a solution for current master. if not I can only walk you through on debian #18 - 2015-10-30 22:48 - Felix Wittke 2021-09-24 2/17 Hi thanks for your fast answer. i tried to get the samples working but i dont know how. because the guide will to compile with perl but the file doesnt exist. So can you please provide me your solution for the current master? the guide for debian is also very interesting for me. happy to hearing from you again regards Felix #19 - 2015-10-30 23:09 - B C you don't need to build the samples, they are in /opt/intel/mediasdk/samples/_bin/x64 google for a .h264 elementary stream test file and try the first sample from the install guide, so we know if installation is correct #20 - 2015-10-30 23:26 - Felix Wittke Hi. Just tried I get: ./sample_multi_transcode_drm -i::h264 test_stream.264 -o::h264 test_out.h264 -hw Multi Transcoding Sample Version 6.0.16043166.166 libva info: VA-API version 0.35.0 libva info: va_getDriverName() returns 0 libva info: User requested driver 'iHD' libva info: Trying to open /opt/intel/mediasdk/lib64/iHD_drv_video.so libva info: Found init function __vaDriverInit_0_32 libva info: va_openDriver() returns 0 Ungültiger Maschinenbefehl this is centos which is recomend bye intel. but the same error i get on ubuntu with kernel 3.14.5 Its a 4gen CPU and on windows Quicksync works fine Did you had any idea? #21 - 2015-10-30 23:47 - B C you installed with the corresponding install script? kernel patches applied w/o an error message? I also was not lucky with intels gold configuration, so I did go with generic on debian (so should be nearly the same on ubuntu) manually. started with a minimum install, compiled 3.14.5 with patches, removed libdrm and libva from /usr/lib64 (and i think they are also in x86_64-linux-gnu). when you ./configure libdrm and libva use --prefix=usr --libdir=lib64 reboot and try the sample again #22 - 2015-10-30 23:59 - Felix Wittke Yes now in CentOS i have installed with the install Script and follow the guide. No errors when building the kernel and install the kernel patches So you think i should go back to ubuntu? Or should i try to compile libdrm and libva again with this settings in CentOS? #23 - 2015-10-31 11:35 - B C your choice, my install is on debian, that's the distribution I can help you (must be pre gcc 5, so current stable jessie eg) #24 - 2015-10-31 12:44 - Felix Wittke Ok i will try. I just figured out that may cpu G1840 Celeron is may not supported under linux. So first i went to get a supported cpu. Or do you know whether my cpu is working under linux? Can you provide me anyway your solution for the curret master? Regards #25 - 2015-10-31 12:49 - B C at least it's not on the supported list I will provide patches for current master shortly #26 - 2015-11-03 15:52 - Felix Wittke 2021-09-24 3/17 So finally i got a new CPU. the intel samples are wotking fine. Tvheadend give me the same error massages. So i dont know what to do. Regards Felix #27 - 2015-11-03 16:06 - B C quick and dirty try the following: copy the content of /opt/intel/mediasdk/lib64 to your libs dir copy TheTrools /src/plumbing/transcoding.c to master. configure tvh with ./configure --enable-libffmpeg_static --enable-libx265 --enable-libmfx if you have a braswell cpu most of TheTrolls fixes are not needed (just the correct pix_fmt stuff).