sox-users@lists.sourceforge.net unofficial mirror
 help / color / Atom feed
From: Martin Ratinaud <martinratinaud@gmail.com>
To: Måns Rullgård <mans@mansr.com>
Cc: sox-users@lists.sourceforge.net
Subject: Re: Wav to Mp3 leads to an mp3 file that has a longer duration
Date: Mon, 16 Dec 2019 17:36:40 +0400
Message-ID: <CAKy7tYhqcVhahGdbsZEwxrcBw_N0RAt7-CSZcoBUHqwC=LB7hg@mail.gmail.com> (raw)
In-Reply-To: <yw1xmubswg7r.fsf@mansr.com>

[-- Attachment #1.1: Type: text/plain, Size: 3233 bytes --]

Ok, thanks.

But would it be possible to
- add silence samples at the end of the wav file so that is is a multiple
of 1152
- convert it to an mp3
- and get the exact same number of samples with no change between wav
duration and mp3 duration

Because I just test with a wav file that is 8640000 samples = 7500 * 1152
and when I convert it to an mp3, I get 8641152 samples

Thanks again for your insights


-----------------------------------------------------------------------
*Martin RATINAUD*
-----------------------------------------------------------------------


On Mon, Dec 16, 2019 at 5:30 PM Måns Rullgård <mans@mansr.com> wrote:

> Martin Ratinaud <martinratinaud@gmail.com> writes:
>
> > Hi Måns and thanks very much
> >
> > Though it seems the resulting file is 7939544 samples
> >
> > and 7939544 / 1152 = 6891.965277777777
> >
> > So it's not a multiple of 1152 unless I'm missing something ?
>
> That difference is due to a rounding error in the stream length
> calculation.
>
> > On Mon, Dec 16, 2019 at 3:48 PM Måns Rullgård <mans@mansr.com> wrote:
> >
> >> Martin Ratinaud <martinratinaud@gmail.com> writes:
> >>
> >> > 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
> >> >
> >> > If I try to launch `sox -V vocals.mp3 vocals-trimmed.mp3 trim 1544s`
> it
> >> > does not work
> >>
> >> MP3 files have to have a multiple of 1152 samples.  This can't be
> >> avoided.  If the input isn't such a multiple, it will be padded by the
> >> encoder.
> >>
> >>
> >
> > _______________________________________________
> > Sox-users mailing list
> > Sox-users@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/sox-users
> >
>
> --
> Måns Rullgård
>

[-- Attachment #1.2: Type: text/html, Size: 5190 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



[-- Attachment #3: Type: text/plain, Size: 158 bytes --]

_______________________________________________
Sox-users mailing list
Sox-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sox-users

  reply index

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-11 14:26 Martin Ratinaud
2019-12-11 17:18 ` Jeremy Nicoll - ml sox users
2019-12-12  4:18   ` Martin Ratinaud
2019-12-12 17:05     ` Jeremy Nicoll - ml sox users
2019-12-16  5:10       ` Martin Ratinaud
2019-12-16 11:48 ` Måns Rullgård
2019-12-16 12:02   ` Martin Ratinaud
2019-12-16 13:30     ` Måns Rullgård
2019-12-16 13:36       ` Martin Ratinaud [this message]
2019-12-16 17:44         ` Måns Rullgård
2019-12-17 10:04           ` Martin Ratinaud
2019-12-17 10:50             ` Måns Rullgård
2019-12-18  4:00               ` Martin Ratinaud
2019-12-18  7:43                 ` Mikko Olkkonen
2019-12-18  9:06                   ` Martin Ratinaud
2019-12-19  9:52                     ` Mikko Olkkonen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://lists.sourceforge.net/lists/listinfo/sox-users

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAKy7tYhqcVhahGdbsZEwxrcBw_N0RAt7-CSZcoBUHqwC=LB7hg@mail.gmail.com' \
    --to=sox-users@lists.sourceforge.net \
    --cc=mans@mansr.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

sox-users@lists.sourceforge.net unofficial mirror

Archives are clonable: git clone --mirror https://public-inbox.org/sox-users

Example config snippet for mirrors

Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.audio.sox
	nntp://ou63pmih66umazou.onion/inbox.comp.audio.sox
	nntp://news.gmane.io/gmane.comp.audio.sox

 note: .onion URLs require Tor: https://www.torproject.org/

AGPL code for this site: git clone https://public-inbox.org/public-inbox.git