Commit ca07c9bf authored by Laurent Aimar's avatar Laurent Aimar Committed by Jean-Baptiste Kempf

Used the nearest available frame rate in avcodec encoder.

It fixes #1965.
(cherry picked from commit bbc85f4b6db94f5d5c81d6e98c43d42931f846ef)
Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent 128896a7
...@@ -404,6 +404,17 @@ int OpenEncoder( vlc_object_t *p_this ) ...@@ -404,6 +404,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