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
"RealTime" VT property + "limit bitrate" setting cause heavy framedrops on ARM macs with HW VideoToolbox encoder #5840
Comments
A review of Apple's documentation for kVTCompressionPropertyKey_RealTime shows:
OBS is not doing "offline compression", so frames must be encoded within the frame rate requirements. I wonder if disabling this just starts filling a buffer of backlogged frames or something and then writes them eventually. That, or Apple's documentation is incomplete or incorrect. Tagging in @gxalpha and @PatTheMav as they are far more qualified to answer this and ask exploratory questions than I am. |
Since @AuroraWright tagged me regarding this in the linked issue - I made the realtime flag configurable in my local sources and tested the exact same stream with each setting. Subjectively disabling realtime compression made things feel "smoother" to a minimal degree. I did not see a difference in frame drops (both none in my case, native build on M1 8 core). For a 6000kbit (bitrate and limit) stream 1080p@60 of 2min length the only noticeable difference is in a minimal increase in max and min bitrate:
|
This was my recommendation; my understanding is that the apple docs are either incorrect or incomplete. We had to explicitly set realtime=0 by default in ffmpeg; we speculate this to be a power-saving measure, but it's not really clear. As far as we're aware, this doesn't result in any perf issues on Intel machines either. See FFmpeg/FFmpeg@4778ab2 |
We've reached out to our Apple contacts for clarification. |
Operating System Info
macOS 12.0
Other OS
No response
OBS Studio Version
Git
OBS Studio Version (Other)
No response
OBS Studio Log URL
https://obsproject.com/logs/mCaYXIhd7YJsEBtj
OBS Studio Crash Log URL
No response
Expected Behavior
Frames should not be dropped when using the hardware VideoToolbox encoder and "limit bitrate" turned on in preferences.
Current Behavior
Heavy frame drops occur no matter the target bitrate limit when the "limit bitrate" checkbox is toggled. After some tests I found out this is caused by the kVTCompressionPropertyKey_RealTime property, which is currently always set by OBS here:
obs-studio/plugins/mac-vth264/encoder.c
Line 325 in 2c5b1a8
Steps to Reproduce
...
Anything else we should know?
No response
The text was updated successfully, but these errors were encountered: