[FFmpeg-user] Decrease CPU usage?
Diego Patricio Durante
diego at inipop.com
Mon Nov 2 02:11:53 EET 2020
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.
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?
* They are some guidelines to improve performance?
Thanks for all!
More information about the ffmpeg-user
mailing list