[FFmpeg-user] Decrease CPU usage?

Anatoly anatoly at kazanfieldhockey.ru
Wed Nov 4 02:05:58 EET 2020


On Sun, 1 Nov 2020 21:11:53 -0300
Diego Patricio Durante <diego at inipop.com> wrote:

> Hello community! I have RTSP streams from cameras, and I'm interested
> to save it to a disk and share as MP4. The main problems are the trade
> off between disk usage and CPU usage without converting the format nor
> scaling the image sizes.
more exact words is "without changing", not "converting" ?
> 
> I'm using Ubuntu 18.04 and saving chunk videos directly from RTSP
> (h264), resizing the stream without using much more CPU. I'm using
> ffmpeg and its dependencies installed directly from repositories.
> 
> Actual test:
> * I'm using it on Azure, with an Intel Xeon server (for testing
> purposes I have instanced two cores: https://pastebin.com/VauHZtLx),
> but the idea is to select a good trade off between performance and
> cost to get about 70 streams. I have seen that libx264 outputs a
> generic flags usage trough ffmpeg:
> * * using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2
> AVX2 But I have the same outputs and CPU times on my I7 4th
> generation CPU. Using the time command, to get
> * The input is (full ffprobe on https://pastebin.com/0dT9ttLG):
>     Stream #0:0: Video: mpeg4 (Simple Profile), yuv420p, 640x480 [SAR
> 1:1 DAR 4:3], 30 tbr, 30k tbn, 1k tbc
>     Stream #0:1: Audio: amr_nb, 8000 Hz, mono, flt
> * With this CPU I have tested to convert 7~10 streams from 30 to 5 fps
> and it goes around 100 % without transcoding the input (only
> downsizing the bitrate and the FPS).
> 
> I'm testing with the command:
> time ffmpeg -re -rtsp_transport tcp -i
> 'rtsp://something:something@fdsfsdfdf' -t 10 -c:v libx264 -b:v 100k
> -maxrate 100k -bufsize 50k -r 5 output2.mp4
> Time output (full output on https://pastebin.com/VTabvgQS):
> real    0m19.527s
> user    0m2.510s
> sys    0m0.102s
> 
> 
> Problems to solve:
> * Can I improve the performance of ffmpeg by compiling it?
Need to improving performance of encoder library (libx264 in this
case), not ffmpeg itself.
> * They are some guidelines to improve performance?
This may be outdated, because I've tested it several years ago, but
openh264 library (-c:v libopenh264) is about 4x faster than libx264
(with no extra parameters given).
Do you have particular reason to stick with h264 compression?
msmpeg4 (aka divx ?) is about 7x faster.
> Thanks for all!
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-user
> 
> To unsubscribe, visit link above, or email
> ffmpeg-user-request at ffmpeg.org with subject "unsubscribe".
> 



More information about the ffmpeg-user mailing list