mirror of
https://github.com/nyanmisaka/ffmpeg-rockchip.git
synced 2025-10-26 18:30:52 +08:00
ffmpeg: add -fpsmax to clamp output framerate
Useful when encoding in batch or with aberrant inputs.
This commit is contained in:
@@ -3376,7 +3376,7 @@ static int init_output_stream_encode(OutputStream *ost, AVFrame *frame)
|
||||
ost->frame_rate = ist->framerate;
|
||||
if (ist && !ost->frame_rate.num)
|
||||
ost->frame_rate = ist->st->r_frame_rate;
|
||||
if (ist && !ost->frame_rate.num) {
|
||||
if (ist && !ost->frame_rate.num && !ost->max_frame_rate.num) {
|
||||
ost->frame_rate = (AVRational){25, 1};
|
||||
av_log(NULL, AV_LOG_WARNING,
|
||||
"No information "
|
||||
@@ -3386,6 +3386,11 @@ static int init_output_stream_encode(OutputStream *ost, AVFrame *frame)
|
||||
ost->file_index, ost->index);
|
||||
}
|
||||
|
||||
if (ost->max_frame_rate.num &&
|
||||
(av_q2d(ost->frame_rate) > av_q2d(ost->max_frame_rate) ||
|
||||
!ost->frame_rate.den))
|
||||
ost->frame_rate = ost->max_frame_rate;
|
||||
|
||||
if (ost->enc->supported_framerates && !ost->force_fps) {
|
||||
int idx = av_find_nearest_q_idx(ost->frame_rate, ost->enc->supported_framerates);
|
||||
ost->frame_rate = ost->enc->supported_framerates[idx];
|
||||
|
||||
Reference in New Issue
Block a user