Lame problem encoding MP3 “Warning: unsupported audio format”

July 25th, 2012 | by Sean |

An old site that I’ve been meaning to renovate for too long gave me this problem today. For the first time in a more than a year I tried to upload an audio clip and it didn’t work. What’s supposed to happen is the user uploads images and sounds for flashcards in whatever format they happen to have them in and the server transposes them into a standard format, sanitising them at the same time. The image handling code seemed to work, but I wasn’t getting anything back for the MP3 clip I uploaded.

Frog

Frog

I saw the “Warning: unsupported audio format” in the server logs and immediately decided that I’d forgotten some corner cases of sound formats that just didn’t work. After trying a few different formats, I tried to run the shell script that does the conversion on some of the old uploads (the original media is saved, but not accessible to web clients). Lame gave the same error message for those too.

A search for the warning message led me to this page at unix.com. I needed the –mp3input argument because I save user uploads with a generic name, not their original ‘content-hinting’ extension. The shell script had been working just fine way back when I added the content that’s already there, so perhaps lame’s behaviour has changed in the interim. It’s certainly made explicit in the man documentation:

–mp3input
Assume the input file is a MP3 file.
Useful for downsampling from one mp3 to another.  As an example, it can be useful for streaming through an IceCast server.
If  the  filename  ends in “.mp3” LAME will assume it is an MP3.  For stdin or MP3 files which do not end in .mp3 you need to use this switch.

Post a Comment