-
Notifications
You must be signed in to change notification settings - Fork 550
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
Add frame rate support to mjpeg for ffmpeg compatibility #1509
Comments
Where you get info about 25 frames? I don't think HTTP has to output any particular number of frames. It's just a transport. It can use any format inside. go2rtc can't change frame rate. It doesn't make sense. And it's not going to be accurate enough. This needs to be played with a real time clock. Sending the same shot multiple times. Which is insane for MJPEG format. |
Yes, I agree. By default, FFmpeg expects an MJPEG source to run at 25 fps unless specified otherwise. I've successfully started recording HTTP images in Frigate by pointing The MJPEG server decouples the fetch loop from the streaming loop by:
As you correctly pointed out:
This approach keeps FFmpeg satisfied and ensures that Frigate recordings are stable and reliable. I'll create a repository shortly. |
I don't have an official reference, but you can find the ffmpeg frame rate defaults to 25 fps here: I found another solution to fix the ffmpeg frame rate output in frigate,
some HTTP input sources should be rate limited, however the config above appears to fix the frame timing issue recording the built-in mjpeg stream api from frigate. Still, a configurable http polling interval would be preferrable |
Conversion from mjpeg to another format (h264) via ffmpeg generates invalid output.
By default, ffmpeg consumes http sources at 25 fps, unless otherwise specified. It is possible to change the ffmpeg frame rate input parameter inside go2rtc.
For instance, ffmpeg shall consume an http source at 15 fps using -r 15 input parameter:
however, the ffmpeg input source must also emit frames at the same rate, or there will be a problem in the output: #246 (comment)
The frame mismatch issue can be correcting by emitting an precise fps from the mjpeg api to match the ffmpeg input.
Ideally, the mjpeg api would have a configurable fps via url parameter, however, if the mjpeg component is updated to emit exactly 25 fps, no configuration is required to consume the mjpeg stream from ffmpeg
The text was updated successfully, but these errors were encountered: