Skip to content

Conversation

@Quackdoc
Copy link
Contributor

@Quackdoc Quackdoc commented Oct 28, 2022

this sets the framerate toggle to a proper CFR, and implements buffrate for encoder hinting

buffrate is used to preserve VFR on encoders that require a framerate cap or target framerate (IE encoders without proper VFR support). it can also be used as a soft fps cap, but unless set at an integer value of the display, it may provide poor results.

@Quackdoc Quackdoc marked this pull request as draft October 28, 2022 23:59
this sets the framerate toggle to a propeer CFR, and implements buffrate for encoder hinting

buffrate is used to preserve VFR on encoders that require a framerate cap or target framerate (IE encoders without proper VFR support). it can also be used as a soft fps cap, but unless set at an integer value of the display, it may provide poor results
@Quackdoc Quackdoc changed the title set buffer framerate FrameRate Changes, Implement CFR and estimated buffer framerate Oct 29, 2022
@Quackdoc Quackdoc marked this pull request as ready for review October 29, 2022 04:26
@ammen99
Copy link
Owner

ammen99 commented Nov 23, 2022

Hi, thank you for working on this, but I think the docs need to be clarified. Even I am not sure what buffrate is, and what framerate is (basically, what is the difference between -B and -r)? When would I use the one, when the other?

@Quackdoc
Copy link
Contributor Author

Ill amend this to be clear when I get the chance, but buffrate sets the buffer input device's framerate, where as framerate uses the fps frame filter to set framerate,

the reason for the distinction is that when we set the buffer device framerate, you use the video buffer video filter, which in ffmpeg more or less acts as a video source device. so what we are doing is telling ffmpeg the framerate to expect as the input stream. this is not a hard framerate, but rather a maximum framerate to expect, this lets it work as a framerate cap so to speak. this means that ffmpeg should never encode more FPS then the buffrate, it also however does still allow sending lower FPS then the buffer is set to, hence preserving VFR while setting a cap on the framerate.

this is necessary since there are numerous encoders and I think even a muxer or two that need this information to work properly. (in my testing I primarily used SVT-AV1).

Framerate on the other hand uses the ffmpeg fps filter to set a constant framerate, this works in most cases by duplicating frames until the fps target is hit, this is necessary for a lot of users as VFR is relatively unsupported in a lot of applications. (some video editors, and even some video sharing applications do not work with VFR videos)

I originally thought to leave Framerate to mean the buffer rate, but I think most users would expect framerate to be equal to CFR as this is what most other software does (from video editors, to handbrake). although this could be done by the user manually specifing the fps filter, I believe it would be best if this had its own toggle for the user's experience.

I also thought about renaming buffrate to max FPS to hint towards the implicated use of using it to preserve VFR. however I am not sure that all encoders will play nice with that.

Copy link
Owner

@ammen99 ammen99 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks for the clarification!

@Quackdoc
Copy link
Contributor Author

Quackdoc commented Jan 2, 2023

Sorry for the super late update, I won't lie I completely forgot about this. I changed the docs to be more clear, also instead of suggesting that buffrate might work as a softcap for fps. that seems rather inconsistent so I left it out

@ammen99 ammen99 merged commit d982add into ammen99:master Jan 2, 2023
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

Successfully merging this pull request may close these issues.

2 participants