-
Notifications
You must be signed in to change notification settings - Fork 148
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
Variable Bitrate (Peak Constrained) ignores given constraints. #39
Comments
When setting Target Bitrate to 0 and only using Peak Bitrate, the achieved bitrate drops to 3200kbit/s. Still unsure how to control the actual bitrate, it seems to ignore me completely. Edit: Higher motion scenes get closer to the Peak Bitrate. Did I just find a solution? |
There was no changes in the driver in this area. |
So the name of the rate control method AMF_VIDEO_ENCODER_RATE_CONTROL_METHOD_PEAK_CONSTRAINED_VBR is wrong here? Edit: I'd also like to state that it worked in older drivers and started breaking with AMF SDK being rolled out. |
Another thing that I forgot in the last response, I did not set Target Bitrate to 20mbit/s. I set Target Bitrate to 0, since it is called PEAK_CONSTRAINED_VBR and should be using Peak Bitrate instead. |
Not sure but it was not intended to work. |
I will do some additional tests and report back |
Further testing with "correct" Bitrates (3500000 for Target, 9000000 for Peak) revealed that it doesn't work at all - which reflects what users have been reporting with Plays.TV for a while too. Average bitrate is again close to 20mbit/s instead of the given 9mbit/s. 2016-11-03 |
I looked briefly into the plug-in code. Please confirm if I am right or not: the plug-in sets bitrate parameters before calling encoder->Init(), correct? |
That is a very strange way of handling that. Would I have to instantly ReInit the encoder to apply them? Some of the properties can only be applied before calling Init() too, otherwise they return AMF_ALREADY_INITIALIZED. I will update the code to match your change now and see if that helps. |
You should not use Reinit() for dynamic properties. You can set them at any time and they will be applied before next frame is submitted. The header file clearly separated dynamic and static properties. Statics should be set before Init() or after with Reinit() call, dynamic should be set after Init(). Check AMF samples they all written this way. |
If this actually works, that would be great. Early tests (on driver 16.9.2 and 16.10.1) however did not automatically apply dynamic properties and instead applied them only when ReInit was called. If 16.10.2/.3 fixed this, that would be a neat fix. (That was the reason for even implementing the ReInit behaviour.)
Then I have a question: What actually are the dynamic parameters? The documentation only lists "Profile", "ProfileLevel" and "MaxOfLTRFrames" as Static Parameters, but "BPicturesDeltaQP" and "ReferenceBPicturesDeltaQP" are also static parameters that need to be set before Init() and can't ever be changed afterwards (not even with ReInit(), it will just not change them). I have also applied the suggested changes now, but have had no different results to before. Total average bitrate is still a lot higher than the given target bitrate.
Is there a better way to tell where things fail? The debug output from AMF is rather sparse and doesn't really tell me why things aren't working the way they should. |
check the VideoEncoderVCE.h: all properties below this comment are dynamic. |
From the log: you should not call Reinit() after updating rate control and other dynamic parameters. |
Regardless of reinit: log seem right. Where is the file? |
My bad, i uploaded the log twice. I have removed any trace of ReInit from my code, however there is still a ReInit call in the log file that is not mine. Here are the up to date files: |
I have noticed another thing, CABACEnable is now always 1. I can assume that 16.10.3 fixed any issues with it? |
Internal reInit() will be triggered if you set a static property after Init() call. See in the log that QualityPreset property is set after Init().
Not rate control related:
Please share the results. |
Okay, I modified some of the code to not override static settings in update(), hopefully should have removed the ReInit() call now. Average bitrate is now at about 12mb/s, about what Peak Bitrate + Target Bitrate would be.
Changes applied:
Edit: The same issue affects #18 and is currently being debugged there. |
Same solution as in #18: #18 (comment) |
Seems to be a regression from an earlier driver (accidentally changed the wrong code?), VBR seems to completely ignore any constraints. Min/Max QP, VBV Buffer Size, Target/Peak Bitrate all have no effect on what it is going to use for the actual bitrate and usually it hovers at around a fixed 20mbit/s.
Edit: Bitrate drops below 20mbit/s when Target Bitrate is set to exactly 0. Still does not follow any other constraints.
Constraints being ignored completely:
System Information
Report Data
2016-11-03 (Wrong Target Bitrate)
2016-11-03 (Corrected Target Bitrate)
2016-11-03 (Applied fixes by Mikhail)
The text was updated successfully, but these errors were encountered: