Jump to content

GPU Transcoding (Intel QuickSync and nVidia NVENC)


witteschnitte

Recommended Posts

Guest mjorud

I have both decode and encode enabled in the transcode menu so that is taken care of. 

Have tested several HEVC files and speed varies from "speed=1.8x" to "speed=4.5x" and both Android Phone and Chrome to play movies. Not very scientific. :P

 

 

During testing this popped up in the ffmpeg log (and no video):

[hevc_cuvid @ 00000214fedb01e0] ctx->cvdl->cuvidCreateDecoder(&ctx->cudecoder, &cuinfo) failed -> CUDA_ERROR_OUT_OF_MEMORY: out of memory
[hevc_cuvid @ 00000214fedb01e0] ctx->cvdl->cuvidDecodePicture(ctx->cudecoder, picparams) failed -> CUDA_ERROR_INVALID_HANDLE: invalid resource handle
[hevc_cuvid @ 00000214fedb01e0] cuvid decode callback error
Error while decoding stream #0:0: Generic error in an external library

I noticed I had three instances of ffmpeg running even though I had no movies transcoding. Two of the instances disappeared after a while but the last instance kept on running. Had to kill it. For some reason Emby does not always kill ffmpeg when stop playing...

 

Regarding the compilation guide, it is very helpfull but does not cover implimentations of --enable-nvenc, --enable-cuda nor --enable-cuvid.

Link to comment
Share on other sites

The next release of Emby Server for Linux x64 will include NVENC support out of the box so all you need to do is enable it. 

 

Nvidia Cuda and OpenCL drivers will need to be installed first. These cannot be freely distributed by us so you will need to refer to your respective distro to learn how to install them.

 

Thanks !

Link to comment
Share on other sites

Guest mjorud

The next release of Emby Server for Linux x64 will include NVENC support out of the box so all you need to do is enable it. 

 

Nvidia Cuda and OpenCL drivers will need to be installed first. These cannot be freely distributed by us so you will need to refer to your respective distro to learn how to install them.

 

Thanks !

That's good news. Looking forward to test. :)

  • Like 1
Link to comment
Share on other sites

Guest mjorud

I just installed the latest beta and NVENC hardware transcode works right out of the box! :)

 

1080p remux to 1080p@8 mbit, no subs: speed=3.39x

1080p remux to 1080p@8 mbit, PGS: speed= 1.7x

4K remux to 1080p@8 mbit, no subs: speed=0.858x

4K remux to 1080p@8 mbit, PGS: speed=0.701x

 

I have tried several movies with srt subs, but none transcodes. Here is an excerpt from the log file:

Stream mapping:
  Stream #0:0 -> #0:0 (h264 (h264_cuvid) -> h264 (h264_nvenc))
  Stream #0:1 -> #0:1 (dts (dca) -> mp3 (libmp3lame))
Press [q] to stop, [?] for help
[Parsed_subtitles_0 @ 0x2427500] Shaper: FriBidi 0.19.7 (SIMPLE)
[h264 @ 0x244c2c0] sps_id 1 out of range
[matroska,webm @ 0x2446a20] Could not find codec parameters for stream 3 (Subtitle: hdmv_pgs_subtitle (pgssub)): unspecified size
Consider increasing the value for the 'analyzeduration' and 'probesize' options
[Parsed_subtitles_0 @ 0x2427500] Loading font file '/var/lib/emby/fonts/DroidSansFallback.ttf'
[Parsed_subtitles_0 @ 0x2427500] Using font provider fontconfig
Edited by mjorud
Link to comment
Share on other sites

Gerrit507

 

I just installed the latest beta and NVENC hardware transcode works right out of the box! :)

 

1080p remux to 1080p@8 mbit, no subs: speed=3.39x

1080p remux to 1080p@8 mbit, PGS: speed= 1.7x

4K remux to 1080p@8 mbit, no subs: speed=0.858x

4K remux to 1080p@8 mbit, PGS: speed=0.701x

 

I have tried several movies with srt subs, but none transcodes. Here is an excerpt from the log file:

Stream mapping:
  Stream #0:0 -> #0:0 (h264 (h264_cuvid) -> h264 (h264_nvenc))
  Stream #0:1 -> #0:1 (dts (dca) -> mp3 (libmp3lame))
