Opened 17 months ago

Closed 17 months ago

Last modified 16 months ago

#8809 closed defect (fixed)

hevc_nvenc / b_ref_mode each is not working

Reported by: enctac Owned by:
Priority: important Component: avcodec
Version: git-master Keywords: nvenc hevc_nvenc b_ref_mode
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

When using "-c:v hevc_nvenc", "-b_ref_mode each" option is not working by saying out:
Each B frame as reference is not supported

How to reproduce:

% ffmpeg.exe -y -i input.mp4 -c:v hevc_nvenc -bf 3 -b_ref_mode each -an output.mp4

Memo:

"-b_ref_mode each" needs Turing GPU and "-c:v hevc_nvenc".
h264_nvenc doesn't support "-b_ref_mode each". (#7301)

Examples:

Case1(English):ffmpeg-20200311-36aaee2-win64-static, GPU:RTX 2080 SUPER (Driver:442.59)

Case2(Japanese):ffmpeg 4.3(Zeranoe), GPU: 1660 SUPER (Driver:446.14)

Comment:

Source Code:

https://github.com/FFmpeg/FFmpeg/blob/master/libavcodec/nvenc.c#L425

NV_ENC_CAPS_SUPPORT_BFRAME_REF_MODE:

https://github.com/FFmpeg/nv-codec-headers/blob/master/include/ffnvcodec/nvEncodeAPI.h#L1089

When GPU supports "each" and "middle", NV_ENC_CAPS_SUPPORT_BFRAME_REF_MODE maybe returns "3" (0x01 | 0x02).

ref. RTX2070 features ("Codec: H.265/HEVC -> B Ref Mode" is "3")

But code is:

ret = nvenc_check_cap(avctx, NV_ENC_CAPS_SUPPORT_BFRAME_REF_MODE);
if (ctx->b_ref_mode == NV_ENC_BFRAME_REF_MODE_EACH && ret != 1) {

av_log(avctx, AV_LOG_WARNING, "Each B frame as reference is not supported\n");
return AVERROR(ENOSYS);

} else if ...

I don't have Turing GPU.
Please check and fix this problem.

Change History (3)

comment:1 by Balling, 17 months ago

That is true. My 2080 Ti says -c:v hevc_nvenc -bf 3 -b_ref_mode each is not supported... Hmmm.

comment:2 by Balling, 17 months ago

Status: newopen

First, we need to check that avctx HEVC is indeed 3 and avctx AVC returns 2. Also we need to change comment \n 2 : only Middle B-frame as reference is supported to "Middle B-frame as reference is supported to " in ​https://github.com/FFmpeg/nv-codec-headers/blob/master/include/ffnvcodec/nvEncodeAPI.h#L1089

Last edited 17 months ago by Balling (previous) (diff)

comment:3 by Balling, 17 months ago

Resolution: fixed
Status: openclosed

Should be fixed in 466c14d10728cd315c60e602ffe3797e7dd0c3d3
P.S. I tested it, it works.

Last edited 16 months ago by Balling (previous) (diff)
Note: See TracTickets for help on using tickets.