History

fftools/ffmpeg: when framerate is set, prefer its inverse as output timebase

Codec timebase is not well-defined for streamcopy, so it should only be used as the last resort.

Anton Khirnov committed 5 years ago

Commit 0214da21 parent 7ec82291 file · +6 −2Browse files

Unified · Split

fftools/ffmpeg.c+6−2
@@ -3151,8 +3151,12 @@ static int init_output_stream_streamcopy(OutputStream *ost) · 3150 unmodified lines
31513151 return ret;
31523152
31533153 // copy timebase while removing common factors
3154− if (ost->st->time_base.num <= 0 || ost->st->time_base.den <= 0)
3155− ost->st->time_base = av_add_q(av_stream_get_codec_timebase(ost->st), (AVRational){0, 1});
3154+ if (ost->st->time_base.num <= 0 || ost->st->time_base.den <= 0) {
3155+ if (ost->frame_rate.num)
3156+ ost->st->time_base = av_inv_q(ost->frame_rate);
3157+ else
3158+ ost->st->time_base = av_add_q(av_stream_get_codec_timebase(ost->st), (AVRational){0, 1});
3159+ }
31563160
31573161 // copy estimated duration as a hint to the muxer
31583162 if (ost->st->duration <= 0 && ist->st->duration > 0)

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