My objective is to convert a WAV file to MP3 on 14.04 (64-bit).
The wav file is "Signed 16 bit Little Endian, Rate 16000 Hz, Mono" and is known to good. It plays fine with
aplay, also converts successfully with ffmpeg on OS X.
Thanks to this post, I learned ffmpeg is not part of the standard 14.04 repo, and that
avconv is the replacement.
I installed that with
sudo apt-get install libav-tools
Here's the error with aconv when I try to convert wav to mp3:
user@L114:/tmp$ avconv -i sound_2014-06-01_08-51-31.wav s1.mp3 avconv version 9.13-6:9.13-0ubuntu0.14.04.1, Copyright (c) 2000-2014 the Libav developers built on May 9 2014 13:34:03 with gcc 4.8 (Ubuntu 4.8.2-19ubuntu1) [wav @ 0x150cd40] max_analyze_duration reached Guessed Channel Layout for Input Stream #0.0 : mono Input #0, wav, from 'sound_2014-06-01_08-51-31.wav': Duration: 00:02:55.04, bitrate: 256 kb/s Stream #0.0: Audio: pcm_s16le, 16000 Hz, mono, s16, 256 kb/s Assertion mpah.frame_size >= (32 + 4 + 4 + 4 + 4 + 100) failed at /build/buildd/libav-9.13/libavformat/mp3enc.c:198 Aborted (core dumped)
How may I fix this? Or is this a bug to be logged?
It's not impossible some incompatibilities exist on the box, due to other packages previously installed in attempts to get
pyaudio working. That's what created the wav file.
Any other info needed to help diagnose this?
P.S. Before I learned of avconv this morning, I did manage to download a pre-built version of ffmpeg (as tarball, not an installable package). However, the converted file was no good and sounds like really loud "white noise". I'm including the console output from ffpmeg below, in case this offers any additional clues.
Please know my preference IS to solve this with avconv, since that's the supported go-forward tool.
user@L114:/tmp$ ffmpeg -i sound_2014-06-01_08-51-31.wav s1.mp3 ffmpeg version N-63624-g4ba8560 Copyright (c) 2000-2014 the FFmpeg developers built on May 31 2014 05:37:43 with gcc 4.6 (Debian 4.6.3-1) configuration: --prefix=/root/ffmpeg-static/64bit --extra-cflags='-I/root/ffmpeg-static/64bit/include -static' --extra-ldflags='-L/root/ffmpeg-static/64bit/lib -static' --extra-libs='-lxml2 -lexpat -lfreetype' --enable-static --disable-shared --disable-ffserver --disable-doc --enable-bzlib --enable-zlib --enable-postproc --enable-runtime-cpudetect --enable-libx264 --enable-gpl --enable-libtheora --enable-libvorbis --enable-libmp3lame --enable-gray --enable-libass --enable-libfreetype --enable-libopenjpeg --enable-libspeex --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-version3 --enable-libvpx libavutil 52. 87.100 / 52. 87.100 libavcodec 55. 65.100 / 55. 65.100 libavformat 55. 42.100 / 55. 42.100 libavdevice 55. 13.101 / 55. 13.101 libavfilter 4. 5.100 / 4. 5.100 libswscale 2. 6.100 / 2. 6.100 libswresample 0. 19.100 / 0. 19.100 libpostproc 52. 3.100 / 52. 3.100 Guessed Channel Layout for Input Stream #0.0 : mono Input #0, wav, from 'sound_2014-06-01_08-51-31.wav': Duration: 00:02:55.04, bitrate: 256 kb/s Stream #0:0: Audio: pcm_s16le ( / 0x0001), 16000 Hz, mono, s16, 256 kb/s Output #0, mp3, to 's1.mp3': Metadata: TSSE : Lavf55.42.100 Stream #0:0: Audio: mp3 (libmp3lame), 16000 Hz, mono, s16p Metadata: encoder : Lavc55.65.100 libmp3lame Stream mapping: Stream #0:0 -> #0:0 (pcm_s16le -> libmp3lame) Press [q] to stop, [?] for help size= 513kB time=00:02:55.07 bitrate= 24.0kbits/s video:0kB audio:513kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.042823%
Discovered that ffmpeg is working fine after all. Aquarius Power's suggestion to use mplayer was successful.
I believe my mistake is in expecting aplay to play MP3 files, when my "Available formats:" shows only these:
- U8 - S16_LE - S16_BE - S32_LE - S32_BE - FLOAT_LE - FLOAT_BE - MU_LAW - A_LAW
So ffmpeg DOES WORK, and mplayer DOES PLAY the mp3's.
However, I'd like to focus to getting an answer for the avconv assert problem.
For those wanting sample files, see Dropbox folder avconv :
sound.wav - source wav file of several piano notes & silence avconv_output.txt - console output running avconv avconv.mp3 - 0 byte mp3 output file ffmpeg_output.txt - console output running ffmpeg ffmpeg.mp3 - working ffmpeg mp3 output file