History

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.

Anton Khirnov committed 3 years ago

Commit 78e84c01 parent d45a2961 file · +4 −4Browse files

Unified · Split

fftools/ffmpeg.c+4−4
@@ -990,10 +990,10 @@ static int64_t video_duration_estimate(const InputStream *ist, const AVFrame *fr · 989 unmodified lines
990990 return frame->duration;
991991
992992 if (ist->dec_ctx->framerate.den && ist->dec_ctx->framerate.num) {
993− int ticks = frame->repeat_pict >= 0 ?
994− frame->repeat_pict + 1 :
995− ist->dec_ctx->ticks_per_frame;
996− codec_duration = av_rescale_q(ticks, av_inv_q(ist->dec_ctx->framerate),
993+ int fields = frame->repeat_pict + 2;
994+ AVRational field_rate = av_mul_q(ist->dec_ctx->framerate,
995+ (AVRational){ 2, 1 });
996+ codec_duration = av_rescale_q(fields, av_inv_q(field_rate),
997997 ist->st->time_base);
998998 }
999999

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t