[FFmpeg-cvslog] avcodec/utils: fix time_base after the framerate addition

Michael Niedermayer git at videolan.org
Wed Oct 15 16:20:51 CEST 2014


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Wed Oct 15 15:50:49 2014 +0200| [801876fb079ecac157dbbffe2b6d10f2e2408fbf] | committer: Michael Niedermayer

avcodec/utils: fix time_base after the framerate addition

time_base != 1/framerate for example for interlaced video

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

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

 libavcodec/utils.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 12d0196..9f65340 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -1677,7 +1677,7 @@ int attribute_align_arg avcodec_open2(AVCodecContext *avctx, const AVCodec *code
 
 #if FF_API_AVCTX_TIMEBASE
         if (avctx->framerate.num > 0 && avctx->framerate.den > 0)
-            avctx->time_base = av_inv_q(avctx->framerate);
+            avctx->time_base = av_inv_q(av_mul_q(avctx->framerate, (AVRational){avctx->ticks_per_frame, 1}));
 #endif
     }
 end:
@@ -2391,7 +2391,7 @@ fail:
 
 #if FF_API_AVCTX_TIMEBASE
     if (avctx->framerate.num > 0 && avctx->framerate.den > 0)
-        avctx->time_base = av_inv_q(avctx->framerate);
+        avctx->time_base = av_inv_q(av_mul_q(avctx->framerate, (AVRational){avctx->ticks_per_frame, 1}));
 #endif
 
     return ret;



More information about the ffmpeg-cvslog mailing list