Opened 19 months ago

Last modified 19 months ago

#10124 new defect

NVENC h.264 reference frames >4 causes error

Reported by: CaptainObvious Owned by:
Priority: normal Component: undetermined
Version: 5.1.2 Keywords: NVENC, reference frames, refs
Cc: CaptainObvious Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no


Trying to use FFmpeg/NVENC to encode 1080p 23.976fps Blu-ray AVC files that don't need re-encoding in Architect Pro (unsuccessfully, so far). Hardware is a 2080 Ti, current drivers 527.56.

In trying to emulate a known working file, one of the things I need to do is produce a video with 5 reference frames. As I understand it, h.264 spec allows up to 16 reference frames, so this shouldn't be an issue.

When "-refs 5" or higher is specified, FFmpeg fails with error: "[h264_nvenc @ hhhhhhhhhhhhhhhh] InitializeEncoder failed: invalid param (8): Invalid Level."

When "-refs 4" or lower is used, no problem. Have tried this on the current release version and the latest nightly from Dec 25, 2022.

I've simplified the following command-line significantly:

ffmpeg -y -i "input.mp4" -c:v h264_nvenc -bluray-compat 1 -b:v 1500000 -bufsize 1500000 -maxrate 3000000 -level 4.1 -profile:v high -refs 5 "output.264"

Change History (2)

comment:1 by CaptainObvious, 19 months ago

Summary: NVENC h.264 reference frames over 4 causes errorNVENC h.264 reference frames >4 causes error

comment:2 by Balling, 19 months ago

Blu-ray supports maximum 4 CABAC ref frames. Offcially that is, some geniuses put 5 refs.

Blu-ray does support slicing though.

"As I understand it, h.264 spec allows up to 16 reference frames, so this shouldn't be an issue."

Not that simple. In Level 4.1 H.264 allows 9 reference frames for 720p and 4 reference frames for 1080p. See table

Note: See TracTickets for help on using tickets.