Commit bbc85f4b authored by Laurent Aimar's avatar Laurent Aimar

Used the nearest available frame rate in avcodec encoder.

It fixes #1965.
parent eb71a005
...@@ -402,6 +402,17 @@ int OpenEncoder( vlc_object_t *p_this ) ...@@ -402,6 +402,17 @@ int OpenEncoder( vlc_object_t *p_this )
p_context->time_base.num = p_enc->fmt_in.video.i_frame_rate_base; p_context->time_base.num = p_enc->fmt_in.video.i_frame_rate_base;
p_context->time_base.den = p_enc->fmt_in.video.i_frame_rate; p_context->time_base.den = p_enc->fmt_in.video.i_frame_rate;
if( p_codec->supported_framerates )
{
AVRational target = {
.num = p_enc->fmt_in.video.i_frame_rate,
.den = p_enc->fmt_in.video.i_frame_rate_base,
};
int idx = av_find_nearest_q_idx(target, p_codec->supported_framerates);
p_context->time_base.num = p_codec->supported_framerates[idx].den;
p_context->time_base.den = p_codec->supported_framerates[idx].num;
}
/* Defaults from ffmpeg.c */ /* Defaults from ffmpeg.c */
p_context->qblur = 0.5; p_context->qblur = 0.5;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment