[FFmpeg-user] Trying to understand ffmpeg cpu usage in this case of capturing rtsp streams

Ferdi Scholten ferdi at sttc-nlp.nl
Fri Nov 8 01:37:46 EET 2024


I'm using Ubuntu 22.04 and ffmpeg version 4.4.2-0
> I'm capturing 3 rtsp streams as shown at the bottom .
> Stream A resolution is 1600x1200
> Stream B and Stream C resolution is 384x192 .
> Stream A and B are coming from one device (ip address) and Stream C is
> coming from a second device (ip address)
>
> When I start Stream A and capture it with the command below I get a cpu
> usage of around 90% using the top command. If I then start stream B
> simultaneously it shows about 25% cpu usage in another ffmpeg instance.
>
> Then with the other 2 streams running I start Stream C and it shows about
> 90% cpu usage.
>
> If I start Stream B on it's own it shows 90% cpu usage.
>
> In other words it doesn't seem to matter what the resolution of the video
> coming in is but rather which stream starts first that determines the cpu
> usage. Does it matter that Stream A an B are coming from the same ip
> address and that explains why the second stream uses less cpu? My
> expectation is that Stream B and C would have the same cpu usage since they
> are the same resolution just coming from different devices.  Can anyone
> explain what I see as strange behaviour. Stream commands follow.
>
>
> Stream A: ffmpeg -f rtsp -irtsp://192.168.35.243:8086/?camera=world  -f
> v4l2 /dev/video2
>
> Stream B: ffmpeg -f rtsp -irtsp://192.168.35.243:8086/?camera=eyes  -vf
> format=yuv420p  -f v4l2 /dev/video3
>
> Stream C: ffmpeg -f rtsp -irtsp://192.168.35.247:8086/?camera=eyes  -vf
> format=yuv420p  -f v4l2 /dev/video5
>
> Thanks,
> Jim
> _______________________________________________
>
Does this also happen if you use a less antique version of ffmpeg? 
Either a static build or build it from git master or use a ppa? were at 
version 7.1 now.
Current versions are much better in using multiple threads and there 
have been numerous changes to internal code to improve the resource usage.

for ease of use this ppa delivers ffmpeg 7.1 for ubuntu 22.04
https://ubuntuhandbook.org/index.php/2024/04/ffmpeg-7-0-ppa-ubuntu/


More information about the ffmpeg-user mailing list