milbarge
Posts: 1
Joined: Mon Jul 15, 2019 10:34 pm

Setting bitrate on the h264_omx in ffmpeg

Mon Jul 15, 2019 10:43 pm

I just got my new RasPi 4 and it is pretty impressive. I'm working on a project where I'm using it to encode and stream video. For the most part everything works. My only issue is that the -b:v flag in ffmpeg has no effect when using the h264_omx encoder. The line that I'm using to stream is.

Code: Select all

ffmpeg -f v4l2 -video_size 1280x720 -framerate 30 -i /dev/video0 -c:v h264_omx -b:v 8M -f rtp rtp://10.10.10.13:5000
However, regardless of what I set the bitrate to it always streams at somewhere around 38000kbits/s. Unfortunately at this rate there are many compression artifacts and the video generally looks mediocre. Is there something I'm missing, or is there any way to fix the issue?

Any help would be appreciated. Thanks.

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 7026
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: Setting bitrate on the h264_omx in ffmpeg

Tue Jul 16, 2019 9:34 am

38000kbits/s would be 38Mbit/s. The maximum is normally 25Mbit/s, so I'm assuming you mean 38kbit/s.

I haven't tested this, but ffmpeg is often fussy on parameter order and generally they have to be specified before the item they have to be set on.
I'd try shifting the -b:v to before the h264_omx

Code: Select all

ffmpeg -f v4l2 -video_size 1280x720 -framerate 30 -i /dev/video0 -b:v 8M -c:v h264_omx -f rtp rtp://10.10.10.13:5000
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

Return to “Graphics, sound and multimedia”