[FFmpeg-devel] Re: [PATCH v2] ffmpeg: add -rmax to clamp output framerate

Anton Khirnov anton at khirnov.net
Wed Feb 3 10:13:29 EET 2021


Quoting Gyan Doshi (2021-02-01 14:22:27)
> @@ -1699,8 +1700,22 @@ static OutputStream *new_video_stream(OptionsContext *o, AVFormatContext *oc, in
>          av_log(NULL, AV_LOG_FATAL, "Invalid framerate value: %s\n", frame_rate);
>          exit_program(1);
>      }
> -    if (frame_rate && video_sync_method == VSYNC_PASSTHROUGH)
> -        av_log(NULL, AV_LOG_ERROR, "Using -vsync 0 and -r can produce invalid output files\n");
> +
> +    MATCH_PER_STREAM_OPT(max_frame_rates, str, max_frame_rate, oc, st);
> +    if (max_frame_rate && av_parse_video_rate(&ost->max_frame_rate, max_frame_rate) < 0) {
> +        av_log(NULL, AV_LOG_FATAL, "Invalid maximum framerate value: %s\n", max_frame_rate);
> +        exit_program(1);
> +    }
> +
> +    if (frame_rate && max_frame_rate) {
> +        av_log(NULL, AV_LOG_WARNING, "-rmax for stream %d:%d will have no effect as"
> +               " -r is also set.\n", ost->file_index, ost->index);
> +        ost->max_frame_rate = (AVRational){0, 1};

Invalid option combinations should be an error.

-- 
Anton Khirnov


More information about the ffmpeg-devel mailing list