[FFmpeg-user] High CPU utilization in FFmpeg 5.0.1 compared to FFmpeg 4.3 for all media conversions

Marton Balint cus at passwd.hu
Tue Jul 12 10:46:41 EEST 2022



On Tue, 12 Jul 2022, Kousthu Gangarapu wrote:

> Hi FFmpeg community,
>
> After installing the latest FFmpeg 5.0.1 from 4.3, I am seeing increased
> Avg CPU Utilization and increased number of threads for the same workload
> compared to FFmpeg v4.3.
>
> *Specifically,*
> 1. Increased Avg CPU utilization upto 15% - compared to version 4.3 for the
> same workload.
> 2. Increase in the number of threads per ffmpeg process by 3x - compared to
> version 4.3 for the same type of media conversion workload
>
> *My query:*
> 1. Is this expected? If yes, any specific reason? If not, any
> configuration/tuning to be done?

I would not say this is expected, but to figure out what is going on 
exactly you should build your own ffmpeg and bisect which commit caused 
the extra CPU usage between 4.3 and 5.0.1. Otherwise this is just 
guesswork. Alternatively you may also try git master and see if that is 
better.

Regards,
Marton


> 2. Is there a way we can tune ffmpeg to reduce the CPU & thread counts back
> to v4.3 levels?
>
> *Hardware:*
> Intel(R) Xeon(R) CPU E5-2680 v3 @ 2.50GHz / 48 CPUs
> Thread(s) per core:  2
> Core(s) per socket:  12
> Socket(s):           2
>
> *Command used:*
> ffmpeg -y -v error -progress tcp://127.0.0.1:44477 -analyzeduration 25M
> -probesize 50M -thread_queue_size 2048 -err_detect aggressive -fflags
> +discardcorrupt -abort_on empty_output_stream -i udp://
> 1.1.1.1:9000?fifo_size=10000000&overrun_nonfatal=1 -filter_complex
> [i:0x25]yadif[vout];[vout]split=4[out0][out1][out2][out3];[out0]setdar=256/144[v0];[out1]setdar=512/288[v1];[out2]setdar=1024/576[v2];[out3]setdar=1280/720[v3];[i:0x27]aresample=async=1:min_hard_comp=0.100000:first_pts=0[aout];[aout]asplit=4[a0][a1][a2][a3]
> -f flv -vcodec libx264 -s 256x144 -r 25/1 -b:v 200000 -acodec libfdk_aac
> -ar 48000 -b:a 32000 -sc_threshold 0 -pix_fmt yuv420p -flags
> +global_header+cgop -profile:v baseline -level 3.0 -preset fast -nal-hrd
> cbr -maxrate 200000 -minrate 200000 -bufsize 400000 -g 50 -map [v0] -map
> [a0] rtmp://lab2.com/rtmp/push/testfeed1 -f flv -vcodec libx264 -s 512x288
> -r 25/1 -b:v 500000 -acodec libfdk_aac -ar 48000 -b:a 64000 -sc_threshold 0
> -pix_fmt yuv420p -flags +global_header+cgop -profile:v baseline -level 3.0
> -preset fast -nal-hrd cbr -maxrate 500000 -minrate 500000 -bufsize 1000000
> -g 50 -map [v1] -map [a1] rtmp://lab2.com/rtmp/push/testfeed2 -f flv
> -vcodec libx264 -s 1024x576 -r 25/1 -b:v 1000000 -acodec libfdk_aac -ar
> 48000 -b:a 64000 -sc_threshold 0 -pix_fmt yuv420p -flags
> +global_header+cgop -profile:v main -level 3.1 -preset fast -nal-hrd cbr
> -maxrate 1000000 -minrate 1000000 -bufsize 2000000 -g 50 -map [v2] -map
> [a2] rtmp://lab2.com/rtmp/push/testfeed3 -f flv -vcodec libx264 -s 1280x720
> -r 25/1 -b:v 1800000 -acodec libfdk_aac -ar 48000 -b:a 64000 -sc_threshold
> 0 -pix_fmt yuv420p -flags +global_header+cgop -profile:v high -level 4.0
> -preset fast -nal-hrd cbr -maxrate 1800000 -minrate 1800000 -bufsize
> 3600000 -g 50 -map [v3] -map [a3] rtmp://lab2.com/rtmp/push/testfeed4
>
>
> *FFmpeg 4.3 version:*
> ffmpeg -version
> ffmpeg version 4.3 Copyright (c) 2000-2020 the FFmpeg developers
> built with gcc 8 (GCC)
> configuration: --prefix=/root/ffmpeg-4.3/ffmpeg_build
> --pkg-config-flags=--static
> --extra-cflags='-I/root/ffmpeg-4.3/ffmpeg_build/include
> -I/usr/local/cuda/include'
> --extra-ldflags='-L/root/ffmpeg-4.3/ffmpeg_build/lib
> -L/usr/local/cuda/lib64' --extra-libs=-lpthread --extra-libs=-lm
> --bindir=/root/ffmpeg-4.3/bin --enable-gpl --enable-libfdk_aac
> --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libvpx
> --enable-libx264 --enable-libx265 --enable-cuda --enable-cuvid
> --enable-nvenc --enable-libnpp --enable-nonfree --enable-openssl
> libavutil      56. 51.100 / 56. 51.100
> libavcodec     58. 91.100 / 58. 91.100
> libavformat    58. 45.100 / 58. 45.100
> libavdevice    58. 10.100 / 58. 10.100
> libavfilter     7. 85.100 /  7. 85.100
> libswscale      5.  7.100 /  5.  7.100
> libswresample   3.  7.100 /  3.  7.100
> libpostproc    55.  7.100 / 55.  7.100
>
>
>
> *FFmpeg 5.0.1 version:*ffmpeg version 5.0.1 Copyright (c) 2000-2022 the
> FFmpeg developers
> built with gcc 8 (GCC)
> configuration: --prefix=/root/ffmpeg-5.0.1-p02/ffmpeg_build
> --pkg-config-flags=--static
> --extra-cflags=-I/root/ffmpeg-5.0.1-p02/ffmpeg_build/include
> --extra-ldflags=-L/root/ffmpeg-5.0.1-p02/ffmpeg_build/lib
> --extra-libs=-lpthread --extra-libs=-lm --bindir=/root/ffmpeg-5.0.1-p02/bin
> --enable-gpl --enable-libfdk_aac --enable-libfreetype --enable-libmp3lame
> --enable-libopus --enable-libvpx --enable-libx264 --enable-libx265
> --enable-nonfree --enable-openssl
> libavutil      57. 17.100 / 57. 17.100
> libavcodec     59. 18.100 / 59. 18.100
> libavformat    59. 16.100 / 59. 16.100
> libavdevice    59.  4.100 / 59.  4.100
> libavfilter     8. 24.100 /  8. 24.100
> libswscale      6.  4.100 /  6.  4.100
> libswresample   4.  3.100 /  4.  3.100
> libpostproc    56.  3.100 / 56.  3.100
>
> Regards,
> Kousthub
> _______________________________________________
> 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