[FFmpeg-cvslog] ffmpeg: fix -b -ab mixes with -b overriding the audio bitrate

Michael Niedermayer git at videolan.org
Mon Sep 26 21:22:19 CEST 2011


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Mon Sep 26 20:35:48 2011 +0200| [1edf33f7f26c6538ee6bdc479a78bb7cdcb6c3c9] | committer: Michael Niedermayer

ffmpeg: fix -b -ab mixes with -b overriding the audio bitrate

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1edf33f7f26c6538ee6bdc479a78bb7cdcb6c3c9
---

 ffmpeg.c                  |   10 ++++++++++
 tests/codec-regression.sh |    2 +-
 2 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/ffmpeg.c b/ffmpeg.c
index 9bf4f88..baa9b46 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -4160,6 +4160,15 @@ static int opt_old2new(OptionsContext *o, const char *opt, const char *arg)
     return parse_option(o, s, arg, options);
 }
 
+static int opt_bitrate(OptionsContext *o, const char *opt, const char *arg)
+{
+    if(!strcmp(opt, "b")){
+        av_log(0,AV_LOG_WARNING, "Please use -b:a or -b:v, -b is ambigous\n");
+        return parse_option(o, av_strdup("b:v"), arg, options);
+    }
+    return opt_default(opt, arg);
+}
+
 static int opt_video_filters(OptionsContext *o, const char *opt, const char *arg)
 {
     return parse_option(o, "filter:v", arg, options);
@@ -4259,6 +4268,7 @@ static const OptionDef options[] = {
     { "force_fps", OPT_BOOL | OPT_EXPERT | OPT_VIDEO | OPT_SPEC, {.off = OFFSET(force_fps)}, "force the selected framerate, disable the best supported framerate selection" },
     { "streamid", HAS_ARG | OPT_EXPERT | OPT_FUNC2, {(void*)opt_streamid}, "set the value of an outfile streamid", "streamIndex:value" },
     { "force_key_frames", OPT_STRING | HAS_ARG | OPT_EXPERT | OPT_VIDEO | OPT_SPEC, {.off = OFFSET(forced_key_frames)}, "force key frames at specified timestamps", "timestamps" },
+    { "b", HAS_ARG | OPT_VIDEO | OPT_FUNC2, {(void*)opt_bitrate}, "video bitrate (please use -b:v)", "bitrate" },
 
     /* audio options */
     { "aframes", HAS_ARG | OPT_AUDIO | OPT_FUNC2, {(void*)opt_audio_frames}, "set the number of audio frames to record", "number" },
diff --git a/tests/codec-regression.sh b/tests/codec-regression.sh
index cffe243..3665b12 100755
--- a/tests/codec-regression.sh
+++ b/tests/codec-regression.sh
@@ -300,7 +300,7 @@ do_audio_encoding ac3.rm "-vn -acodec ac3_fixed"
 fi
 
 if [ -n "$do_g726" ] ; then
-do_audio_encoding g726.wav "-b 32k -ac 1 -ar 8000 -acodec g726"
+do_audio_encoding g726.wav "-b:a 32k -ac 1 -ar 8000 -acodec g726"
 do_audio_decoding
 fi
 



More information about the ffmpeg-cvslog mailing list