[FFmpeg-user] Force concat to ignore corrupt files?

Nicolas George george at nsup.org
Wed Apr 16 16:38:24 CEST 2014

Le quintidi 25 germinal, an CCXXII, Phunkadilic a écrit :
> I'm currently using this command to concat individual video files every
> night:
> "ffmpeg.exe -f concat -i C:\path\video-files.txt -c copy
> C:\Desitination\path\concat-file.mp4"
> I've noticed that if there's a single corrupt .mp4 file, the command will
> stop and concat only the files that were good before hitting the corrupt
> file.  Is there a way/command to have ffmpeg to either skip any corrupt
> files or to force through and ignore errors?  
> This script runs automatically nightly and I'd rather not have to babysit
> these files.  If there's one or two corrupt files, I'd rather them just be
> skipped and not worry about having to go through and remove the corrupt
> files and re-do the process manually.

I may be wrong, but it seems to me like a very specific use case.

I suggest you test if the file is corrupt while constructing your concat
script. Something like that would probably do the trick (with extra shell
escaping of course):

    for f in $files; do
      if ffprobe -loglevel warning $f; then
	printf 'file %s\n' $f >> $concat

That way, you can do smart decisions depending on the amount of corrupted
files, for example. Depending on the degree of corruption you want to guard
against, you may want to read the file completely (-show_packets), or maybe
even decode it (-show_frames). Note that since the concat demuxer works at
demuxer level, it could not guard against problems at the decoding level


  Nicolas George
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-user/attachments/20140416/9465dbf7/attachment.asc>

More information about the ffmpeg-user mailing list