rigaya / NVEnc

NVENCによる高速エンコードの性能実験
https://rigaya34589.blog.fc2.com/blog-category-17.html
Other
1.1k stars 114 forks source link

Inconsistent Behavior with Codec Levels and Frame Rates of 59.94/60 fps #617

Closed Aesthermortis closed 3 months ago

Aesthermortis commented 3 months ago

I've encountered an issue when encoding videos using the --vpp-fruc filter and setting the frame rate to 59.94 or 60 fps. The problem arises when setting certain codec levels:

Codec Levels 4, 4.1, and 5: The encoder fails to initialize, producing the following error:

nvenc : Failed to Initialize the encoder
nvenc : .: 8 (NVENC indicates that one or more of the parameter passed to the API call is invalid.)
Codec Levels 4.2 and 4.3: The encoding process works, but the codec level is automatically changed to 5.1.

Codec Level 5.2: The encoding process works, and the codec level is maintained as specified.

It seems that any codec level above 5.1 works fine, but I don't understand why levels 4.2 and 4.3 are automatically changed to 5.1, nor why levels 4, 4.1, and 5 result in a failure.

rigaya commented 3 months ago

For H.264 1080p60 is not supported with level 4/4.1, and level 4.2 needs --refs to be 4 or below.

I was able to get H.264 Level 4.2 for 1080p60 without problem by below when input file is 1080p30, but it might depend on ref, bitrate, max-bitrate, vbv-bufsize.

NVEncC64.exe -i sample_movie_1080p.mpg -o test.mp4 --vpp-fruc --level 4.2

I think to just let encoder decide it's codec level will be fine.

Aesthermortis commented 3 months ago

The input file is a HEVC 23.976 FPS, and I am using --refs 4. However, the --vpp-fruc double option does not work, even when the target FPS is above 25, if the profile level is set to 5.

rigaya commented 3 months ago

Please let me know about the output resolution and output codec.

If you are trying for HEVC 3840x2160, Level 5 supports up to 30fps, and above that Level 5.1 is required. https://en.wikipedia.org/wiki/High_Efficiency_Video_Coding_tiers_and_levels

Aesthermortis commented 3 months ago

Now I understand. I didn't know about that. So I'll have to use level 5.1 for fps higher than 30. Thanks for clarifying that. As you say, the output is HEVC 3840x2160