[FFmpeg-devel] [PATCH] ffmpeg: be more verbose when printing an error

Stefano Sabatini stefasab at gmail.com
Fri Jun 1 18:43:24 CEST 2012


Helps debuggability.
---
 ffmpeg.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/ffmpeg.c b/ffmpeg.c
index 6318e34..7af3b74 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -3574,10 +3574,12 @@ static int transcode(void)
         }
 
         // fprintf(stderr,"read #%d.%d size=%d\n", ist->file_index, ist->st->index, pkt.size);
-        if (output_packet(ist, &pkt) < 0 ||
+        if ((ret = output_packet(ist, &pkt)) < 0 ||
             ((ret = poll_filters()) < 0 && ret != AVERROR_EOF)) {
-            av_log(NULL, AV_LOG_ERROR, "Error while decoding stream #%d:%d\n",
-                   ist->file_index, ist->st->index);
+            char buf[128];
+            av_strerror(ret, buf, sizeof(buf));
+            av_log(NULL, AV_LOG_ERROR, "Error while decoding stream #%d:%d: %s\n",
+                   ist->file_index, ist->st->index, buf);
             if (exit_on_error)
                 exit_program(1);
             av_free_packet(&pkt);
-- 
1.7.5.4



More information about the ffmpeg-devel mailing list