PWP wiki processor


| StartPage | WikiPages | AdditionalFiles |
Known Problems


This script was created as a simple tool for converting between several different audio formats under Linux, Unix and Windows (OS X should work, but not tested). Conversion works by converting the input file(s) to an intermediate wav file, optionally normalizing the wav, then writing out the output file with appropriate tag information.

There are lots of other scripts that do similar things, but I created this script to handle wildcards, work recursively, and handle filenames with spaces and other strange characters (question marks, single quotes, double quotes, etc). Hopefully this script saves you some time with file conversion, it should be especialy useful for making mp3 CDs for portable mp3 players. It may look complicated, but its actually quite simple to use; just look at some of the examples and play around with it a bit. Its released under the GNU GPL version 2.

Here's a few other OSS audio manipulation programs that I've found but haven't used:

» GTK and Python based GUI conversion program that uses Gstreamer for conversion of audio formats, very impressive program. Great for those who prefer GUIs. Currently it cannot read wma files.






Mp3gain » is a great program that can adjust the gain of mp3s with a lossless method that doesn't rely on replayGain settings. This is only useful for mp3s however, so its not used by this script. This script uses normalize to normalize the intermediate .wav file before converting to the desired output format.


You must have at least some of the following installed, depending on what you're using the script for (eg: if you're not reading or writing Flac files, you dont need Flac installed). The versions listed were used for testing, but any version with the same functionality should work. All of these programs are available in Debian or Ubuntu Linux. This script has been run under windows, but each dependency must be downloaded and installed (all are available for windows and *nix).



 "./ -h" will display detailed help info and usage.

usage: -i <input> [options] --to-mp3 | --to-ogg | --to-wav | --to-flac

        This script is for conveting from an input audio format to an
        intermediate wav file, then outputting to the selected output
        format while keeping the tag info.  At first this sounds crazy,
        why go from one lossy format to another?  This may be the only
        option for your portable mp3 player.  It is also an easy way to
        convert a music collection from a high quality format (eg: flac
        or wav) to a different format (eg: mp3 or ogg vorbis).

        Optionally works recursively, keeps the tag information, and handles
        filenames with strange characters such as spaces, single quotes, and
        question marks.  It can also output the converted file to a different
        directory, maintaining the directory structure. Most of the other
        wma2ogg or ogg2mp3 scripts fail on these or dont do recursion, which
        is why this script exists.

        Supported input formats:
                rpm RealAudio streams
                rm/ra RealAudio files

        Supported output formats:

        Requires mplayer (for wma), vorbis tools, flac, lame, normalize
        and mp3info.  Note: if there are no tags in the input file, the
        filename will be used as the 'title' tag in the output file.


        This example converts the ogg vorbis file 'foo.ogg' to 'foo.mp3': -i foo.ogg --to-mp3

        This example converts all wma files to ogg vorbis files in a
        directory (not recursive and wont delete the original files): -i "*.wma" --to-ogg

        This command passes a string to the encoder (lame in this case,
        since mp3s are being created), which can be any sort of option
        (variable bitrate, mode, etc).  The option here specifies that
        variable bitrate level 6 is to be used (see encoder documentation
        for more info): -i file.mp3 --to-mp3 --encoder-option "-V 6"

        This dry-run example lists all the files that would be processed,
        but are simply listed instead (an output format is needed, so
        --to-mp3 is chosen though no conversion is done): -i "*.wma" -r --to-mp3 --dry-run

        This command converts all recoginized files to mp3s recursively,
        performs normalization and deletes the original files.  If the
        file doesn't have a recognized extension, then it is skipped. -i "*.*" --to-mp3 --recursive --normalize --delete

        Here is the same command with short options: -i "*.*" --to-mp3 -r -n -d

        This is the same command, but with a different destination directory.
        This will duplicate the directory structure present in the source
        to subdirectories of the destination directory populating it only with
        the converted files. -i "*.*" --to-mp3 -r -n -d --dest-dir /home/user/newdir

  -h, --help            show this help message and exit
  -i INPUT, --input=INPUT
                        Specify input file, accepts wildcards in quotes.
  -b BITRATE, --bitrate=BITRATE
                        Specify bitrate of output file.  Some encoders(eg
                        Lame) will only accept certain values such as 32, 40,
                        48, 56, 64, 80, 96, 112, 128, etc. The default bitrate
                        of the output file is the same as the input bitrate.
                        This option will be ignored if the '--encoder-option'
                        is used.
  -r, --recursive       Convert all files matching the input filename in
                        current directory and all subdirectories.  If using
                        wildcards, they must be in quotes.
  --dry-run             List the path of each input file and output file but
                        do not convert anything.
  --to-ogg              Ogg vorbis output format.
  --to-mp3              Mp3 output format
  --to-wav              Wav output format
  --to-flac             Flac output format
  -n, --normalize       Normalize the volume of output files.
  -d, --delete          Delete the input file after conversion (use with
  -f, --force           Force conversion of files even if the input and output
                        bitrate are the same [default skips these files].
                        Specify a different output directory. This will
                        duplicate the same file and directory structure seen
                        in the source directory, and populate it with
                        converted files. If the destination directory does not
                        exist, it will be created. Works especially well with
                        the recursive option.
  -t PATH, --tempfile=PATH
                        Specify the path for a user defined tempfile. The
                        default tempfile uses a system tempfile.
  -e STRING, --encoder-option=STRING
                        Specify options to be passed to the encoder. May
                        include any option supported by the encoder such as
                        variable bitrate encoding. This option overrides the
                        'bitrate' option, so a custom bitrate or vbr setting
                        should be specified otherwsie the encoder will use its
                        default bitrate. Be careful not to specify tags that
                        may conflict with tags taken from input file. String
                        must be encapsulated by quotes.
  -v, --verbose         Show all standard output and error messages from
                        backend programs.  Default is to hide these messages.


Known Problems

Email: crleblanc at gmail dot com.

   (Powered by PWP Version 1-4-3 )