Page 1 of 1

FFMPEG and mp3 without separate LAME encoder trick.

Posted: Fri May 07, 2010 6:16 pm
by Goofus Maximus
I've just installed the new beta version of Audacity here, along with the FFMPEG libraries. I was surprised that mp3 encoding still wanted to use the LAME encoding library only, since encoding the mp3 format is one of FFMPEG's specialties, and I thought Audacity would use the second library if the first was not present. Thus, I experimented, and came up with this. I thought I'd share this tip, since I couldn't find anything similar using Google, and this worked for me. (Windows XP SP3. Vista and 7 user's mileage may vary)

I originally tried using the avformat-52.dll in the lame-enc library entry, just like the ffmpeg library entry uses, but that gave me an error, so on a whim, I tried using the libmp3lame-0.dll in place of the lame-enc.dll it wanted, and this worked, Metadata and bitrate options included. It identifies the dll as LAME 3.98.2

Anyhow from preferences -> Libraries, this is what I did:
Image

The only thing where it may not be working correctly, is in the joint-stereo area, since this method makes my test mp3 about twice as large as using the "stereo" option.

Re: FFMPEG and mp3 without separate LAME encoder trick.

Posted: Sat May 08, 2010 11:43 am
by Gale Andrews
Goofus Maximus wrote:I've just installed the new beta version of Audacity here, along with the FFMPEG libraries. I was surprised that mp3 encoding still wanted to use the LAME encoding library only, since encoding the mp3 format is one of FFMPEG's specialties, and I thought Audacity would use the second library if the first was not present. Thus, I [paraphrase] located libmp3lame-0.dll in the FFmpeg installation folder instead of the lame-enc.dll it wanted, and this worked, Metadata and bitrate options included. It identifies the dll as LAME 3.98.2. The only thing where it may not be working correctly, is in the joint-stereo area, since this method makes my test mp3 about twice as large as using the "stereo" option.
Thanks, yes for a power user that may well work. We had discussed using libmp3lame from FFmpeg last year but decided not to make the considerable changes needed because at that time we thought a new 2.0 Release of Audacity was imminent. In any case, until we can make FFmpeg autodetected as LAME is if installed in the correct places - that is, without having to go into preferences to "locate" it - using FFmpeg for mp3 export is a non-starter.

You could also export MP3 without browsing in Preferences for LAME, by choosing "Custom FFmpeg export" in the Export File window, and choosing mp3 in the format list. Looks like that would give you CBR joint stereo though, without the ability to change that.


Gale

Re: FFMPEG and mp3 without separate LAME encoder trick.

Posted: Sat May 08, 2010 1:08 pm
by Goofus Maximus
Is it also somehow technically possible to use an "external" codec like FFDShow? I'm curious now! :)

Re: FFMPEG and mp3 without separate LAME encoder trick.

Posted: Sat May 08, 2010 7:05 pm
by Gale Andrews
Goofus Maximus wrote:Is it also somehow technically possible to use an "external" codec like FFDShow? I'm curious now! :)
Yes in principle, choosing (external program) in the Export File window, which is a command line interface. I'm not 100% sure how to feed it an arbitrary path to the encoder, but if you put your encoder in a "Lame For Audacity" folder in the operating system's "Program Files" directory (i.e. the default location for the Audacity LAME installer), Audacity will see it. For example to use SOX, enter this in the Audacity command line export options:

sox -t wav - "%f"

Then enter the file name and extension required such as "Grandstream_ringtone.bin". And if you use the .dat extension you can save a text file containing a textual representation of the audio (a feature we get asked for quite a lot). That gives you for each sample a) the time since the beginning of the first sample and b) the sample value between 1 and -1.


Gale