[FFmpeg-user] How to optimize transcoding cpu usage

Reindl Harald h.reindl at thelounge.net
Fri May 31 17:39:22 CEST 2013


why should you do this?

it uses as much cores as available *as default*
but not all can be done in parallel and since the OP
refers to nice at the same time as "more with this CPU"
nobody knows if he wants his CPU more or less used

Am 31.05.2013 16:51, schrieb Stefan:
> 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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 263 bytes
Desc: OpenPGP digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-user/attachments/20130531/4a07ca9a/attachment.asc>


More information about the ffmpeg-user mailing list