Setting level idc increases level signaled in bitstream

Issue #599 new
Krabonama created an issue

When I do a simple single pass encode

x265.exe --input-res 352x288 --fps 24 foreman_cif.yuv --bitrate 100 --level-idc 5.0 -o out.hevc

I get a bitstream that is signaling level 5.0:

x265 [info]: Main profile, Level-5 (Main tier)

However, in the documentation it sounds like the level-idc should just be a limit that asserts that the parameters of the encode fit within the level. For example if I specify a too high bitrate, the encoder would lower it so that it fits into the given level. And if lowering the encoder settings is not possible, the encoding will abort.

From (https://x265.readthedocs.io/en/master/cli.html#profile-level-tier) and the same text is also in cli.rst:

If the requested requirement level is higher than the actual level, the actual requirement level is signaled.

From cli.rst:

Finally, the encoder
re-examines the final set of parameters and detects the actual
minimum decoder requirement level and this is what is signaled in
the bitstream headers.

In the code, the level is always increasd to at least the given level-idc in level.cpp:157:

else if (param.levelIdc && param.levelIdc != levels[i].levelIdc)
  continue;

I tested this in the latest master commit which is 419182243fb2e2dfbe91dfc45a51778cf704f849

Comments (0)

  1. Log in to comment