About Linux command line

satimis

Member
Joined
Jul 9, 2021
Messages
53
Reaction score
8
Credits
557
Hi all,

I combine multiple .wav files and then convert the output.wav to mp3 running;
$ sox *.wav output.wav | ffmpeg -i ouput.wav -vn -ar 44100 -ac 2 -b:a 192k output.mp3

It works but generating an output.wav file. Please advise how to modify the command line without generating an output.wav file ? I only need output.mp3

Thanks

Regards
 


JasKinasis

Well-Known Member
Joined
Apr 25, 2017
Messages
1,321
Reaction score
1,870
Credits
8,343
Hi all,

I combine multiple .wav files and then convert the output.wav to mp3 running;
$ sox *.wav output.wav | ffmpeg -i ouput.wav -vn -ar 44100 -ac 2 -b:a 192k output.mp3

It works but generating an output.wav file. Please advise how to modify the command line without generating an output.wav file ? I only need output.mp3

Thanks

Regards
I don’t think you can avoid writing the .wav.
Your best bet would simply be to add a command at the end to remove output.wav:
Bash:
sox *.wav output.wav ; ffmpeg -i ouput.wav -vn -ar 44100 -ac 2 -b:a 192k output.mp3; rm output.wav
Note: I replaced the pipe between the sox and the ffmpg commands with a semicolon ; because the pipe wasn’t really doing anything useful.

Also, I’m assuming that you’re using ffmpg to do the conversion because your version of sox doesn’t have mp3 support built in?!

Sox can perform the conversion to mp3, but some distros build their sox package to exclude mp3 support by default.
But you have liblame installed (and it’s development package) plus the rest of sox’s dependencies - you could try building and installing sox from source, which will allow you to add mp3 support to sox.
That way you could use sox for the entire process!
 
Last edited:
OP
S

satimis

Member
Joined
Jul 9, 2021
Messages
53
Reaction score
8
Credits
557
Hi

Thanks for your advice.

Your command line works for me.

$ apt policy liblame
Code:
N: Unable to locate package liblame

$ apt policy lame
Code:
lame:
  Installed: (none)
  Candidate: 3.100-3
  Version table:
     3.100-3 500
        500 http://hk.archive.ubuntu.com/ubuntu focal/universe amd64 Packages
Whether I need to install lame?

Regards
 

JasKinasis

Well-Known Member
Joined
Apr 25, 2017
Messages
1,321
Reaction score
1,870
Credits
8,343
Completely up to you. If Ffmpg works for you, then stick with it.
I was just informing you that if your version of sox does not support converting to mp3, then you can install lame to provide mp3 support.
And if it still doesn’t work, if you have lame installed (and it’s developer package) you can build and install sox from source in order to re-enable its mp3 support!
 
$100 Digital Ocean Credit
Get a free VM to test out Linux!

Members online


Top