]> git.sesse.net Git - ffmpeg/commitdiff
fftools/ffmpeg: add new abort_on flag which aborts if there is a stream which receive...
authorMarton Balint <cus@passwd.hu>
Tue, 12 May 2020 22:06:08 +0000 (00:06 +0200)
committerMarton Balint <cus@passwd.hu>
Tue, 26 May 2020 19:50:50 +0000 (21:50 +0200)
Signed-off-by: Marton Balint <cus@passwd.hu>
doc/ffmpeg.texi
fftools/ffmpeg.c
fftools/ffmpeg.h
fftools/ffmpeg_opt.c

index ed437bb16f06c653ba687beccddfb322344d1670..76fafdcf7eda715458d12ea02cf93c47ded4f00e 100644 (file)
@@ -1721,6 +1721,8 @@ Stop and abort on various conditions. The following flags are available:
 @table @option
 @item empty_output
 No packets were passed to the muxer, the output is empty.
+@item empty_output_stream
+No packets were passed to the muxer in some of the output streams.
 @end table
 
 @item -xerror (@emph{global})
index ad95a0e4179918ac0942249d290866f02e104fbd..de456df040ea5238b9d082446950fa4ead2f40d1 100644 (file)
@@ -4713,6 +4713,10 @@ static int transcode(void)
             av_freep(&ost->enc_ctx->stats_in);
         }
         total_packets_written += ost->packets_written;
+        if (!ost->packets_written && (abort_on_flags & ABORT_ON_FLAG_EMPTY_OUTPUT_STREAM)) {
+            av_log(NULL, AV_LOG_FATAL, "Empty output on stream %d.\n", i);
+            exit_program(1);
+        }
     }
 
     if (!total_packets_written && (abort_on_flags & ABORT_ON_FLAG_EMPTY_OUTPUT)) {
index 38205a1a13dc75f670b469c7a9ada6e5ef87abe5..828cb2a4ff92de88fceae88b047b1b43b762e0ad 100644 (file)
@@ -430,7 +430,8 @@ enum forced_keyframes_const {
     FKF_NB
 };
 
-#define ABORT_ON_FLAG_EMPTY_OUTPUT (1 <<  0)
+#define ABORT_ON_FLAG_EMPTY_OUTPUT        (1 <<  0)
+#define ABORT_ON_FLAG_EMPTY_OUTPUT_STREAM (1 <<  1)
 
 extern const char *const forced_keyframes_const_names[];
 
index 60bb437ea70012a617c281d7f07c5a4b091fd917..2eb4e1c973fbce3f1e0b91c137158a6ab96e5bfe 100644 (file)
@@ -262,8 +262,9 @@ static AVDictionary *strip_specifiers(AVDictionary *dict)
 static int opt_abort_on(void *optctx, const char *opt, const char *arg)
 {
     static const AVOption opts[] = {
-        { "abort_on"        , NULL, 0, AV_OPT_TYPE_FLAGS, { .i64 = 0 }, INT64_MIN, INT64_MAX, .unit = "flags" },
-        { "empty_output"    , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = ABORT_ON_FLAG_EMPTY_OUTPUT     },    .unit = "flags" },
+        { "abort_on"           , NULL, 0, AV_OPT_TYPE_FLAGS, { .i64 = 0 }, INT64_MIN, INT64_MAX,           .unit = "flags" },
+        { "empty_output"       , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = ABORT_ON_FLAG_EMPTY_OUTPUT        }, .unit = "flags" },
+        { "empty_output_stream", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = ABORT_ON_FLAG_EMPTY_OUTPUT_STREAM }, .unit = "flags" },
         { NULL },
     };
     static const AVClass class = {