diff options
author | Anton Khirnov <anton@khirnov.net> | 2023-05-04 11:45:29 +0200 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2023-05-15 10:32:05 +0200 |
commit | 3fabf712070cb060a01e93d70dbdf837f0efa98e (patch) | |
tree | 76ea18c21d63234dba005f97410d9c74ea6bd399 | |
parent | dc20baa0491d190a68d73f4da931205490e344bb (diff) | |
download | ffmpeg-3fabf712070cb060a01e93d70dbdf837f0efa98e.tar.gz |
lavc/msmpeg4enc: use AVCodecContext.framerate when available
-rw-r--r-- | libavcodec/msmpeg4enc.c | 8 |
1 files changed, 7 insertions, 1 deletions
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)); |