-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Reduce framerate before downscaling #7022
Reduce framerate before downscaling #7022
Conversation
It is cheaper to drop frames and downscale those that remain than it is to downscale all frames and then drop some of them. This is achieved with the filter chain `-cv fps=FPS,scale=W:H`, and perhaps was the original intention. The plain `-r` and `-s` flags do not execute in order though - they each put themselves at the *end* of the filterchain, so `-r FPS -s WxH` actually applies the scale filter first, and then the rate filter. This fix can halve the CPU used by the detect ffmpeg process.
✅ Deploy Preview for frigate-docs canceled.
|
We had problems with this approach in the betas, using |
The relevant PR is #5210 |
@NickM-27 Do you remember the specifics? You'd set it to 5 fps and sometimes get 5.1? Can I replicate? If it's not worth the effort...I brought back the |
No, it was multiple frames off on my cameras. Usually would be 6 or 7 even though it was set to 5 |
I have never been able to get ffmpeg to be consistent with fps dropping and smooth video across different cameras unless I re-encode the video after scaling and dropping using nvidia gpus. I’ve never tried cpu but nvidias cards drop frames or generate corrupt ones which they claim the -vsync 0 is needed to prevent. I thought there had to be a better way but I just gave up doing it in Frigate and do a full duplicate and transcode outside of frigate using another application. |
@NickM-27 ICYMI, I brought back the |
Makes sense, how much performance improvement are you seeing in this case? |
With HW decoding but SW scaling, this reduces ffmpeg CPU load from 58% to 33% (on my Xavier with a single camera stream) |
It is cheaper to drop frames and downscale those that remain than it is to downscale all frames and then drop some of them. This is achieved with the filter chain
-cv fps=FPS,scale=W:H
, and perhaps was the original intention here. The plain-r
and-s
flags do not execute in order though - they each put themselves at the end of the filterchain, so-r FPS -s WxH
actually applies the scale filter first, and then the rate filter.This fix can halve the CPU used by the detect ffmpeg process.