diff options
author | Anton Khirnov <anton@khirnov.net> | 2023-05-05 18:46:28 +0200 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2023-05-15 10:31:55 +0200 |
commit | 78e84c054a2a04edeea25e9ee54d0fb172cd7053 (patch) | |
tree | 980444d8a6e3f71d0c8368c6cfe6bc5a01fc0ba2 | |
parent | d45a296732ed0b92d19a1cc017552cf163ccb648 (diff) | |
download | ffmpeg-78e84c054a2a04edeea25e9ee54d0fb172cd7053.tar.gz |
fftools/ffmpeg: fix computing video frame duration from repeat_pict
This field contains the number of _field_ durations by which the
standard frame duration should be extended.
-rw-r--r-- | fftools/ffmpeg.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c index 5cf6a00f50..9920f946dc 100644 --- a/fftools/ffmpeg.c +++ b/fftools/ffmpeg.c @@ -990,10 +990,10 @@ static int64_t video_duration_estimate(const InputStream *ist, const AVFrame *fr return frame->duration; if (ist->dec_ctx->framerate.den && ist->dec_ctx->framerate.num) { - int ticks = frame->repeat_pict >= 0 ? - frame->repeat_pict + 1 : - ist->dec_ctx->ticks_per_frame; - codec_duration = av_rescale_q(ticks, av_inv_q(ist->dec_ctx->framerate), + int fields = frame->repeat_pict + 2; + AVRational field_rate = av_mul_q(ist->dec_ctx->framerate, + (AVRational){ 2, 1 }); + codec_duration = av_rescale_q(fields, av_inv_q(field_rate), ist->st->time_base); } |