Press [q] to stop, [?] for help
[Parsed_subtitles_0 @ 0x2427500] Shaper: FriBidi 0.19.7 (SIMPLE)
[h264 @ 0x244c2c0] sps_id 1 out of range
[matroska,webm @ 0x2446a20] Could not find codec parameters for stream 3 (Subtitle: hdmv_pgs_subtitle (pgssub)): unspecified size
Consider increasing the value for the 'analyzeduration' and 'probesize' options
[Parsed_subtitles_0 @ 0x2427500] Loading font file '/var/lib/emby/fonts/DroidSansFallback.ttf'
[Parsed_subtitles_0 @ 0x2427500] Using font provider fontconfig

I'm wondering why you get so low bitrates when transcoding from 4k to 1080p...

 

I can transcode with my 1050Ti or G4600 in realtime as long as I don't enable bitmap subs (PGS).

 

I would try to play around with the transcoding settings a little bit. Otherwise the P400 is probably just to weak... Which is kind of strange because the P400 and the 1050Ti are in the same price range and the P400 doesn't have any benefits in this department, both cards can only encode two streams at the same time.

Edited by Gerrit507
Link to comment
Share on other sites

NVENC works perfectly fine on a Debian 9 system with a 1050 Ti.

 

Thanks guys!

Application version: 3.3.1.13

 

4K H.265 > 1080p H.264  (10 Mbps)

 

frame= 527 fps=131 q=8.0 size=N/A time=00:00:22.23 bitrate=N/A speed=5.54x

 

GPU-Util: 32% 

Memory-Usage: 649MiB / 4040MiB

 

Edited by hsran
Link to comment
Share on other sites

Played with NVENC settings and looks like the H.264 presets menu isn't in sync with nvenc presets.Anything over fast defaults to fast preset.

 h264_nvenc AVOptions:

  -preset            <int>        E..V.... Set the encoding preset (from 0 to 11) (default medium)
     default                      E..V....
     slow                         E..V.... hq 2 passes
     medium                       E..V.... hq 1 pass
     fast                         E..V.... hp 1 pass
     hp                           E..V....
     hq                           E..V....
     bd                           E..V....
     ll                           E..V.... low latency
     llhq                         E..V.... low latency hq
     llhp                         E..V.... low latency hp
     lossless                     E..V....
     losslesshp                   E..V....

 

Edited by hsran
Link to comment
Share on other sites

RanmaCanada

I'm wondering why you get so low bitrates when transcoding from 4k to 1080p...

 

I can transcode with my 1050Ti or G4600 in realtime as long as I don't enable bitmap subs (PGS).

 

I would try to play around with the transcoding settings a little bit. Otherwise the P400 is probably just to weak... Which is kind of strange because the P400 and the 1050Ti are in the same price range and the P400 doesn't have any benefits in this department, both cards can only encode two streams at the same time.

All the nvenc engines are the same in Pascal, so it comes down to memory bandwidth, which the GP400 seriously lacks.  It has a quarter of the memory bandwidth of a 1050Ti and half the bus width, so it has been seriously hobbled by Nvidia.  The Nvidia cards with faster memory can encode faster, but that's about it.

 

https://developer.nvidia.com/video-encode-decode-gpu-support-matrix

 

For those thinking of going to workstation cards, here is the updated matrix from nvidia.  It will let you know what cards you want to buy to get the max unlimited streams and what bit depth they support as well.

Link to comment
Share on other sites

  • 1 month later...
yepitro1986

use windows server 2016 essential and intel pentium G4560 and intel IGPU (HD610) Emby always fail decode from 4K HEVC to 1080p or lower, this is by intel IGPU driver or intel IGPU too weak to encode that

 

attach my log

 

Stream mapping:
  Stream #0:0 -> #0:0 (hevc (hevc_qsv) -> h264 (h264_qsv))
  Stream #0:3 -> #0:1 (copy)
