Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I want to reencode a audiobook for my mobile with speexenc. The first step is to reencode the file with mplayer.

for i in *.mp3; do
    mplayer -ao pcm:waveheader "$i" -af pan=1:0.5:0.5,resample=22050 -ao pcm:file="$i.wav";
done

Is what I found on the internet. But the outfile is not a pcm wav:

file *.wav
RIFF (little-endian) data, WAVE audio, mono 22050 Hz

Where a reference wav from xiph.org is pcm.

file wb_male.wav 
RIFF (little-endian) data, WAVE audio, Microsoft PCM, 16 bit, mono 16000 Hz

speexenc does encode the last PCM WAV, but does not with the mplayer file. Why not? The does the Audiooutput called "pcm" does not ouput a pcm file? How to Fix it? And is there a easy way to pipe the wav directly to speexenc without a named fifo?

share|improve this question
add comment

2 Answers

The MPlayer man page uses this syntax:

mplayer -ao pcm:file=test.wav test.avi

If you want to do things like limiting sampling rate, you can throw on an -srate option (like -srate 44100 for redbook CD audio).

But, if you have it installed, I'd suggest using ffmpeg because it's actually meant for doing these things.

share|improve this answer
    
+1 for ffmpeg. –  Michael Kjörling Sep 27 '11 at 19:05
add comment

The wav file generated by mplayer -ao pcm from an mp3 is in PCM format. It just happens to be floating-point PCM because that's what comes naturally out of the mp3 decoder. file should have told you this, but it doesn't know about the floating-point PCM format.

The mp3 decoder produces float and -ao pcm just writes whatever format it receives, so you need something between them to change the format: the af format filter. For signed 16-bit little-endian (which is what you probably want), -af format=s16le will do it.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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