From: Jan S. <ha...@st...> - 2011-05-20 11:30:30
|
> > On my installation, the following works > > (where the output of faad is indeed of the specified format > > - edit for your format): > > > > faad -q -w in.mp4 | sox -V -t raw -r 44100 -b 16 -c 2 -e signed - out.wav > > I think there is a subtle problem with this because faad emits MS wav > pcm. Interpreting that as raw would mix wav meta data with the audio. > The right enchantment (according to faad(1)) then becomes: > > faad -w -f 2 in.mp4 | sox -V -t raw -r 44100 -b 16 -c 2 -e signed - out.wav Yes, you are right. 'faad -w' writes a WAV file to stdout, while 'faad -f2' writes the raw data to stdout. $ file in.mp4 in.mp4: ISO Media, MPEG v4 system, version 2 $ faad -w in.mp4 > out.wav $ file out.wav out.wav: RIFF (little-endian) data, WAVE audio, Microsoft PCM, 16 bit, stereo 44100 Hz $ soxi out.wav Input File : 'out.wav' Channels : 2 Sample Rate : 44100 Precision : 16-bit Sample Encoding: 16-bit Signed Integer PCM So it is really a WAV that goes to stdout, and sox correctly recognizes it: hans@mac:~$ faad -w in.mp4 | sox -V - out.wav *********** Ahead Software MPEG-4 AAC Decoder V2.7 ****************** Build: Sep 9 2010 Copyright 2002-2004: Ahead Software AG http://www.audiocoding.com Floating point version This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License. ************************************************************************** in.mp4 file info: LC AAC 2.900 secs, 2 ch, 44100 Hz tool: FAAC 1.28 --------------------- | Config: 2 Ch | --------------------- | Ch | Position | --------------------- | 00 | Left front | | 01 | Right front | --------------------- 0% decoding in.mp4.1% decoding in.mp4.2% decoding in.mp4.3% decoding in.mp4.4% decoding in.mp4.5% decoding in.mp4.6% decoding in.mp4.sox: SoX v14.3.2 sox INFO formats: detected file format type `wav' Input File : '-' (wav) Channels : 2 Sample Rate : 44100 Precision : 16-bit Sample Encoding: 16-bit Signed Integer PCM Endian Type : little Reverse Nibbles: no Reverse Bits : no sox INFO sox: Overwriting `out.wav' Output File : 'out.wav' Channels : 2 Sample Rate : 44100 Precision : 16-bit Sample Encoding: 16-bit Signed Integer PCM Endian Type : little Reverse Nibbles: no Reverse Bits : no Comment : 'Processed by SoX' sox INFO sox: effects chain: input 44100Hz 2 channels sox INFO sox: effects chain: output 44100Hz 2 channels What puzzles me is that the out.wav so produced is incorrect; namely, the header does not even include a duration. After doing $ sox --ignore-length out.wav good.wav the resulting good.wav is a correct WAV file, with the correct duration stored in the header. Also, if I explicitly tell sox about the stdin format $ faad -w in.mp4 | sox -V -t raw -r 44100 -e signed -b 16 -c 2 - out.wav (which is WRONG, because the '-' is not raw, it's a WAV) then the out.wav so produced is correct. Jan |