Reducing video bitrate

Greetings,

I would like to reduce the bit rate of the video for transmitting over a lower bandwidth network, I believe this can be done in Camera Setup by reducing the frame rate or frame size. But for some reason whenever I drop the frame rate from 30 to 15 the bitrate seems to double, I monitored this in wireshark with 5 second captures. took some screen grabs. This was done on my laptop connected directly to the sub

3724kbytes in 5 seconds at 1280x720 at 30fps

7603kbytes in 5 seconds at 1280x720 at 15fps

Also when I drop the Frame Size down to 320x240 the I definitely loose slight picture quality in playback but the actual bitrate seems to increase slightly

3916kbytes in 5 seconds at 320x240 at 30fps

Am I missing something obvious? Reducing quality here isn’t reducing the bit rate.

John

Hi @john6,

The H264 encoding is done on the camera module, so the bitrate is determined by the camera, and unaffected by the streaming pipeline.

I’ve summarised your Wireshark results below, along with my own set of similar results.

Your results:

Frame Size FPS Measured Bitrate Avg. Packet Size
1280 x 720 30 5.7 Mbps 10.68 kbits
1280 x 720 15 11.5 Mbps 11.11 kbits
320 x 240 30 6.0 Mbps 10.77 kbits

My results:

Frame Size FPS Measured Bitrate Avg. Packet Size
1920x1080 30 11 Mbps 10.68 kbits
1920x1080 15 11 Mbps 11.08 kbits
1280x720 30 11 Mbps 10.71 kbits
1280x720 15 11 Mbps 11.09 kbits
800x600 30 11 Mbps 10.79 kbits
640x360 15 9.9 Mbps 11.04 kbits
320x240 30 7.0 Mbps 10.25 kbits
320x240 15 3.5 Mbps 10.22 kbits

It looks like the average packet size is quite consistent, regardless of camera settings, which I expect is set by gstreamer when it converts the H264-encoded stream into RTP/UDP packets.

There’s more to quality than just framerate and frame size (which is discussed somewhat in the “camera” section in this post). It seems like the bitrate is set to a constant ~11 Mbps, but when the video frames are small and/or infrequent enough then there’s presumably no more quality that can be gained by sending extra bits, so it reduces the bitrate.

Unfortunately

and the implemented v4l2 controls don’t include bitrate specification, so finer-grained control of the bitrate isn’t possible.

On a separate note, I suspect the “doubling” you saw may in fact be an error of the settings in your first screenshot not being the ones that were actually applied for the Wireshark window in that screenshot - you could check that quite easily by setting 1280x720@30fps and re-testing with Wireshark :slight_smile:

Hi Eliot…

Great reply, thanks for taking the time. I may need to look at alternative cameras to achieve the lower bitrates I’m looking for.

Although, the bit rates I posted are pretty consistent and differ from your results when the frame rates are either 30 or 15fps. (possible firmware glitch in the camera I have installed?) I will try an put together a quick video to show this using my VPN bandwidth monitor which is consistent with my wire shark findings.