Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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 ([1][0][0][0] / 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%

========

UPDATE 8-Jun-2014:

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 

Thanks everybody!

share|improve this question

closed as off-topic by bain, Eric Carvalho, Luis Alvarado Jul 25 at 0:15

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Bug reports and problems with the development version of Ubuntu should be reported on Launchpad so that developers can see, track and fix these issues." – bain, Eric Carvalho, Luis Alvarado
If this question can be reworded to fit the rules in the help center, please edit the question.

    
it happens too with Playing Sparc Audio 'audioFile.wav' : Signed 16 bit Big Endian, Rate 16000 Hz, Mono –  Aquarius Power Jun 1 at 19:59
    
try to play your s1.mp3 created with ffmpeg with mplayer, it worked here for mine where aplay failed! –  Aquarius Power Jun 1 at 20:06
    
we can try to understand what went wrong by reading the .c code following this tip to get it: askubuntu.com/questions/75671/… –  Aquarius Power Jun 1 at 20:11
    
play from sox also works where aplay failed! –  Aquarius Power Jun 1 at 20:18
    
Please provide the input file so I can attempt to duplicate the issue with ffmpeg. –  LordNeckbeard Jun 2 at 1:09

1 Answer 1

I just upgraded to 14.04 and ran into the same problem. Adding "-b 256k" fixed it for me (although the resulting MP3 was generated with a 160Kbps bitrate rather than the original 256Kbps rate).

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.