[FFmpeg-devel] [PATCH 08/13] lavc/msmpeg4enc: use AVCodecContext.framerate when available
Anton Khirnov
anton at khirnov.net
Sun May 7 16:32:50 EEST 2023
---
libavcodec/msmpeg4enc.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/libavcodec/msmpeg4enc.c b/libavcodec/msmpeg4enc.c
index 54121438a0..df190d376c 100644
--- a/libavcodec/msmpeg4enc.c
+++ b/libavcodec/msmpeg4enc.c
@@ -280,7 +280,13 @@ void ff_msmpeg4_encode_picture_header(MpegEncContext * s)
void ff_msmpeg4_encode_ext_header(MpegEncContext * s)
{
- unsigned fps = s->avctx->time_base.den / s->avctx->time_base.num / FFMAX(s->avctx->ticks_per_frame, 1);
+ unsigned fps;
+
+ if (s->avctx->framerate.num > 0 && s->avctx->framerate.den > 0)
+ fps = s->avctx->framerate.num / s->avctx->framerate.den;
+ else
+ fps = s->avctx->time_base.den / s->avctx->time_base.num / FFMAX(s->avctx->ticks_per_frame, 1);
+
put_bits(&s->pb, 5, FFMIN(fps, 31)); //yes 29.97 -> 29
put_bits(&s->pb, 11, FFMIN(s->bit_rate / 1024, 2047));
--
2.39.2
More information about the ffmpeg-devel
mailing list