[FFmpeg-user] Using FFMPEG to encode multiple outputs in 'parallel' (doesn't work?)

Reuben Martin reuben.m at gmail.com
Sat Jul 1 06:42:55 EEST 2017


On Thursday, June 29, 2017 6:56:51 PM CDT shalin wrote:
> Cley Faye wrote
> 
> > More to the point, as far as I know, ffmpeg will not do parallel treatment
> > on either input or output, as you deduced. It certainly is doable, but
> > don't seem trivial to implement in the ffmpeg CLI tool itself since that
> > tool must handle various cases, and introducing (more) special cases would
> > add complexity for not much benefits.
> > 
> > You should look in using the various ffmpeg libraries directly; with that
> > you could probably write it to decode once, encode multiple time. But
> > unless you have shockingly similar settings and unlimited processing
> > power,
> > you'll most likely stall some of your encodings while other catch up with
> > them. I don't know how well ffmpeg libraries handle multithreading (I
> > suppose fairly well since most of it's operations are based on context
> > structures) but you'll have to do a fair amount of synchronization by
> > hand.
> 
> Thank you for your answer to my original question. So from this, I am
> assuming that ffmpeg in its current form doesn't support output level
> parallelism. Actually I have 'shockingly' similar transcodings to perform on
> a given input stream (I need to crop different parts of the input video and
> encode them at same bitrate and also cropped parts are same in size for
> each stream). With that each encode should roughly run at the same rate and
> I believe multithreading should be really helpful.

All this is possible but you need to do a lot of reading. Starting with input 
mapping. http://www.ffmpeg.org/ffmpeg-all.html#Advanced-options

It couldn’t hurt to read up on how anonymous pipes work in a posix shell, as 
well as other shell related concepts.

-Reuben




More information about the ffmpeg-user mailing list