mpeg4videoenc: guess a good aspect when we cant store the exact one.
authorMichael Niedermayer <michaelni@gmx.at>
Thu, 22 Sep 2011 12:08:39 +0000 (14:08 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Sat, 1 Oct 2011 17:30:06 +0000 (19:30 +0200)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 394781a89706479aa56749a9d69c4e74b398dd71)

libavcodec/mpegvideo_enc.c

index a6e9c7c..d13534d 100644 (file)
@@ -411,8 +411,10 @@ av_cold int MPV_encode_init(AVCodecContext *avctx)
     if ((s->codec_id == CODEC_ID_MPEG4 || s->codec_id == CODEC_ID_H263 ||
          s->codec_id == CODEC_ID_H263P) &&
         (avctx->sample_aspect_ratio.num > 255 || avctx->sample_aspect_ratio.den > 255)) {
-        av_log(avctx, AV_LOG_ERROR, "Invalid pixel aspect ratio %i/%i, limit is 255/255\n",
+        av_log(avctx, AV_LOG_WARNING, "Invalid pixel aspect ratio %i/%i, limit is 255/255 reducing\n",
                avctx->sample_aspect_ratio.num, avctx->sample_aspect_ratio.den);
+        av_reduce(&avctx->sample_aspect_ratio.num, &avctx->sample_aspect_ratio.den,
+                   avctx->sample_aspect_ratio.num,  avctx->sample_aspect_ratio.den, 255);
         return -1;
     }