Re: Wav to Mp3 leads to an mp3 file that has a longer duration

Jeremy Nicoll - ml sox users <[email protected]>
Newsgroups gmane.comp.audio.sox
Message-ID <[email protected]>
On 2019-12-11 14:26, Martin Ratinaud wrote:
> Hi all,
> 
> I'm converting a file called vocals.wav to vocals.mp3
>  vocals.wav
> <https://drive.google.com/file/d/1he1eCJag1G8iGkgL932jy_mXuLT_khGM/view?usp=drive_web>
> For this I'm using this command
> 
> ```
> sox vocals.wav vocals.mp3
> ```
> and here is the result of the corresponding files
> 
> - original file
> ```
> soxi /Users/martin/Downloads/split-test/vocals.wav
> 
> Input File     : '/Users/martin/Downloads/split-test/vocals.wav'
> Channels       : 2
> Sample Rate    : 44100
> Precision      : 16-bit
> Duration       : 00:03:00.00 = 7938000 samples = 13500 CDDA sectors
> File Size      : 31.8M
> Bit Rate       : 1.41M
> Sample Encoding: 16-bit Signed Integer PCM
> ```
> 
> - converted file
> ```
> soxi /Users/martin/Downloads/split-test/vocals.mp3
> 
> Input File     : '/Users/martin/Downloads/split-test/vocals.mp3'
> Channels       : 2
> Sample Rate    : 44100
> Precision      : 16-bit
> Duration       : 00:03:00.04 = 7939544 samples = 13502.6 CDDA sectors
> File Size      : 2.88M
> Bit Rate       : 128k
> Sample Encoding: MPEG audio (layer I, II or III)
> ```
> 
> You can see that the duration is not the same which is weird and the 
> number
> of samples also changed.
> In fact, 1544 samples have been added to the beginning of the file


Which version of sox, on what OS?
Did you build the sox binary yourself or download it from somewhere?

Although you say the command was just

   sox vocals.wav vocals.mp3

sox can also incorporate values of environment variables.  Is there any
chance that on your OS the command has included any other parameters?
See the 'SOX_OPTS' section of the manual.


If you reissue the command, as eg

   sox -V3 vocals.wav vocals002.mp3

(or even -V4 or more) do any of the info messsages give any clues?  Is 
the
result file the same size as your one?




> If I try to launch `sox -V vocals.mp3 vocals-trimmed.mp3 trim 1544s` it
> does not work

You'll need to be more precise.  What sort of "not work"?   Does sox 
run?
Does it produce any messages?  Is there a result file?  How long was it?


-- 
Jeremy Nicoll - my opinions are my own
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.