Commit 066a81a8 authored by Benoit Fouet's avatar Benoit Fouet Committed by Guillaume Poirier

change management of "ab" option in ffmpeg.c, so that it works as "b" option.

patch by Benoit Fouet % benoit P fouet A purplelabs P com %
Original thread:
Subj: [Ffmpeg-devel] [PATCH] use new way to handle "ab" option
Date: 03/03/2007 10:51 PM

Originally committed as revision 8244 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent c544ded6
......@@ -137,7 +137,6 @@ static int qp_hist = 0;
static int intra_only = 0;
static int audio_sample_rate = 44100;
static int audio_bit_rate = 64000;
#define QSCALE_NONE -99999
static float audio_qscale = QSCALE_NONE;
static int audio_disable = 0;
......@@ -2323,11 +2322,6 @@ static void opt_thread_count(const char *arg)
#endif
}
static void opt_audio_bitrate(const char *arg)
{
audio_bit_rate = atoi(arg) * 1000;
}
static void opt_audio_rate(const char *arg)
{
audio_sample_rate = atoi(arg);
......@@ -2906,7 +2900,6 @@ static void new_audio_stream(AVFormatContext *oc)
codec_id = audio_codec_id;
audio_enc->codec_id = codec_id;
audio_enc->bit_rate = audio_bit_rate;
if (audio_qscale > QSCALE_NONE) {
audio_enc->flags |= CODEC_FLAG_QSCALE;
audio_enc->global_quality = st->quality = FF_QP2LAMBDA * audio_qscale;
......@@ -3392,7 +3385,7 @@ static void opt_target(const char *arg)
opt_default("minrate", "1150000");
opt_default("bufsize", "327680"); // 40*1024*8;
audio_bit_rate = 224000;
opt_default("ab", "224000");
audio_sample_rate = 44100;
audio_channels = 2;
......@@ -3422,7 +3415,7 @@ static void opt_target(const char *arg)
opt_default("flags", "+SCAN_OFFSET");
audio_bit_rate = 224000;
opt_default("ab", "224000");
audio_sample_rate = 44100;
opt_default("packetsize", "2324");
......@@ -3445,7 +3438,7 @@ static void opt_target(const char *arg)
opt_default("packetsize", "2048"); // from www.mpucoder.com: DVD sectors contain 2048 bytes of data, this is also the size of one pack.
opt_default("muxrate", "10080000"); // from mplex project: data_rate = 1260000. mux_rate = data_rate * 8
audio_bit_rate = 448000;
opt_default("ab", "448000");
audio_sample_rate = 48000;
} else if(!strncmp(arg, "dv", 2)) {
......@@ -3634,7 +3627,6 @@ const OptionDef options[] = {
/* audio options */
{ "aframes", OPT_INT | HAS_ARG | OPT_AUDIO, {(void*)&max_frames[CODEC_TYPE_AUDIO]}, "set the number of audio frames to record", "number" },
{ "ab", HAS_ARG | OPT_AUDIO, {(void*)opt_audio_bitrate}, "set audio bitrate (in kbit/s)", "bitrate", },
{ "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" },
{ "ac", HAS_ARG | OPT_AUDIO, {(void*)opt_audio_channels}, "set number of audio channels", "channels" },
......
......@@ -411,7 +411,7 @@ static const char* context_to_name(void* ptr) {
#define AV_CODEC_DEFAULT_BITRATE 200*1000
static const AVOption options[]={
{"b", "set video bitrate (in bits/s)", OFFSET(bit_rate), FF_OPT_TYPE_INT, AV_CODEC_DEFAULT_BITRATE, INT_MIN, INT_MAX, V|A|E},
{"b", "set bitrate (in bits/s)", OFFSET(bit_rate), FF_OPT_TYPE_INT, AV_CODEC_DEFAULT_BITRATE, INT_MIN, INT_MAX, V|A|E},
{"bt", "set video bitrate tolerance (in bits/s)", OFFSET(bit_rate_tolerance), FF_OPT_TYPE_INT, AV_CODEC_DEFAULT_BITRATE*20, 1, INT_MAX, V|E},
{"flags", NULL, OFFSET(flags), FF_OPT_TYPE_FLAGS, DEFAULT, INT_MIN, INT_MAX, V|A|E|D, "flags"},
{"mv4", "use four motion vector by macroblock (mpeg4)", 0, FF_OPT_TYPE_CONST, CODEC_FLAG_4MV, INT_MIN, INT_MAX, V|E, "flags"},
......
......@@ -114,7 +114,7 @@ fi
# create the data directory if it does not exist
mkdir -p $datadir
FFMPEG_OPTS="-y -flags +bitexact -dct fastint -idct simple"
FFMPEG_OPTS="-y -flags +bitexact -dct fastint -idct simple -ab 64k"
do_ffmpeg()
{
......@@ -192,7 +192,7 @@ do_video_encoding()
do_audio_encoding()
{
file=${outfile}$1
do_ffmpeg $file -y -ab 128 -ac 2 -f s16le -i $pcm_src $3 $file
do_ffmpeg $file -y -ab 128k -ac 2 -f s16le -i $pcm_src $3 $file
}
do_audio_decoding()
......@@ -236,7 +236,7 @@ echo "ffmpeg benchmarks" > $benchfile
###################################
# generate reference for quality check
do_ffmpeg_nocheck $raw_ref -y -f pgmyuv -i $raw_src -an -f rawvideo $raw_ref
do_ffmpeg_nocheck $pcm_ref -y -ab 128 -ac 2 -ar 44100 -f s16le -i $pcm_src -f wav $pcm_ref
do_ffmpeg_nocheck $pcm_ref -y -ab 128k -ac 2 -ar 44100 -f s16le -i $pcm_src -f wav $pcm_ref
###################################
if [ -n "$do_mpeg" ] ; then
......@@ -252,7 +252,7 @@ do_video_encoding mpeg2.mpg "-qscale 10" pgmyuv "-vcodec mpeg2video -f mpeg1vide
do_video_decoding
# mpeg2 encoding intra vlc qprd
do_video_encoding mpeg2ivlc-qprd.mpg "-b 500k -bf 2 -flags +trell+qprd+mv0 -flags2 +ivlc -cmp 2 -subcmp 2 -mbd rd" pgmyuv "-vcodec mpeg2video -f mpeg2video"
do_video_encoding mpeg2ivlc-qprd.mpg "-vb 500k -bf 2 -flags +trell+qprd+mv0 -flags2 +ivlc -cmp 2 -subcmp 2 -mbd rd" pgmyuv "-vcodec mpeg2video -f mpeg2video"
# mpeg2 decoding
do_video_decoding
......@@ -389,7 +389,7 @@ fi
###################################
if [ -n "$do_mp4psp" ] ; then
# mp4 PSP style
do_video_encoding mpeg4-PSP.mp4 "-b 768k -s 320x240" psp "-ar 24000 -ab 32 -i $raw_src"
do_video_encoding mpeg4-PSP.mp4 "-vb 768k -s 320x240" psp "-ar 24000 -ab 32k -i $raw_src"
fi
###################################
......@@ -530,7 +530,7 @@ fi
###################################
if [ -n "$do_g726" ] ; then
# g726
do_audio_encoding g726.wav "-ar 44100" "-ab 32 -ac 1 -ar 8000 -acodec g726"
do_audio_encoding g726.wav "-ar 44100" "-ab 32k -ac 1 -ar 8000 -acodec g726"
do_audio_decoding
fi
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment