Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there a way to stop ffmpeg from processing if an error was encountered? I'm using ffmpeg to check video integrity by using:

ffmpeg -v error -i file.avi -f null - 2>error.log

However, I'd like to expand on it to stop the process as soon as an error is identified.

share|improve this question
up vote 2 down vote accepted

I've already wondered about this myself, and ffmpeg doesn't provide an easy way to do that. Based on the feedback I got on the FFmpeg mailing list, you can use the global option

-err_detect explode

This option doesn't appear to work in all cases though. See ffmpeg -h full for the option list:

-f_err_detect      <flags>      .D.... set error detection flags (deprecated; use err_detect, save via avconv)
   crccheck                     .D.... verify embedded CRCs
   bitstream                    .D.... detect bitstream specification deviations
   buffer                       .D.... detect improper bitstream length
   explode                      .D.... abort decoding on minor error detection
   careful                      .D.... consider things that violate the spec and have not been seen in the wild as errors
   compliant                    .D.... consider all spec non compliancies as errors
   aggressive                   .D.... consider things that a sane encoder shouldnt do as an error
-err_detect        <flags>      .D.... set error detection flags
   crccheck                     .D.... verify embedded CRCs
   bitstream                    .D.... detect bitstream specification deviations
   buffer                       .D.... detect improper bitstream length
   explode                      .D.... abort decoding on minor error detection
   careful                      .D.... consider things that violate the spec and have not been seen in the wild as errors
   compliant                    .D.... consider all spec non compliancies as errors
   aggressive                   .D.... consider things that a sane encoder shouldnt do as an error
share|improve this answer
    
Thanks! I will give that option a go, some error capturing is better then nothing :) – Kate Apr 30 '13 at 15:24

In an option:

-xerror 

The command line option is documented as doing exactly what you want.

Add the option and ffmpeg will exit on a stream error (also setting exit value to 1) from:

ffmpeg -h full | grep xerror .... -xerror error exit on error
share|improve this answer
    
Thanks a lot, that's exactly what i want, I believe this is the answer. not the slhck's answer. – pylover Apr 13 at 7:43

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .