Skip to main content

Notice

If you are using a Hotmail or Outlook email address, please change it now, as Microsoft is rejecting all email from our service outright.
Topic: How to pipe SoX to LAME (Read 326 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

How to pipe SoX to LAME

Hi,

I'm trying to convert 24-bit, 48+ kHz FLAC to 44.1 kHz MP3 V0. I want to use SoX to resample before invoking LAME as suggested here, and I'm lost on how to do so. I believe LAME requires a PCM input as mentioned here. I think my closest attempt has been:
Code: [Select]
sox.exe input.flac -t wav - rate 44100 | lame.exe - -V 0 output.mp3
which results in:
Code: [Select]
Unsupported data format: 0x3F3F
Can't init infile '-'
from LAME. I've also tried:
  • `-t wavpcm` for SoX output, which is accepted by LAME, but results in garbage.
  • trying to match raw output/input between SoX and LAME:
    Code: [Select]
    sox.exe input.flac -t raw -c 2 -e signed-integer -L - rate 44100 | lame.exe -r -s 44.1 --bitwidth 24 --signed --little-endian - -V 0 output.mp3
    which produces different garbage.

I'm not very familiar with audio processing. What's a correct way to do this?

Thanks.

Re: How to pipe SoX to LAME

Reply #1
Code: [Select]
sox -V3 -G 2448.flac -t wav -r 44100 - | lame -V 0 - 44k.mp3
sox:      SoX v14.4.2
sox INFO formats: detected file format type `flac'

Input File     : '2448.flac'
Channels       : 2
Sample Rate    : 48000
Precision      : 24-bit
Duration       : 00:00:19.78 = 949519 samples ~ 1483.62 CDDA sectors
File Size      : 1.36M
Bit Rate       : 549k
Sample Encoding: 24-bit FLAC
Endian Type    : little
Reverse Nibbles: no
Reverse Bits   : no


Output File    : '-' (wav)
Channels       : 2
Sample Rate    : 44100
Precision      : 24-bit
Duration       : 00:00:19.78 = 872370 samples = 1483.62 CDDA sectors
Sample Encoding: 24-bit Signed Integer PCM
Endian Type    : little
Reverse Nibbles: no
Reverse Bits   : no
Comment        : 'Processed by SoX'

sox INFO sox: effects chain: input        48000Hz  2 channels
sox INFO sox: effects chain: gain         48000Hz  2 channels
sox INFO sox: effects chain: rate         44100Hz  2 channels
sox INFO sox: effects chain: gain         44100Hz  2 channels
sox INFO sox: effects chain: output       44100Hz  2 channels
sox INFO gain: 0.578dB not reclaimed
LAME 3.100.1 32bits (http://lame.sf.net)
CPU features: MMX (ASM used), SSE (ASM used), SSE2
polyphase lowpass filter disabled
Encoding <stdin> to 44k.mp3
Encoding as 44.1 kHz j-stereo MPEG-1 Layer III VBR(q=0)


Re: How to pipe SoX to LAME

Reply #2
Or, you could use lamedropXPd3, available in 32 and 64 bit flavours, which uses the SoX resampling libarary, always assuming you're on Windows. ;)

Re: How to pipe SoX to LAME

Reply #3
Solved. I feel bad - I'm not a Windows CLI person and was using PowerShell, which apparently pipes objects. I tried it on Linux, and it worked fine, which then made me try it with cmd. Glad I had the usage right.

john33 - thanks, but this will end up as a foobar2000 preset.


 

Re: How to pipe SoX to LAME

Reply #5
I'm aware - I want to be comfortable with the more hands-on, exposed process before I use that.

 
SimplePortal 1.0.0 RC1 © 2008-2020