Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nvenc automatically sets some weird max bitrate #206

Closed
AceCLee opened this issue Feb 26, 2020 · 7 comments
Closed

Nvenc automatically sets some weird max bitrate #206

AceCLee opened this issue Feb 26, 2020 · 7 comments

Comments

@AceCLee
Copy link

AceCLee commented Feb 26, 2020

Hello!

input video: 1080p yuv420p10 24000/1001
cmd param: --codec hevc --ref 16 --level auto --vbr/--vbrhq
nvenc cmd output: (Max: 11520 kbps)
output video level: 5

cmd param: --codec hevc --ref 16 --level 5--vbr/--vbrhq
nvenc cmd output: (Max: 24000kbps)

When I read the specification of hevc in High Efficiency Video Coding tiers and levels - Wikipedia,
max bit rate for Main and Main 10 seems like to be 12,000kbps in level 4 main tier, max bit rate for High Throughput 4:4:4 16 Intra seems like to be 1,152,000kbps in level 4 main tier.

Nvenc only support 8bit and 10bit, maybe we should use max bit rate of Main
and Main 10 profiles in High Efficiency Video Coding tiers and levels - Wikipedia.

For level 5, max bit rate should be 25,000 kbps in main tier, and it should be 100,000 kbps in high tier.

@rigaya
Copy link
Owner

rigaya commented Feb 26, 2020

The auto max bitrate sets 96% of the value of the spec of main profile.

12000 x 0.96 = 11520
25000 x 0.96 = 24000

This is because there was a case that the NVENC SDK returned error ("8 (NVENC indicates that one or more of the parameter passed to the API call is invalid.)") when you specified the exact value of the spec. I don't know why but setting to 96% works fine.

main10 / main444 profile is not considered here.

@AceCLee
Copy link
Author

AceCLee commented Feb 26, 2020

Thanks for reply!

input video: 1080p yuv420p10 24000/1001
cmd param: --codec hevc --ref 16 --level auto --vbr/--vbrhq
nvenc cmd output: (Max: 11520 kbps)
output video level: 5

In this case, correct level should be 5 because ref is 16, but nvenc specified 11520kbps as max bitrate, it should be 24000kbps as I exactly specified --level 5 in cmd param.

@AceCLee
Copy link
Author

AceCLee commented Feb 26, 2020

And I can specify an exact value for max bitrate in nvencc 4.65:
--codec hevc --vbrhq xxx --max-bitrate 25000 --level 5 --profile auto --tier main --ref 16

@rigaya
Copy link
Owner

rigaya commented Feb 26, 2020

In this case, correct level should be 5 because ref is 16, but nvenc specified 11520kbps as max bitrate, it should be 24000kbps as I exactly specified --level 5 in cmd param.

It is not checking ref frames.

And I can specify an exact value for max bitrate in nvencc 4.65:
--codec hevc --vbrhq xxx --max-bitrate 25000 --level 5 --profile auto --tier main --ref 16

There was some cases (not always) that caused error in the past. If you really care the few percent, then please specify the exact value.

@AceCLee
Copy link
Author

AceCLee commented Feb 27, 2020

OK. Maybe nvencc should take --ref into consideration when specify --level auto.

@rigaya
Copy link
Owner

rigaya commented Feb 29, 2020

The updated NVEnc 4.66 will have --ref value considered when calculating max bitrate automatically.

@AceCLee
Copy link
Author

AceCLee commented Feb 29, 2020

Thanks for your efforts! It works!

@AceCLee AceCLee closed this as completed Feb 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants