| @@ -55,6 +55,7 @@ static const char *const opt_name_codec_names[] = {"c", "codec", " · 54 unmodified lines |
| 55 | static const char *const opt_name_audio_channels[] = {"ac", NULL}; | 55 | static const char *const opt_name_audio_channels[] = {"ac", NULL}; |
| 56 | static const char *const opt_name_audio_sample_rate[] = {"ar", NULL}; | 56 | static const char *const opt_name_audio_sample_rate[] = {"ar", NULL}; |
| 57 | static const char *const opt_name_frame_rates[] = {"r", NULL}; | 57 | static const char *const opt_name_frame_rates[] = {"r", NULL}; |
| | 58 | static const char *const opt_name_max_frame_rates[] = {"fpsmax", NULL}; |
| 58 | static const char *const opt_name_frame_sizes[] = {"s", NULL}; | 59 | static const char *const opt_name_frame_sizes[] = {"s", NULL}; |
| 59 | static const char *const opt_name_frame_pix_fmts[] = {"pix_fmt", NULL}; | 60 | static const char *const opt_name_frame_pix_fmts[] = {"pix_fmt", NULL}; |
| 60 | static const char *const opt_name_ts_scale[] = {"itsscale", NULL}; | 61 | static const char *const opt_name_ts_scale[] = {"itsscale", NULL}; |
| @@ -1688,7 +1689,7 @@ static OutputStream *new_video_stream(OptionsContext *o, AVFormatContext *oc, in · 1627 unmodified lines |
| 1688 | AVStream *st; | 1689 | AVStream *st; |
| 1689 | OutputStream *ost; | 1690 | OutputStream *ost; |
| 1690 | AVCodecContext *video_enc; | 1691 | AVCodecContext *video_enc; |
| 1691 | char *frame_rate = NULL, *frame_aspect_ratio = NULL; | 1692 | char *frame_rate = NULL, *max_frame_rate = NULL, *frame_aspect_ratio = NULL; |
| 1692 | | 1693 | |
| 1693 | ost = new_output_stream(o, oc, AVMEDIA_TYPE_VIDEO, source_index); | 1694 | ost = new_output_stream(o, oc, AVMEDIA_TYPE_VIDEO, source_index); |
| 1694 | st = ost->st; | 1695 | st = ost->st; |
| @@ -1699,8 +1700,21 @@ static OutputStream *new_video_stream(OptionsContext *o, AVFormatContext *oc, in · 4 unmodified lines |
| 1699 | av_log(NULL, AV_LOG_FATAL, "Invalid framerate value: %s\n", frame_rate); | 1700 | av_log(NULL, AV_LOG_FATAL, "Invalid framerate value: %s\n", frame_rate); |
| 1700 | exit_program(1); | 1701 | exit_program(1); |
| 1701 | } | 1702 | } |
| 1702 | if (frame_rate && video_sync_method == VSYNC_PASSTHROUGH) | 1703 | |
| 1703 | av_log(NULL, AV_LOG_ERROR, "Using -vsync 0 and -r can produce invalid output files\n"); | 1704 | MATCH_PER_STREAM_OPT(max_frame_rates, str, max_frame_rate, oc, st); |
| | 1705 | if (max_frame_rate && av_parse_video_rate(&ost->max_frame_rate, max_frame_rate) < 0) { |
| | 1706 | av_log(NULL, AV_LOG_FATAL, "Invalid maximum framerate value: %s\n", max_frame_rate); |
| | 1707 | exit_program(1); |
| | 1708 | } |
| | 1709 | |
| | 1710 | if (frame_rate && max_frame_rate) { |
| | 1711 | av_log(NULL, AV_LOG_ERROR, "Only one of -fpsmax and -r can be set for a stream.\n"); |
| | 1712 | exit_program(1); |
| | 1713 | } |
| | 1714 | |
| | 1715 | if ((frame_rate || max_frame_rate) && |
| | 1716 | video_sync_method == VSYNC_PASSTHROUGH) |
| | 1717 | av_log(NULL, AV_LOG_ERROR, "Using -vsync 0 and -r/-fpsmax can produce invalid output files\n"); |
| 1704 | | 1718 | |
| 1705 | MATCH_PER_STREAM_OPT(frame_aspect_ratios, str, frame_aspect_ratio, oc, st); | 1719 | MATCH_PER_STREAM_OPT(frame_aspect_ratios, str, frame_aspect_ratio, oc, st); |
| 1706 | if (frame_aspect_ratio) { | 1720 | if (frame_aspect_ratio) { |
| @@ -3599,6 +3613,9 @@ const OptionDef options[] = { · 1892 unmodified lines |
| 3599 | { "r", OPT_VIDEO | HAS_ARG | OPT_STRING | OPT_SPEC | | 3613 | { "r", OPT_VIDEO | HAS_ARG | OPT_STRING | OPT_SPEC | |
| 3600 | OPT_INPUT | OPT_OUTPUT, { .off = OFFSET(frame_rates) }, | 3614 | OPT_INPUT | OPT_OUTPUT, { .off = OFFSET(frame_rates) }, |
| 3601 | "set frame rate (Hz value, fraction or abbreviation)", "rate" }, | 3615 | "set frame rate (Hz value, fraction or abbreviation)", "rate" }, |
| | 3616 | { "fpsmax", OPT_VIDEO | HAS_ARG | OPT_STRING | OPT_SPEC | |
| | 3617 | OPT_OUTPUT, { .off = OFFSET(max_frame_rates) }, |
| | 3618 | "set max frame rate (Hz value, fraction or abbreviation)", "rate" }, |
| 3602 | { "s", OPT_VIDEO | HAS_ARG | OPT_SUBTITLE | OPT_STRING | OPT_SPEC | | 3619 | { "s", OPT_VIDEO | HAS_ARG | OPT_SUBTITLE | OPT_STRING | OPT_SPEC | |
| 3603 | OPT_INPUT | OPT_OUTPUT, { .off = OFFSET(frame_sizes) }, | 3620 | OPT_INPUT | OPT_OUTPUT, { .off = OFFSET(frame_sizes) }, |
| 3604 | "set frame size (WxH or abbreviation)", "size" }, | 3621 | "set frame size (WxH or abbreviation)", "size" }, |