Press [q] to stop, [?] for help
[hevc_qsv @ 000002184b925dc0] Could not load the requested plugin '15dd936825ad475ea34e35f3f54217a6': specified object was not found (-9)
[hevc_qsv @ 000002184b925dc0] Error loading plugins
[hevc_qsv @ 000002184b925dc0] Error initializing an MFX session
Error while decoding stream #0:0: Function not implemented
[hevc_qsv @ 000002184b925dc0] Error initializing the MFX video decoder: invalid video parameters (-15)
Error while decoding stream #0:0: Invalid argument
[hevc_qsv @ 000002184b925dc0] Error initializing the MFX video decoder: invalid video parameters (-15)
Error while decoding stream #0:0: Invalid argument
[hevc_qsv @ 000002184b925dc0] Error initializing the MFX video decoder: invalid video parameters (-15)

ffmpeg-transcode-3870cadc-522c-4eb6-84b6-9e2538667d67.txt

embyserver.txt

Edited by yepitro1986
Link to comment
Share on other sites

 

use windows server 2016 essential and intel pentium G4560 and intel IGPU (HD610) Emby always fail decode from 4K HEVC to 1080p or lower, this is by intel IGPU driver or intel IGPU too weak to encode that

 

attach my log

 

Stream mapping:
  Stream #0:0 -> #0:0 (hevc (hevc_qsv) -> h264 (h264_qsv))
  Stream #0:3 -> #0:1 (copy)
Press [q] to stop, [?] for help
[hevc_qsv @ 000002184b925dc0] Could not load the requested plugin '15dd936825ad475ea34e35f3f54217a6': specified object was not found (-9)
[hevc_qsv @ 000002184b925dc0] Error loading plugins
[hevc_qsv @ 000002184b925dc0] Error initializing an MFX session
Error while decoding stream #0:0: Function not implemented
[hevc_qsv @ 000002184b925dc0] Error initializing the MFX video decoder: invalid video parameters (-15)
Error while decoding stream #0:0: Invalid argument
[hevc_qsv @ 000002184b925dc0] Error initializing the MFX video decoder: invalid video parameters (-15)
Error while decoding stream #0:0: Invalid argument
[hevc_qsv @ 000002184b925dc0] Error initializing the MFX video decoder: invalid video parameters (-15)

 

 

Hi, try disabling hardware decoding for hevc, and just leave encoding on. Thanks.

Link to comment
Share on other sites

yepitro1986

Hi, try disabling hardware decoding for hevc, and just leave encoding on. Thanks.

still no solution for this issue?

Link to comment
Share on other sites

Gerrit507

still no solution for this issue?

After a quick google search it looks like a ffmpeg isssue. What you can try is to update to the latest beta version of emby. It comes with ffmpeg 4.0. Maybe it works with that version, because the version in emby stable is very old afaik. Another option would be to switch to linux...

Edited by Gerrit507
Link to comment
Share on other sites

The version with emby stable is 3.4.2, which isn't all that old. In fact they jumped from 3.4.2 to 4.0 rather suddenly.

Link to comment
Share on other sites

Gerrit507

trying latest emby beta still doesn't solve my issue

Just google that line of the log:

Error initializing the MFX video decoder: invalid video parameters

It's a common issue with ffmpeg and qsv.

 

The only thing I can recommend to you is using linux and vaapi which is at least in my opinion much better supported in ffmpeg.

 

This member had the same issue:

 

https://emby.media/community/index.php?/topic/55876-quicksync-apollo-lake-windows-10-not-working-cpu-fallback/

 

@@Luke

Edited by Gerrit507
Link to comment
Share on other sites

yepitro1986

Just google that line of the log:

Error initializing the MFX video decoder: invalid video parameters

It's a common issue with ffmpeg and qsv.

 

The only thing I can recommend to you is using linux and vaapi which is at least in my opinion much better supported in ffmpeg.

 

This member had the same issue:

 

https://emby.media/community/index.php?/topic/55876-quicksync-apollo-lake-windows-10-not-working-cpu-fallback/

 

@@Luke

so use Linux and VAAPI make ffmpeg and qsv  work?

Link to comment
Share on other sites

Try expirementing with the settings. You have both vaapi encoding and decoding turned on. Try using just one or the other.

Link to comment
Share on other sites

Gerrit507

on linux i still get trouble here's log

OK first of all you need Linux Kernel 4.13 or higher for your cpu to have full support of all features including vaapi.

 

Then you need the vaapi driver

sudo apt-get install i965-va-driver vainfo 
Link to comment
Share on other sites

  • 3 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...