I have a Raspberry Pi with an OV5647 camera module which I use to stream video from.
raspivid takes a command line parameter named --mode, -md, which offers a couple of modes the camera can be set to use.
Mode Size AR Frame rates FOV Binning
0 automatic
selection
1 1920x1080 16:9 1-30fps Partial None
2 2592x1944 4:3 1-15fps Full None
3 2592x1944 4:3 0.1666-1fps Full None
4 1296x972 4:3 1-42fps Full 2x2
5 1296x730 16:9 1-49fps Full 2x2
6 640x480 4:3 42.1-60fps Full 2x2 plus skip
7 640x480 4:3 60.1-90fps Full 2x2 plus skip
I'd rather have a low framerate and a good image quality instead of high FPS.
For a high quality video I want to stream in Full HD 1920x1080, yet the mode 1 of the camera only gives it a partial FOV which decreases the filmed area a lot, i really need the full FOV.
I would like to choose mode 2, so that I can stream the downscaled video in Full HD at 15 FPS.
Yet I am forced to use mode 4, because it gives me a framerate of 25 FPS.
The issue is the following:
raspivid -o - \
-t 0 \
-n \
-hf -vf \
-g 25 \
-pf high \
-md 4 \
-fps 25 \
-b 10000000 \
| cvlc -vvv \
stream:///dev/stdin \
--no-audio \
--sout '#standard{access=http,mux=ts,dst=:8090}' \
:demux=h264
This command works. It sets the camera to mode 4, uses an fps of 25 and pipes the video into clvc.
When I set mode to 2 and lower the fps to 15, then this doesn't work anymore.
For some reason cvlc appears to be expecting a framerate of 25, logging a lot of warnings along the lines of
[73b02cf8] main mux warning: late buffer for mux input (17958)
[73b02cf8] main mux warning: late buffer for mux input (2025)
[73b02cf8] main mux warning: late buffer for mux input (14107)
[73b02cf8] main mux warning: late buffer for mux input (2890)
[73b02cf8] main mux warning: late buffer for mux input (20115)
There is also an informative message at the beginning claiming that
[73b12410] main decoder debug: using packetizer module "h264"
[73e00568] main input debug: switching to sync mode
[73b088b8] h26x demux debug: using 25.00 fps
So I assume that I'm getting those late buffer warnings because raspivid is sending to few fps and it's not enough data for the encoder. The video freezes around every 10 seconds, really making it unusable. When it is moving, it is sped up.
How can I tell the h264 encoder that it should work at 15 FPS in-out instead of 25 FPS?