Page 1 of 1

Progressively write out each image in a sequence?

Posted: 2009-06-16T21:29:37-07:00
by Jugdizh
I'm trying to do some on-the-fly conversion of images before generating a video from them, using a combination of convert and ffmpeg. The input images are in EXR format, which convert can read but ffmpeg can't. So I'm using the PPM format as an intermediary between the two.

Here's my command-line call:

convert 'input.*.exr' -depth 8 ppm:- | ffmpeg -f image2pipe -vcodec ppm -i - -f mov -vcodec libx264 output.mov

This works great except for one issue: the ffmpeg command does not begin encoding the video until convert has finished writing out *every* image. How can I get convert to progressively write out each image in the sequence rather than holding onto them and writing them out all at once?

Thanks

Re: Progressively write out each image in a sequence?

Posted: 2009-06-16T21:56:12-07:00
by fmw42
you could use a (shell) script and a loop (while, for, etc) and access and process each image separately from a variable list of images or from a file list of images.

Re: Progressively write out each image in a sequence?

Posted: 2009-06-16T22:00:10-07:00
by Jugdizh
If I convert each image separately in a loop then I would no longer be able to have one pipe open to ffmpeg the whole time. I would have to save out each image onto disk and then run ffmpeg on the files, which would take even longer than my current method. What I'm trying to achieve is convert and ffmpeg running simultaneously, with convert feeding ffmpeg the image data as ffmpeg is encoding the video.

Re: Progressively write out each image in a sequence?

Posted: 2009-06-17T21:57:41-07:00
by anthony
I do not think it is "convert" but the pipeline buffering that happens between the commands.
That is convert is writing into a 'in-memory buffer' (the pipeline) which 'ffmpeg' will be reading from when it runs.