Merge remote-tracking branch 'qatar/master'
[ffmpeg.git] / libavformat / mux.c
index 34c9328c33fcaab630bada57485fc16e94a0e8c1..bb72a41dcc4e4f4b3fd50f401cc86e1c7c8e152d 100644 (file)
@@ -273,13 +273,18 @@ static int init_muxer(AVFormatContext *s, AVDictionary **options)
             if (av_cmp_q(st->sample_aspect_ratio, codec->sample_aspect_ratio)
                 && FFABS(av_q2d(st->sample_aspect_ratio) - av_q2d(codec->sample_aspect_ratio)) > 0.004*av_q2d(st->sample_aspect_ratio)
             ) {
             if (av_cmp_q(st->sample_aspect_ratio, codec->sample_aspect_ratio)
                 && FFABS(av_q2d(st->sample_aspect_ratio) - av_q2d(codec->sample_aspect_ratio)) > 0.004*av_q2d(st->sample_aspect_ratio)
             ) {
-                av_log(s, AV_LOG_ERROR, "Aspect ratio mismatch between muxer "
-                                        "(%d/%d) and encoder layer (%d/%d)\n",
-                       st->sample_aspect_ratio.num, st->sample_aspect_ratio.den,
-                       codec->sample_aspect_ratio.num,
-                       codec->sample_aspect_ratio.den);
-                ret = AVERROR(EINVAL);
-                goto fail;
+                if (st->sample_aspect_ratio.num != 0 &&
+                    st->sample_aspect_ratio.den != 0 &&
+                    codec->sample_aspect_ratio.den != 0 &&
+                    codec->sample_aspect_ratio.den != 0) {
+                    av_log(s, AV_LOG_ERROR, "Aspect ratio mismatch between muxer "
+                           "(%d/%d) and encoder layer (%d/%d)\n",
+                           st->sample_aspect_ratio.num, st->sample_aspect_ratio.den,
+                           codec->sample_aspect_ratio.num,
+                           codec->sample_aspect_ratio.den);
+                    ret = AVERROR(EINVAL);
+                    goto fail;
+                }
             }
             break;
         }
             }
             break;
         }