ffmpeg: print the low bitrate warning after the codec is openend.
This doesn't access avcodec_opts, so it works with the new options passing system. Makes opt_bitrate() unneeded, so it's removed.
This commit is contained in:
parent
d0fcf39f0c
commit
8d03ca085f
@ -159,8 +159,6 @@ Set the ISO 639 language code (3 letters) of the current subtitle stream.
|
|||||||
@section Video Options
|
@section Video Options
|
||||||
|
|
||||||
@table @option
|
@table @option
|
||||||
@item -b @var{bitrate}
|
|
||||||
Set the video bitrate in bit/s (default = 200 kb/s).
|
|
||||||
@item -vframes @var{number}
|
@item -vframes @var{number}
|
||||||
Set the number of video frames to record.
|
Set the number of video frames to record.
|
||||||
@item -r @var{fps}
|
@item -r @var{fps}
|
||||||
@ -555,8 +553,6 @@ Set the audio sampling frequency. For output streams it is set by
|
|||||||
default to the frequency of the corresponding input stream. For input
|
default to the frequency of the corresponding input stream. For input
|
||||||
streams this option only makes sense for audio grabbing devices and raw
|
streams this option only makes sense for audio grabbing devices and raw
|
||||||
demuxers and is mapped to the corresponding demuxer options.
|
demuxers and is mapped to the corresponding demuxer options.
|
||||||
@item -ab @var{bitrate}
|
|
||||||
Set the audio bitrate in bit/s (default = 64k).
|
|
||||||
@item -aq @var{q}
|
@item -aq @var{q}
|
||||||
Set the audio quality (codec-specific, VBR).
|
Set the audio quality (codec-specific, VBR).
|
||||||
@item -ac @var{channels}
|
@item -ac @var{channels}
|
||||||
|
18
ffmpeg.c
18
ffmpeg.c
@ -2349,6 +2349,9 @@ static int transcode(AVFormatContext **output_files,
|
|||||||
}
|
}
|
||||||
assert_codec_experimental(ost->st->codec, 1);
|
assert_codec_experimental(ost->st->codec, 1);
|
||||||
assert_avoptions(ost->opts);
|
assert_avoptions(ost->opts);
|
||||||
|
if (ost->st->codec->bit_rate && ost->st->codec->bit_rate < 1000)
|
||||||
|
av_log(NULL, AV_LOG_WARNING, "The bitrate parameter is set too low."
|
||||||
|
"It takes bits/s as argument, not kbits/s\n");
|
||||||
extra_size += ost->st->codec->extradata_size;
|
extra_size += ost->st->codec->extradata_size;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2790,18 +2793,6 @@ static int opt_frame_rate(const char *opt, const char *arg)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int opt_bitrate(const char *opt, const char *arg)
|
|
||||||
{
|
|
||||||
int codec_type = opt[0]=='a' ? AVMEDIA_TYPE_AUDIO : AVMEDIA_TYPE_VIDEO;
|
|
||||||
|
|
||||||
opt_default(opt, arg);
|
|
||||||
|
|
||||||
if (av_get_int(avcodec_opts[codec_type], "b", NULL) < 1000)
|
|
||||||
fprintf(stderr, "WARNING: The bitrate parameter is set too low. It takes bits/s as argument, not kbits/s\n");
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int opt_frame_crop(const char *opt, const char *arg)
|
static int opt_frame_crop(const char *opt, const char *arg)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Option '%s' has been removed, use the crop filter instead\n", opt);
|
fprintf(stderr, "Option '%s' has been removed, use the crop filter instead\n", opt);
|
||||||
@ -4290,8 +4281,6 @@ static const OptionDef options[] = {
|
|||||||
{ "copyinkf", OPT_BOOL | OPT_EXPERT, {(void*)©_initial_nonkeyframes}, "copy initial non-keyframes" },
|
{ "copyinkf", OPT_BOOL | OPT_EXPERT, {(void*)©_initial_nonkeyframes}, "copy initial non-keyframes" },
|
||||||
|
|
||||||
/* video options */
|
/* video options */
|
||||||
{ "b", HAS_ARG | OPT_VIDEO, {(void*)opt_bitrate}, "set bitrate (in bits/s)", "bitrate" },
|
|
||||||
{ "vb", HAS_ARG | OPT_VIDEO, {(void*)opt_bitrate}, "set bitrate (in bits/s)", "bitrate" },
|
|
||||||
{ "vframes", OPT_INT | HAS_ARG | OPT_VIDEO, {(void*)&max_frames[AVMEDIA_TYPE_VIDEO]}, "set the number of video frames to record", "number" },
|
{ "vframes", OPT_INT | HAS_ARG | OPT_VIDEO, {(void*)&max_frames[AVMEDIA_TYPE_VIDEO]}, "set the number of video frames to record", "number" },
|
||||||
{ "r", HAS_ARG | OPT_VIDEO, {(void*)opt_frame_rate}, "set frame rate (Hz value, fraction or abbreviation)", "rate" },
|
{ "r", HAS_ARG | OPT_VIDEO, {(void*)opt_frame_rate}, "set frame rate (Hz value, fraction or abbreviation)", "rate" },
|
||||||
{ "s", HAS_ARG | OPT_VIDEO, {(void*)opt_frame_size}, "set frame size (WxH or abbreviation)", "size" },
|
{ "s", HAS_ARG | OPT_VIDEO, {(void*)opt_frame_size}, "set frame size (WxH or abbreviation)", "size" },
|
||||||
@ -4338,7 +4327,6 @@ static const OptionDef options[] = {
|
|||||||
{ "force_key_frames", OPT_STRING | HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void *)&forced_key_frames}, "force key frames at specified timestamps", "timestamps" },
|
{ "force_key_frames", OPT_STRING | HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void *)&forced_key_frames}, "force key frames at specified timestamps", "timestamps" },
|
||||||
|
|
||||||
/* audio options */
|
/* audio options */
|
||||||
{ "ab", HAS_ARG | OPT_AUDIO, {(void*)opt_bitrate}, "set bitrate (in bits/s)", "bitrate" },
|
|
||||||
{ "aframes", OPT_INT | HAS_ARG | OPT_AUDIO, {(void*)&max_frames[AVMEDIA_TYPE_AUDIO]}, "set the number of audio frames to record", "number" },
|
{ "aframes", OPT_INT | HAS_ARG | OPT_AUDIO, {(void*)&max_frames[AVMEDIA_TYPE_AUDIO]}, "set the number of audio frames to record", "number" },
|
||||||
{ "aq", OPT_FLOAT | HAS_ARG | OPT_AUDIO, {(void*)&audio_qscale}, "set audio quality (codec-specific)", "quality", },
|
{ "aq", OPT_FLOAT | HAS_ARG | OPT_AUDIO, {(void*)&audio_qscale}, "set audio quality (codec-specific)", "quality", },
|
||||||
{ "ar", HAS_ARG | OPT_AUDIO, {(void*)opt_audio_rate}, "set audio sampling rate (in Hz)", "rate" },
|
{ "ar", HAS_ARG | OPT_AUDIO, {(void*)opt_audio_rate}, "set audio sampling rate (in Hz)", "rate" },
|
||||||
|
Loading…
x
Reference in New Issue
Block a user