|
|
@ -228,44 +228,44 @@ static int enc_choose_timebase(OutputStream *ost, AVFrame *frame) |
|
|
|
return 0; |
|
|
|
return 0; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
fr = ost->frame_rate; |
|
|
|
fr = ost->frame_rate; |
|
|
|
if (!fr.num) |
|
|
|
if (!fr.num) |
|
|
|
fr = fd->frame_rate_filter; |
|
|
|
fr = fd->frame_rate_filter; |
|
|
|
if (!fr.num && !ost->max_frame_rate.num) { |
|
|
|
if (!fr.num && !ost->max_frame_rate.num) { |
|
|
|
fr = (AVRational){25, 1}; |
|
|
|
fr = (AVRational){25, 1}; |
|
|
|
av_log(ost, AV_LOG_WARNING, |
|
|
|
av_log(ost, AV_LOG_WARNING, |
|
|
|
"No information " |
|
|
|
"No information " |
|
|
|
"about the input framerate is available. Falling " |
|
|
|
"about the input framerate is available. Falling " |
|
|
|
"back to a default value of 25fps. Use the -r option " |
|
|
|
"back to a default value of 25fps. Use the -r option " |
|
|
|
"if you want a different framerate.\n"); |
|
|
|
"if you want a different framerate.\n"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (ost->max_frame_rate.num && |
|
|
|
if (ost->max_frame_rate.num && |
|
|
|
(av_q2d(fr) > av_q2d(ost->max_frame_rate) || |
|
|
|
(av_q2d(fr) > av_q2d(ost->max_frame_rate) || |
|
|
|
!fr.den)) |
|
|
|
!fr.den)) |
|
|
|
fr = ost->max_frame_rate; |
|
|
|
fr = ost->max_frame_rate; |
|
|
|
|
|
|
|
|
|
|
|
if (enc->codec->supported_framerates && !ost->force_fps) { |
|
|
|
if (enc->codec->supported_framerates && !ost->force_fps) { |
|
|
|
int idx = av_find_nearest_q_idx(fr, enc->codec->supported_framerates); |
|
|
|
int idx = av_find_nearest_q_idx(fr, enc->codec->supported_framerates); |
|
|
|
fr = enc->codec->supported_framerates[idx]; |
|
|
|
fr = enc->codec->supported_framerates[idx]; |
|
|
|
} |
|
|
|
} |
|
|
|
// reduce frame rate for mpeg4 to be within the spec limits
|
|
|
|
// reduce frame rate for mpeg4 to be within the spec limits
|
|
|
|
if (enc->codec_id == AV_CODEC_ID_MPEG4) { |
|
|
|
if (enc->codec_id == AV_CODEC_ID_MPEG4) { |
|
|
|
av_reduce(&fr.num, &fr.den, |
|
|
|
av_reduce(&fr.num, &fr.den, |
|
|
|
fr.num, fr.den, 65535); |
|
|
|
fr.num, fr.den, 65535); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (av_q2d(fr) > 1e3 && ost->vsync_method != VSYNC_PASSTHROUGH && |
|
|
|
if (av_q2d(fr) > 1e3 && ost->vsync_method != VSYNC_PASSTHROUGH && |
|
|
|
(ost->vsync_method == VSYNC_CFR || ost->vsync_method == VSYNC_VSCFR || |
|
|
|
(ost->vsync_method == VSYNC_CFR || ost->vsync_method == VSYNC_VSCFR || |
|
|
|
(ost->vsync_method == VSYNC_AUTO && !(of->format->flags & AVFMT_VARIABLE_FPS)))){ |
|
|
|
(ost->vsync_method == VSYNC_AUTO && !(of->format->flags & AVFMT_VARIABLE_FPS)))){ |
|
|
|
av_log(ost, AV_LOG_WARNING, "Frame rate very high for a muxer not efficiently supporting it.\n" |
|
|
|
av_log(ost, AV_LOG_WARNING, "Frame rate very high for a muxer not efficiently supporting it.\n" |
|
|
|
"Please consider specifying a lower framerate, a different muxer or " |
|
|
|
"Please consider specifying a lower framerate, a different muxer or " |
|
|
|
"setting vsync/fps_mode to vfr\n"); |
|
|
|
"setting vsync/fps_mode to vfr\n"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
enc->framerate = fr; |
|
|
|
enc->framerate = fr; |
|
|
|
|
|
|
|
|
|
|
|
ost->st->avg_frame_rate = fr; |
|
|
|
ost->st->avg_frame_rate = fr; |
|
|
|
|
|
|
|
|
|
|
|
if (!(tb.num > 0 && tb.den > 0)) |
|
|
|
if (!(tb.num > 0 && tb.den > 0)) |
|
|
|
tb = av_inv_q(fr); |
|
|
|
tb = av_inv_q(fr); |
|
|
|