A few commans:
ffmpeg -i f:\ogg_tracks\track01.ogg -acodec libmp3lame -ac 2 -ar 22500 -ab 128k -vol 256 g:\var\temp\track01.mp3
And that my friends, can easily be turned into a REXX script. See CDRWs notes below for the important parameters and descriptions...
Then it's simply a REXX script, create an icon and name something like "OGG to MP3" and you are up and running.
You can use things like the substr(), lastpos(), mkdir() and directory() statements to read and change the in/out directories, and so on. You can also have the script pop up a window asking for the sample rate and bitrate before the encoding happens. You can even stick that "asking" in a timed loop that defaults to a certain value. Then, the "execution" string simply becomes something like:
'ffmpeg -i 'OGGFILENAME' -acodec libmp3lame -ac 2 -ar 'SAMPLERATE' -ab 'strip(BITRATE)'k -vol 256 'MP3FILENAME
Then simply open the OGG template (create one in the templates folder if you dont have one), and assign the "OGG to MP3" icon to it's pop-up menu.
The whole script can be as simple as:
/* OGG to MP3 */
Parse Arg OggFileName
SAMPLERATE=22500 /* CHANGE AS NEEDED */
BITRATE=128 /* CHANGE AS NEEDED */
/* CREATE CODE TO REQUEST SAMPLE RATE AND CHECK FOR KEYBOARD INPUT ON TIMED LOOP - USE DEFAULTS IF NOTHING TYPED BY END OF LOOP */
/* CREATE CODE TO REQUEST BIT RATE AND CHECK FOR KEYBOARD INPUT ON TIMED LOOP - USE DEFAULTS IF NOTHING TYPED BY END OF LOOP */
/* Create MP3 file name by simply changing the extension - this will leave the file name and path identical to original */
/* Note: this won't work if source file is on a DVD or CD. A simple test to determine local disks, match drive letter of source file and change */
/* from CD/DVD to HDD (dont forget to create directories) is really easy to add to this */
MP3FileName=SubStr(OggFileName,1,LastPos(translate(OggFileName),".OGG"))||"mp3"
/* Ensure that ffmpeg's directory is in the PATH statement someplace */
/* Use commands such as Directory and/or MkDir() (<--- important one) to enhance this script for such things as */
/* Creating different output directories such as "\OriginalPath\MP3_File\" or writing to a "Music" folder or whatever */
/* Otherwise, as coded below, MP3 file will be created in same directory */
'ffmpeg -i 'OGGFILENAME' -acodec libmp3lame -ac 2 -ar 'SAMPLERATE' -ab 'strip(BITRATE)'k -vol 256 'MP3FILENAME
The code to change the sample rate is very simple... display choices (ie: (1) 22500, (2) 44100, (3) 48000), create a loop, iterate it x number of times, check for input each time (and IF input detected, assign to a varand leave loop), sleep a second, after loop exit (whether because it has finished iterating or it has reached the "leave" statement) check the var... if it is 1-3, change sample rate accordingly - otherwise, leave sample rate the same (as defined above).
Repeat for bitrate.
Alternatively, one can specify options instead (such as SR44100BR128) in the parameters section for the icon, and have the script parse those as well to set those values.
Or, one can have a bunch of special purpose variants of the script or icons set up such as "OGG to MP3 at 44100/128" and "OGG to MP3 at 22500/128" etc. Then add them all to the OGG template's pop-up menu.
I regularly convert FLV to MPG, and VOB to FLV using the method above
And yes, thusly, this works with any formats that ffMPEG - or mEncoder for that matter, understand - which is mostly any format there is.