[FFmpeg-cvslog] mpeg4videoenc: guess a good aspect when we cant store the exact one.

Michael Niedermayer git at videolan.org
Thu Sep 22 14:31:01 CEST 2011


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Thu Sep 22 14:08:39 2011 +0200| [394781a89706479aa56749a9d69c4e74b398dd71] | committer: Michael Niedermayer

mpeg4videoenc: guess a good aspect when we cant store the exact one.

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=394781a89706479aa56749a9d69c4e74b398dd71
---

 libavcodec/mpegvideo_enc.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c
index 8fcb934..693bbf1 100644
--- a/libavcodec/mpegvideo_enc.c
+++ b/libavcodec/mpegvideo_enc.c
@@ -423,8 +423,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;
     }
 



More information about the ffmpeg-cvslog mailing list