Opened 11 months ago

Last modified 5 months ago

#6475 reopened defect

NVENC: -coder 0 parameter produces no error, but does not disable CABAC

Reported by: alexpigment Owned by:
Priority: normal Component: avcodec
Version: git-master Keywords: nvenc
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug:

When using h264_nvenc, if -coder 0 is specified in command line, no errors or warnings are given, yet the resulting video still uses CABAC. If this is not the valid parameter to use, it should give a warning. Otherwise, it should be hooked up to the appropriate parameter from the API.

How to reproduce:

% ffmpeg -f lavfi -i smptebars -c:v h264_nvenc -s 1920x1080 -aspect 16:9 -r 29.97 -t 30 -coder 0 output.mp4

View result in MediaInfo? to confirm that CABAC is used.

ffmpeg version N-86330-gbd1179e
built on 2017-06-01

Change History (9)

comment:1 follow-up: Changed 5 months ago by cehoyos

  • Keywords cabac coder intra removed
  • Resolution set to invalid
  • Status changed from new to closed

No warning can be shown for unused output options.

comment:2 in reply to: ↑ 1 Changed 5 months ago by jkqxz

Replying to cehoyos:

No warning can be shown for unused output options.

The option isn't unused, but the behaviour is exactly as expected.

"-coder 0" indicates that the encoder should choose the mode automatically:
<http://git.videolan.org/?p=ffmpeg.git;a=blob;f=libavcodec/nvenc_h264.c;h=c3b4bac7494dc24faf250423f2539830358b4c63;hb=HEAD#l122>
<http://git.videolan.org/?p=ffmpeg.git;a=blob;f=compat/nvenc/nvEncodeAPI.h;h=e662880f4d94e880004f536dfbaa485bce9daf9a;hb=HEAD#l592>

The encoder then chooses to use CABAC, since it is more efficient and you haven't indicated any other constraint (e.g. profile) which would force it to use CAVLC instead.

(It is generally recommended that you use named options rather than integer values where they are available. See ffmpeg -h encoder=nvenc_h264.)

comment:3 Changed 5 months ago by cehoyos

  • Component changed from undetermined to avcodec
  • Resolution invalid deleted
  • Status changed from closed to reopened
  • Version changed from unspecified to git-master

Yes, this is indeed a bug.
How on earth can such things happen?

comment:4 follow-up: Changed 5 months ago by oromit

I don't see how this is a bug.
The option is called "coder", coder 0 has no specific meaning. You are supposed to select one by name.

comment:5 in reply to: ↑ 4 Changed 5 months ago by cehoyos

Replying to oromit:

I don't see how this is a bug.
The option is called "coder", coder 0 has no specific meaning.

I don't know how you come to this conclusion (and it contradicts the first comment): 0 is defined as auto for nvenc and as cavlc for everything (?) else, at least for x264, where the option-name originated. Please use the unstable-api period to fix this.

comment:6 Changed 5 months ago by oromit

The value 0 comes directly from the nvidia header.
It's not part of the documented ffmpeg API or ABI. Only the names are.

The only direct value ffmpeg makes up here is -1, which translates to "do not set this setting at all and leave it on whatever is in there by default".
This option is similar do what x264 has, but not the same. I picked the const names for it to be compatible in most cases of normal usage.

comment:7 Changed 5 months ago by cehoyos

Simply translate the values or rename the option.

comment:8 follow-up: Changed 5 months ago by oromit

Sorry, but nvenc is not x264, and the option works slightly differently, but similar enough to name it the same, as it does the same thing.
If you use the names, like you should, the options are already compatible. Even on the x264 side of things the numerical values are not documented, only the values "ac" and "vlc" are, which are supported by nvenc to achieve the same thing.

comment:9 in reply to: ↑ 8 Changed 5 months ago by cehoyos

Replying to oromit:

Sorry, but nvenc is not x264, and the option works slightly differently, but similar enough to name it the same, as it does the same thing.

And this is exactly the issue here.

Note: See TracTickets for help on using tickets.