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.
This commit is contained in:
Anton Khirnov 2023-05-05 18:46:28 +02:00
parent d45a296732
commit 78e84c054a
1 changed files with 4 additions and 4 deletions

View File

@ -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);
}