[FFmpeg-user] How to optimize transcoding cpu usage

Stefan stefan52a at gmail.com
Fri May 31 16:51:51 CEST 2013


Shouldn't you use -threads 0 for libx264 to get maximum multi-core usage?

Op 31/05/2013 15:41, Rala Wa schreef:
> Hi,
>
>
> I am currently trying to transcode an udp TS stream which contains 1 video stream and 4 audio streams.
>
> I'm using this command line:
>
> ffmpeg -i "udp://239.255.0.10:1234?fifo_size=1000000" \
>      -map 0:0 -codec:v libx264 -s 1280x720 -profile:v baseline -preset:v superfast -g 125 -vb 1500k -map 0:1 -codec:a aac -ab 64000 -ar 48000 -ac 2 -strict experimental -f flv rtmp://host/1/720p \
>      -map 0:0 -codec:v libx264 -s 800x450 -profile:v baseline -preset:v superfast -g 125 -vb 800k -map 0:1 -codec:a aac -ab 64000 -ar 48000 -ac 2 -strict experimental -f flv rtmp://host/1/450p \
>      -map 0:0 -codec:v libx264 -s 384x216 -profile:v baseline -preset:v superfast -g 125 -vb 300k -map 0:1 -codec:a aac -ab 64000 -ar 48000 -ac 2 -strict experimental -f flv rtmp://host/1/216p \
>      -map 0:0 -codec:v libx264 -s 1280x720 -profile:v baseline -preset:v superfast -g 125 -vb 1500k -map 0:2 -codec:a aac -ab 64000 -ar 48000 -ac 2 -strict experimental -f flv rtmp://host/2/720p \
>      -map 0:0 -codec:v libx264 -s 800x450 -profile:v baseline -preset:v superfast -g 125 -vb 800k -map 0:2 -codec:a aac -ab 64000 -ar 48000 -ac 2 -strict experimental -f flv rtmp://host/2/450p \
>      -map 0:0 -codec:v libx264 -s 384x216 -profile:v baseline -preset:v superfast -g 125 -vb 300k -map 0:2 -codec:a aac -ab 64000 -ar 48000 -ac 2 -strict experimental -f flv rtmp://host/2/216p
>      
>
> With this command line I encode 6 streams, 3 quality for 2 langs.
> In this command line I, for example, transcode two times the 1280x720 video resolution which I think is not optimized.
>
> Can you tell me, if it is possible to encode only one time the video and add different languages to this video?
>
> In fact, to optimize cpu usage I would like to encode only once each video resolution
>
>            ---- 1280x720 ------> 3 outputs with audio 0:1, 0:2, 0:3 ...
>           |
> TS input --------- 800x450 -------> 3 outputs with audio 0:1, 0:2, 0:3 ...
>           |
>           ----- 384x216 ------> 2 output with audio 0:1, 0:2, 0:3 ...
>
> I am also surprised by the cpu usage of this command line. With a 8 cores X3450, this command line use 30% on all cores. When I add 3 outputs the cpu usage increase slightly but ffmpeg is not able to do 25 fps transcoding and then I see buffering on the output streams. I tried to nice ffmpeg but It is not better. I hoped to encode more streams with this CPU.
>
>    
> Regards,
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user



More information about the ffmpeg-user mailing list