Commit 801876fb authored by Michael Niedermayer's avatar Michael Niedermayer

avcodec/utils: fix time_base after the framerate addition

time_base != 1/framerate for example for interlaced video
Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent 17085a02
...@@ -1677,7 +1677,7 @@ int attribute_align_arg avcodec_open2(AVCodecContext *avctx, const AVCodec *code ...@@ -1677,7 +1677,7 @@ int attribute_align_arg avcodec_open2(AVCodecContext *avctx, const AVCodec *code
#if FF_API_AVCTX_TIMEBASE #if FF_API_AVCTX_TIMEBASE
if (avctx->framerate.num > 0 && avctx->framerate.den > 0) 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 #endif
} }
end: end:
...@@ -2391,7 +2391,7 @@ fail: ...@@ -2391,7 +2391,7 @@ fail:
#if FF_API_AVCTX_TIMEBASE #if FF_API_AVCTX_TIMEBASE
if (avctx->framerate.num > 0 && avctx->framerate.den > 0) 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 #endif
return ret; return ret;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment