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

Phunkadilic slanaconda at gmail.com
Wed Apr 16 17:25:15 CEST 2014

Thanks for these great tips.  Basically it's like this.  I'm using the concat command for daily merging of video capture files (.mp4).  Every now and then I'll get one or two video files that will have some time of error or will be incomplete.  The concat command see's these files and simply stops the concat process instead of skipping them and continuing on to the next good file in the list.  This is what I would to fix.  I want the concat function to continue on instead of getting stuck and exiting the first time it hits a bad file.

I'll have to try the ffprobe command to see if that does the trick. 


On Apr 16, 2014, at 8:39 AM, Nicolas George [via FFmpeg-users] <ml-node+s933282n4664793h96 at n4.nabble.com> wrote:

> 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 
>       else 
>         corrupted=$((corrupted+1)) 
>       fi 
>     done 
> 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 
> anyway. 
> Regards, 
> -- 
>   Nicolas George 
> _______________________________________________ 
> ffmpeg-user mailing list 
> [hidden email] 
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
>  signature.asc (836 bytes) Download Attachment
> If you reply to this email, your message will be added to the discussion below:
> http://ffmpeg-users.933282.n4.nabble.com/Force-concat-to-ignore-corrupt-files-tp4664775p4664793.html
> To unsubscribe from Force concat to ignore corrupt files?, click here.

View this message in context: http://ffmpeg-users.933282.n4.nabble.com/Force-concat-to-ignore-corrupt-files-tp4664775p4664796.html
Sent from the FFmpeg-users mailing list archive at Nabble.com.

More information about the ffmpeg-user mailing list