How to find out if ffmpeg is wrong or not?

Situation: I am using ffmpeg (via .net) to save video files. I can get the output from ffmpeg, but I do not know how to tune the result to the best result.

My problem: My problem is that there is no definite difference between a successful and a failed operation.

last line of success:

video: 1006kB audio: 134kB subtitles: 0 global headers: 0kB muxing overload 0.943510%

last lines with an error

c: \ x \ test-9-8 / 30 / 2012-9: 29: 56-AM.mp4: Invalid argument

rtmp: //cdn.tv/cdn-live39/definst/stream01: Unknown error

My question is: Is there an option (or a command line parameter) to add any return code (200: success, 500: error, etc.)

Thanks!

PS: I saw this topic How do I say if the error is ffmpeg? but there is no number before / after the last line. I think the latest version no longer has a number.

+4
source share
2 answers

I know this is very old, but when I came across and did not find another reliable answer, and after some testing:

An offer with a 0 return check is usually good advice - but does not help in all cases. Another idea with checking for a file is also good - but again - it does not help in all cases.

For example, when the input file is an mp3 file with a built-in cover, then ffmpeg (in my tests) uses this image and extracts it as a (unusable) video file.

Now I have to have the debug level output and analyze it for the number of multiplexed packets.

ffmpeg -i "wildlife.mp4" -c:v copy -an -sn "out.mp4" -y -loglevel debug 2> wildlife.txt

In regex, I am looking for this text:
Output stream .+ (video): [0-9][0-9]+ packets muxed \([0-9][0-9]+ bytes\)

(this assumes that each video has more than 9 packages - of course, it can be optimized for really short videos).

Of course, the output may be different for RTMP or other settings, but I think parsing the full output stream is the only option.

+3
source

You can simply check the exit code returned by ffmpeg. It should return 0 on success, something else means that it failed.

+4
source

All Articles