[FFmpeg-user] "Piping" to c#

Phil Turmel philip at turmel.org
Thu Jun 28 01:41:45 CEST 2012


Hi Marco,

On 06/27/2012 04:31 PM, Marco Baumgärtner wrote:
> Hello.
> 
> I'd like to encode images I create in c# directly into a video using
> ffmpeg. I thought about exporting jpgs in c# to feed ffmpeg with to have
> a buffer. But simply assuming a number of images to be available would
> lead to ffmpeg being faster than my code so ffmpeg may exit prematurely.
> So I am looking for a command line to make ffmpeg encode images until a
> "stop signal" of some kind comes for it to finalize the movie file. In
> other words(from ffmpeg perspective): More and more files are piling up,
> like image0001.jpg, image0002.jpg,... Starting now with encoding might
> make ffmpeg come to the last currently output file while there are more
> to come. But at the time of ffmpeg execution there were not any more. So
> the given files are being processed, ffmpeg exits like a dog who wags
> its tail and waits for its reward ;)

If you are generating these images from within C#, consider not writing
them to individual files, but piping them to FFmpeg's standard input.

FFmpeg should be told to read Motion JPEG from a stream, and you then
feed the raw JPEG data down the stream.  FFmpeg won't quit reading until
you close the file handle.

I don't know the format specifiers off the top of my head like the
experts around here, but "ffmpeg -formats" and "ffmpeg -codecs" should
point you in the right direction.

HTH,

Phil


More information about the ffmpeg-user mailing list