Skip to content
Snippets Groups Projects
Commit 9179735a authored by Olivier SOLDANO's avatar Olivier SOLDANO
Browse files

fix mpeg4 video encoding on win32


some devices are providing their framerate ratios in a format
incompatible with FFmpeg encoder.
This patch sanitizes these entries to fit the FFmpeg code.

Change-Id: Ib25c33699749ddcdfdf9cefc853f24caae433609
Reviewed-by: default avatarGuillaume Roguez <guillaume.roguez@savoirfairelinux.com>
parent 7fa8fc41
No related branches found
No related tags found
No related merge requests found
...@@ -530,11 +530,11 @@ void MediaEncoder::prepareEncoderContext(bool is_video) ...@@ -530,11 +530,11 @@ void MediaEncoder::prepareEncoderContext(bool is_video)
encoderCtx_->width = device_.width; encoderCtx_->width = device_.width;
encoderCtx_->height = device_.height; encoderCtx_->height = device_.height;
// satisfy ffmpeg: denominator must be 16bit or less value
// time base = 1/FPS // time base = 1/FPS
encoderCtx_->time_base = AVRational { av_reduce(&encoderCtx_->time_base.den, &encoderCtx_->time_base.num,
(int) device_.framerate.denominator(), device_.framerate.numerator(), device_.framerate.denominator(),
(int) device_.framerate.numerator() (1U << 16) - 1);
};
// emit one intra frame every gop_size frames // emit one intra frame every gop_size frames
encoderCtx_->max_b_frames = 0; encoderCtx_->max_b_frames = 0;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment