This ensures that an encoder is able to cope with input frames with changing
resolution only if it declares the capability of 
AV_CODEC_CAP_VARIABLE_DIMENSIONS.

Signed-off-by: Linjie Fu <linjie...@intel.com>
---
 fftools/ffmpeg.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index e5fbd47..5c4cf03 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -1068,6 +1068,15 @@ static void do_video_out(OutputFile *of,
     InputStream *ist = NULL;
     AVFilterContext *filter = ost->filter->filter;
 
+    if (next_picture && (enc->width != next_picture->width ||
+                         enc->height != next_picture->height)) {
+        if (!(enc->codec->capabilities & AV_CODEC_CAP_VARIABLE_DIMENSIONS)) {
+            av_log(NULL, AV_LOG_ERROR, "Variable dimension encoding "
+                            "is not supported by %s.\n", enc->codec->name);
+            goto error;
+        }
+    }
+
     if (ost->source_index >= 0)
         ist = input_streams[ost->source_index];
 
-- 
2.7.4

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to