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:
Anton Khirnov 2011-07-14 09:38:36 +02:00
parent d0fcf39f0c
commit 8d03ca085f
2 changed files with 3 additions and 19 deletions

View File

@ -159,8 +159,6 @@ Set the ISO 639 language code (3 letters) of the current subtitle stream.
@section Video Options
@table @option
@item -b @var{bitrate}
Set the video bitrate in bit/s (default = 200 kb/s).
@item -vframes @var{number}
Set the number of video frames to record.
@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
streams this option only makes sense for audio grabbing devices and raw
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}
Set the audio quality (codec-specific, VBR).
@item -ac @var{channels}

View File

@ -2349,6 +2349,9 @@ static int transcode(AVFormatContext **output_files,
}
assert_codec_experimental(ost->st->codec, 1);
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;
}
}
@ -2790,18 +2793,6 @@ static int opt_frame_rate(const char *opt, const char *arg)
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)
{
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*)&copy_initial_nonkeyframes}, "copy initial non-keyframes" },
/* 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" },
{ "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" },
@ -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" },
/* 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" },
{ "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" },