From a96027d3fec2fb8442421553225a0bc52d0d681e Mon Sep 17 00:00:00 2001 From: kramm Date: Wed, 3 Dec 2003 19:24:21 +0000 Subject: [PATCH] Applied patch from Marcus Doemling- -r now set's the samplerate to use for mp3 encoding. --- avi2swf/avi2swf.cc | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/avi2swf/avi2swf.cc b/avi2swf/avi2swf.cc index be11eba..29d65af 100644 --- a/avi2swf/avi2swf.cc +++ b/avi2swf/avi2swf.cc @@ -72,6 +72,7 @@ static int keyframe_interval = -1; static int skip = 0; static float audio_adjust = 0; static int mp3_bitrate = 32; +static int samplerate = 11025; struct options_t options[] = { @@ -80,6 +81,7 @@ struct options_t options[] = {"o","output"}, {"p","flip"}, {"m","mp3-bitrate"}, + {"r","mp3-samplerate"}, {"q","quality"}, {"s","scale"}, {"S","skip"}, @@ -131,6 +133,21 @@ int args_callback_option(char*name,char*val) mp3_bitrate = atoi(val); return 0; } + else if(!strcmp(name, "r")) { + samplerate = atoi(val); + if(samplerate >= 11000 && samplerate <= 12000) + samplerate = 11025; + else if(samplerate >= 22000 && samplerate <= 23000) + samplerate = 22050; + else if(samplerate >= 44000 && samplerate <= 45000) + samplerate = 44100; + else { + fprintf(stderr, "Invalid samplerate: %d\n", samplerate); + fprintf(stderr, "Allowed values: 11025, 22050, 44100\n", samplerate); + exit(1); + } + return 1; + } else if(!strcmp(name, "S")) { skip = atoi(val); return 1; @@ -157,7 +174,8 @@ void args_callback_usage(char*name) printf("\t-o , --output filename\t Specify output filename\n"); printf("\t-A , --adjust seconds\t Audio adjust: Shift sound -seconds to the future or +seconds into the past.\n"); printf("\t-n , --num frames\t Number of frames to encode\n"); - printf("\t-m , --mp3-bitrate \t Set the mp3 bitrate to encode audio with\n"); + printf("\t-m , --mp3-bitrate (kbps)\t Set the mp3 bitrate to encode audio with\n"); + printf("\t-r , --mp3-samplerate (Hz)\t Set the mp3 samplerate to encode audio with (default: 11025)\n"); printf("\t-d , --scale \t Scale down to factor . (in %, e.g. 100 = original size)\n"); printf("\t-p , --flip\t\t Turn movie upside down\n"); printf("\t-q , --quality \t Set the quality to . (0-100, 0=worst, 100=best, default:80)\n"); @@ -517,6 +535,7 @@ int main (int argc,char ** argv) v2swf_setparameter(&v2swf, "blockdiff", "0"); v2swf_setparameter(&v2swf, "blockdiff_mode", "exact"); v2swf_setparameter(&v2swf, "mp3_bitrate", itoa(mp3_bitrate)); + v2swf_setparameter(&v2swf, "samplerate", itoa(samplerate)); //v2swf_setparameter(&v2swf, "fixheader", "1"); //v2swf_setparameter(&v2swf, "framerate", "15"); v2swf_setparameter(&v2swf, "scale", ftoa(scale)); -- 1.7.10.4