[FFmpeg-devel] Flushing remaining streams when one stream fails on av_interleaved_write_frame()

Ramiro Polla ramiro.polla at gmail.com
Thu Jan 9 04:58:15 CET 2014


When one stream fails in av_interleaved_write_frame(), ffmpeg just
quits. If there are multiple streams/files, it may be possible that
the other streams/files are still OK. ffmpeg should at least try to
flush the remaining streams so that they become valid files.

Here is an example to reproduce the problem:
$ mkdir 1
$ ffmpeg -i input -f image2 "%d/x.jpg" output.mpg

output.mpg will not be flushed properly, even though the problem is in image2.

I tried to fix this by propagating the error from write_frame() but
the point I got to is that ffmpeg hangs on reading from the input
(attached patch is for reference, not for review). This whole
input/output code with filterchains in ffmpeg is confusing to me. Can
anyone shed some light on the proper way to either a) close just the
misbehaving stream and keep on trying the other ones or b) flush and
close all streams on error.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-NOT-FOR-REVIEW.patch
Type: text/x-patch
Size: 11062 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20140109/c73586da/attachment.bin>

More information about the ffmpeg-devel mailing list