Details about NVENC in Turing?

The verified way is using FFMPEG or LIBAV from command line (ffmpeg or avconv) or over library API (or direct API NVIDIA video codec SDK). Please check documentation, examples, blogs … “Plex Media Server” should use FFMPEG with this features.

Yes, same issue with latest Windows ffmpeg from March 11, 2020 (ffmpeg-20200311-36aaee2-win64-static), under Windows 7 x64, GeForce Game Ready Driver 442.59 from March 10, 2020, GIGABYTE GeForce RTX 2080 SUPER WINDFORCE OC 8G, model # GV-N208SWF3OC-8GD.

I see that “b_ref_mode each” is not supported by the GPU, and that “b_ref_mode middle” produces tons of warnings in the output about invalid DTS and PTS.

My command line is:

ffmpeg -v verbose -threads auto -probesize 9000000000 -analyzeduration 9000000000 -hwaccel cuda -hwaccel_output_format cuda -f concat -safe 0 -i ffmpeginputs.txt -filter_complex “concat=n=1:v=1:a=1 [vout] [aout]” -map “[vout]” -map “[aout]” -vcodec hevc_nvenc -bf 4 -temporal_aq 1 -rc-lookahead 20 -g 250 -vsync 0 -b_ref_mode 2 -dpb_size 3 “%FOLDERNAME%.mp4”

Not sure if the “-hwaccel_output_format cuda” is needed, but same DTS/PTS errors whether I have that or not. I haven’t found a combination of -bf and -dpb_size that works. Anyone have any suggestions? I do see that it’s an open bug at #7303 (h264_nvenc (and hevc_nvenc) with b_ref_mode middle creates invalid video while streaming) – FFmpeg

The SDK include nvEncodeAPI.h in v9.2 seems to indicate that B-frame each is only not supported on H264. Now I guess it’ll depend on the card as well, but it’s not quite true to say Turing supports B-Frames if you can’t use it all. It’s like half an implementation. Is that something they can enhance?


  • B-frame used as reference modes
    typedef enum _NV_ENC_BFRAME_REF_MODE
    NV_ENC_BFRAME_REF_MODE_DISABLED = 0x0, /< B frame is not used for reference */
    < Each B-frame will be used for reference. currently not supported for H.264 */
    NV_ENC_BFRAME_REF_MODE_MIDDLE = 0x2, /**< Only(Number of B-frame)/2 th B-frame will be used for reference */

Invalid DTS issue with b_ref_mode middle was fixed in Git - ffmpeg.git/commitdiff

Everybody please go here and spam )))) You will say thank you to ffmpeg devs (me and others) by that.

So using latest Zeranoe Windows ffmpeg build I see the following:

b_ref_mode each not supported for HEVC

I see that “b_ref_mode each” is not supported by the GPU

#8809 (hevc_nvenc / b_ref_mode each is not working) – FFmpeg

Can a Nvidia dev clarify whether HEVC is undeed supported “each” (it looks like it with ragaya nice code NVEnc/rtx2070.txt at master · rigaya/NVEnc · GitHub and my 2080 Ti). Also we need to know whether ffmpeg even has all done for “each”. Well, at least middle is fixed.

#8809 is IMHO fixed in #8809 (hevc_nvenc / b_ref_mode each is not working) – FFmpeg

P.S. tested it, it is fixed.

b_ref_mode each is now supported for H264: FFmpeg/nv-codec-headers@7947f29#diff-7e89fa6759c697c70618e5debd0af1d85b415ec339f16850993dc23c39ae68c3L671

1 Like