[FFmpeg-user] Performance: Multiple output, encode audio only once
Claudiu Rad
jazzman at misalpina.net
Sat Aug 16 18:49:15 CEST 2014
Hello,
Trying to figure this one out but after searching over the internet and
looking through ffmpeg/filter documentation, still isn't clear for me
how to do it optimally:
I want to take a video input source with the purpose of transcoding it
to three different levels/bitrates. I also want to change audio codec,
thus, need to reencode, but should be the same in all output streams. I
know that the audio encoding doesn't take much CPU power, but, I still
want to do it efficiently also in the cases where I have 5 or 6 outputs.
Command line sample with two levels only of what I am doing now:
ffmpeg -i input.mkv \
-acodec libvo_aacenc -ac 2 -b:a 112k -vcodec libx264 -s 1280x720
output1.mp4
-acodec libvo_aacenc -ac 2 -b:a 112k -vcodec libx264 -s 640x360
output2.mp4
How can I avoid encoding to AAC twice in this case (5 or 6 times in
real-case scenarios)?
Is somewhat of a filter_complex recommended or should I just try to pipe
from one ffmpeg instance to another? I am worried about eventual
instabilities in this case involving a system pipe and that two ffmpeg
instances may eat more system resources so this wouldn't be optimal from
other points of view. This is why I would favor a filter_complex-like
solution.
And one more question to extend my performance worries a bit:
How many times the input is demuxed/decoded when using multiple output?
More precisely, in the above case, is the input video stream decoded
once or twice?
If twice (or N times in case of N outputs), how can this be improved,
because it may involve a lot of CPU.
Thanks.
--
Claudiu
More information about the ffmpeg-user
mailing list