sox for converting flac file to 320 bit mp3
Asked Answered
S

2

12

I have installed sox with support for both mp3 and flac.

The below command also successfully converts flac to mp3

sox /song_files/Daughter_of_Evil.flac /song_files/Daughter_of_Evil.mp3

My problem is that the "Daughter_of_Evil.mp3" is not 320 bit mp3. I tried to specify sampling rate of 44100. But that did not change the bit rate. It stays at 128kbps.

How can I directly generate 320 bit mp3 file for above flac file.

I can convert 128 bit mp3 to 320 bit mp3 using LAME. But the quality is already lost in 128 bit mp3 file generated above. Hence I want it done in single step.

Thanks

Sulk answered 16/8, 2013 at 6:2 Comment(0)
M
17

You are looking for the -C option to SoX:

sox input.flac -C 320 output.mp3
Mcmorris answered 16/8, 2013 at 9:52 Comment(9)
I get this warning: sox WARN mp3: -C option not supported for mp3; using default compression rate How can I enable this. ThanksSulk
@user1058797: What version is this? It should work since SoX 14.3.1.Mcmorris
it is version 14.3.0 I will install 14.3.1 and try it again. Thanks :)Sulk
i configured sox 14.4.1, it didnt have flac. So i installed flac 1.2.1. Now for sox, when I try to run command 'make', i get the error: /var/software/sox_dir/sox-14.4.0/src/flac.c:310: undefined reference to `FLAC__stream_encoder_set_compression_level' and some other FLAC related errors, and it stops with error 1. Any fixes for this? Thanks.Sulk
@user1058797: This is in the linking step, isn't it? It seems static linking is attempted and fails, but it's not clear what is happening.Mcmorris
Not sure what is linking. I am using centos. 'configure' command completes succesfully with support for flac and wav. The 'make' command and 'install' command generates this error. Thanks.Sulk
@user1058797: It seems the FLAC install is not complete. How did you install it? I read that on CentOS, it should be enough to install the flac-devel package via the package manager.Mcmorris
flac-devel installs an older version and it is not detected by sox 14.4.1, so i downloaded it from this link: downloads.sourceforge.net/project/flac/flac-src/flac-1.2.1-src/flac-1.2.1.tar.gz, compiled it and installed it. Then got the error during compilation of sox. Thanks.Sulk
Thank you @Mcmorris ! It took me so long to get this answer for some reason.... really appreciated.Erbil
G
0

Just to add, 128kbps is the standard sox mp3 conversion. Also, if you're encoding from a lower bit rate, it will stay at the lower bit rate unless you explicitly specify a higher rate.

For instance, say File 1 is 320 kbps, sox will convert to 128 kbps

sox file1.mp3 file2.mp3

In this instance, say File 1 is 64kbps, sox will process the conversion, but at the same bit rate:

sox file1.mp3 file2.mp3

In which case, if you need to increase the bit rate, you need to explicitly set the bit rate, as follows:

sox file1.mp3 -C 320 file2.mp3
Gel answered 30/9, 2015 at 1:7 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.