[FFmpeg-user] [libavformat] Image sequence ends on empty file

Miroslav Šustek sustmidown at centrum.cz
Fri Oct 28 20:53:04 EEST 2016


I run into a problem that ffmpeg successfully ends encoding in the middle of my image sequence when it contains an empty file.
I use command:
> ffmpeg -framerate 30 -pattern_type glob -i "*.jpeg" out.mkv

The file in the sequence is corrupt and therefore it is empty. It is unintuitive that ffmpeg does not print any error or warning. It ends in the middle like everything was OK.

When I write "asdf" in the empty file ffmpeg prints out:
> [mjpeg @ 0x1029600] No JPEG data found in image=00:00:47.23 bitrate=3808.3kbits/s speed=0.324x     
> Error while decoding stream #0:0: Invalid data found when processing input
but processes the whole sequence (minus the corrupt file of course).

Why is it that corrupt file in the sequence is skipped but empty file is considered as "end of the sequence"?
From the user perspective it can be very confusing.

See: http://git.videolan.org/?p=ffmpeg.git;a=blob;f=libavformat/img2dec.c;h=a920f4611f46641cba9762f585318552f9f00129;hb=HEAD#l501
where ret[0] is zero for an empty file and: http://git.videolan.org/?p=ffmpeg.git;a=blob;f=libavformat/img2dec.c;h=a920f4611f46641cba9762f585318552f9f00129;hb=HEAD#l510
where AVERROR_EOF is returned which makes ffmpeg to think that this is the end of the sequence.

More information about the ffmpeg-user mailing list