Re: [AUDITORY] Converting audio file from WAV to MP3 changes file duration. Why? (Goran Markovic )


Subject: Re: [AUDITORY] Converting audio file from WAV to MP3 changes file duration. Why?
From:    Goran Markovic  <skromnibog@xxxxxxxx>
Date:    Wed, 15 Nov 2017 11:06:56 +0100
List-Archive:<http://lists.mcgill.ca/scripts/wa.exe?LIST=AUDITORY>

--001a113d7a72e951d7055e02a9c1 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Dear Neeks, G=C3=BCnter, those duration differences can also be handled with a system that includes MP3 coding. Check gapless playback for more information: http://wiki.hydrogenaud.io/index.php?title=3DGapless_playback Cheers, Goran On 15 November 2017 at 09:57, Windau, G.R.W. (G=C3=BCnter) < G.Windau@xxxxxxxx> wrote: > Dear Neeks, > > Your wav audio files can have an arbitrary lenght, depending on the > duration of the audio sample. The mp3 audio file however, is a sequence o= f > frames with a certain length in bytes, and thus also in duration. After > going from wav to mp3 and back, you will see that the the duration of you= r > audio sample has changed. I guess there will be some zero padding or smal= l > conversion artifacts before and after the 'real' audio. > > This may have been designed this way to prevent the introduction of > audible clicks at the beginning and at the end when playing an mp3 file. > > If you need the duration of your audio files to be maintained, mp3 may no= t > be what you want. > > Best wishes, > G=C3=BCnter > > > On 15 Nov 2017, at 08:02, Neeraj Sharma <neerajww@xxxxxxxx> wrote: > > Dear Members, > > An audio file in WAV can be converted to MP3 using following two utilitie= s > in unix terminal (both work, and there may be many more also): > > $ ffmpeg -i <input.wav> -codec:a libmp3lame -b:a 320k <output.mp3> > </dev/null > $ lame -q0 -b128 <input.wav> <output.wav> > > But the issue is that the duration of <output.mp3> is more than duration > of <input.wav>. This is true with other utilities which I have tried, lik= e > sox. Can anyone give insight on: > > a. why the duration is increasing? In the attached image below, the > duration variation is plotted for 410 sound files. The increase in durati= on > appears to be WAV file dependent (although it is within 140ms in this cas= e) > > b. is there option in the above utilities which can reduce this differenc= e > in duration? I haven't been able to figure this out. > > Similar issue has been reported by few others also. > Example: https://www.sweetwater.com/forums/showthread.php?42631 > > Best regards, > Neeks > > > <duration_var_wav_mp3.png> > > > =E2=80=94 > ing. G=C3=BCnter Windau | Technical Support Group | Dept. Biophysics | Do= nders > Institute for Brain, Cognition and Behaviour | Radboud University Nijmege= n > <https://maps.google.com/?q=3DNijmegen%C2%A0%7C%C2%A0Heyendaalseweg%0D+13= 5,+NL-6525AJ&entry=3Dgmail&source=3Dg> > | > <https://maps.google.com/?q=3DNijmegen%C2%A0%7C%C2%A0Heyendaalseweg%0D+13= 5,+NL-6525AJ&entry=3Dgmail&source=3Dg> > Heyendaalseweg 135, NL-6525AJ Nijmegen | room 00.817 | E: > G.Windau@xxxxxxxx | T: +31 24 3613356 <+31%2024%20361%203356> | W: > http://www.mbfys.ru.nl/~gunter > > --001a113d7a72e951d7055e02a9c1 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable <div dir=3D"ltr"><div>Dear Neeks, G=C3=BCnter,</div><div><br></div><div>tho= se duration differences can also be handled with a system that includes MP3= coding.</div><div>Check gapless playback for more information:</div><div><= br></div><a href=3D"http://wiki.hydrogenaud.io/index.php?title=3DGapless_pl= ayback">http://wiki.hydrogenaud.io/index.php?title=3DGapless_playback</a><b= r><div><br></div><div>Cheers,</div><div>Goran</div></div><div class=3D"gmai= l_extra"><br><div class=3D"gmail_quote">On 15 November 2017 at 09:57, Winda= u, G.R.W. (G=C3=BCnter) <span dir=3D"ltr">&lt;<a href=3D"mailto:G.Windau@xxxxxxxx= nders.ru.nl" target=3D"_blank">G.Windau@xxxxxxxx</a>&gt;</span> wrote:= <br><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-lef= t:1px #ccc solid;padding-left:1ex"> <div style=3D"word-wrap:break-word;line-break:after-white-space"> Dear Neeks, <div><br> </div> <div> <div>Your wav audio files can have an arbitrary lenght, depending on the du= ration of the audio sample. The mp3 audio file however, is a sequence of fr= ames with a certain length in bytes, and thus also in duration. After going= from wav to mp3 and back, you will see that the the duration of your audio sample has changed. I guess there = will be some zero padding or small conversion artifacts before and after th= e &#39;real&#39; audio.</div> <div><br> </div> <div>This may have been designed this way to prevent the introduction of au= dible clicks at the beginning and at the end when playing an mp3 file.</div= > <div><br> </div> <div>If you need the duration of your audio files to be maintained, mp3 may= not be what you want.</div> <div><br> </div> <div>Best wishes,</div> <div>G=C3=BCnter</div> <div><br> </div> <div><br> <blockquote type=3D"cite"> <div>On 15 Nov 2017, at 08:02, Neeraj Sharma &lt;<a href=3D"mailto:neerajww= @xxxxxxxx" target=3D"_blank">neerajww@xxxxxxxx</a>&gt; wrote:</div> <br class=3D"m_-8276517321375835458Apple-interchange-newline"> <div> <div dir=3D"ltr">Dear Members,<br> <br> An audio file in WAV can be converted to MP3 using following two utilities = in unix terminal (both work, and there may be many more also):<br> <br> $ ffmpeg -i &lt;input.wav&gt; -codec:a libmp3lame -b:a 320k &lt;output.mp3&= gt; &lt;/dev/null<br> $ lame -q0 -b128 &lt;input.wav&gt; &lt;output.wav&gt;<br> <br> But the issue is that the duration of &lt;output.mp3&gt; is more than durat= ion of &lt;input.wav&gt;. This is true with other utilities which I have tr= ied, like sox. Can anyone give insight on:<br> <br> <div>a. why the duration is increasing? In the attached image below, the du= ration variation is plotted for 410 sound files. The increase in duration a= ppears to be WAV file dependent (although it is within 140ms in this case)<= br> <br> <div>b. is there option in the above utilities which can reduce this differ= ence in duration?=C2=A0 I haven&#39;t been able to figure this out.<br> <br> Similar issue has been reported by few others also.<br> Example: <a href=3D"https://www.sweetwater.com/forums/showthread.php?42631"= target=3D"_blank"> https://www.sweetwater.com/<wbr>forums/showthread.php?42631</a><br> <br> Best regards,<br> Neeks <div><br> </div> <div><br> </div> </div> </div> </div> <span id=3D"m_-8276517321375835458cid:82310ACF-9C5E-447E-A967-6D688383CBA4@xxxxxxxx= science.ru.nl">&lt;duration_var_wav_mp3.png&gt;</span></div> </blockquote> </div> <br> <div> <div style=3D"text-align:start;text-indent:0px;word-wrap:break-word"> <div><font color=3D"#797979" face=3D"Verdana, sans-serif"><span style=3D"fo= nt-size:11px">=E2=80=94</span></font></div> <div style=3D"color:rgb(0,0,0);letter-spacing:normal;text-transform:none;wh= ite-space:normal;word-spacing:0px"> <span class=3D"m_-8276517321375835458Apple-style-span" style=3D"color:rgb(1= 21,121,121);font-family:Calibri,sans-serif;font-size:15px"><span lang=3D"NL= " style=3D"font-size:8pt;font-family:Verdana,sans-serif">ing. G=C3=BCnter W= indau | Technical Support Group=C2=A0</span></span><span class=3D"m_-827651= 7321375835458Apple-style-span" style=3D"color:rgb(121,121,121);font-family:= Calibri,sans-serif;font-size:15px"><span lang=3D"NL" style=3D"font-size:8pt= ;font-family:Verdana,sans-serif">|</span></span><span style=3D"color:rgb(12= 1,121,121);font-family:Verdana">=C2=A0</span><span class=3D"m_-827651732137= 5835458Apple-style-span" style=3D"color:rgb(121,121,121);font-family:Calibr= i,sans-serif;font-size:15px"><span lang=3D"NL" style=3D"font-size:8pt;font-= family:Verdana,sans-serif">Dept. Biophysics=C2=A0</span></span><span class=3D"m_-8276517321375835458Apple-s= tyle-span" style=3D"color:rgb(121,121,121);font-family:Calibri,sans-serif;f= ont-size:15px"><span lang=3D"NL" style=3D"font-size:8pt;font-family:Verdana= ,sans-serif">|=C2=A0</span></span><span class=3D"m_-8276517321375835458Appl= e-style-span" style=3D"color:rgb(121,121,121);font-family:Verdana,sans-seri= f;font-size:11px">Donders Institute for Brain, Cognition and Behaviour</span><span style=3D"color:rg= b(121,121,121);font-family:Verdana">=C2=A0</span><span class=3D"m_-82765173= 21375835458Apple-style-span" style=3D"color:rgb(121,121,121);font-family:Ca= libri,sans-serif;font-size:15px"><span lang=3D"NL" style=3D"font-size:8pt;f= ont-family:Verdana,sans-serif">|=C2=A0</span></span><span class=3D"m_-82765= 17321375835458Apple-style-span" style=3D"color:rgb(121,121,121);font-family= :Calibri,sans-serif;font-size:15px"><span lang=3D"NL" style=3D"font-size:8p= t;font-family:Verdana,sans-serif">Radboud</span></span><span class=3D"m_-82= 76517321375835458Apple-style-span" style=3D"color:rgb(121,121,121);font-fam= ily:Calibri,sans-serif;font-size:15px"><span lang=3D"NL" style=3D"font-size= :8pt;font-family:Verdana,sans-serif">=C2=A0University <a href=3D"https://maps.google.com/?q=3DNijmegen%C2%A0%7C%C2%A0Heyendaalse= weg%0D+135,+NL-6525AJ&amp;entry=3Dgmail&amp;source=3Dg">Nijmegen</a>=C2=A0<= /span></span><span class=3D"m_-8276517321375835458Apple-style-span" style= =3D"color:rgb(121,121,121);font-family:Calibri,sans-serif;font-size:15px"><= span lang=3D"NL" style=3D"font-size:8pt;font-family:Verdana,sans-serif"><a = href=3D"https://maps.google.com/?q=3DNijmegen%C2%A0%7C%C2%A0Heyendaalseweg%= 0D+135,+NL-6525AJ&amp;entry=3Dgmail&amp;source=3Dg">|</a>=C2=A0</span></spa= n><span class=3D"m_-8276517321375835458Apple-style-span" style=3D"color:rgb= (121,121,121);font-family:Calibri,sans-serif;font-size:15px"><span lang=3D"= NL" style=3D"font-size:8pt;font-family:Verdana,sans-serif">Heyendaalseweg 135, NL-6525AJ Nijmegen=C2=A0</span></span><span class=3D"m_-8276517321375= 835458Apple-style-span" style=3D"color:rgb(121,121,121);font-family:Calibri= ,sans-serif;font-size:15px"><span lang=3D"NL" style=3D"font-size:8pt;font-f= amily:Verdana,sans-serif">|=C2=A0</span></span><span class=3D"m_-8276517321= 375835458Apple-style-span" style=3D"color:rgb(121,121,121);font-family:Cali= bri,sans-serif;font-size:15px"><span lang=3D"NL" style=3D"font-size:8pt;fon= t-family:Verdana,sans-serif">room 00.817=C2=A0</span></span><span class=3D"m_-8276517321375835458Apple-style= -span" style=3D"color:rgb(121,121,121);font-family:Calibri,sans-serif;font-= size:15px"><span lang=3D"NL" style=3D"font-size:8pt;font-family:Verdana,san= s-serif">|</span></span><span class=3D"m_-8276517321375835458Apple-style-sp= an" style=3D"color:rgb(121,121,121);font-family:Calibri,sans-serif;font-siz= e:15px"><span lang=3D"NL" style=3D"font-size:8pt;font-family:Verdana,sans-s= erif">=C2=A0E:=C2=A0<a href=3D"mailto:G.Windau@xxxxxxxx" target=3D"_bl= ank">G.Windau@xxxxxxxx<wbr>ru.nl</a>=C2=A0| T: <a href=3D"tel:+31%2024%20361%203356" value=3D"+31243613356" target=3D"= _blank">+31 24 3613356</a>=C2=A0</span></span><span class=3D"m_-82765173213= 75835458Apple-style-span" style=3D"color:rgb(121,121,121);font-family:Calib= ri,sans-serif;font-size:15px"><span lang=3D"NL" style=3D"font-size:8pt;font= -family:Verdana,sans-serif">|=C2=A0</span><span lang=3D"NL" style=3D"font-s= ize:8pt;font-family:Verdana,sans-serif">W:=C2=A0<a href=3D"http://www.mbfys= .ru.nl/~gunter" target=3D"_blank">http://www.mbfys.<wbr>ru.nl/~gunter</a></= span></span></div> </div> </div> <br> </div> </div> </blockquote></div><br></div> --001a113d7a72e951d7055e02a9c1--


This message came from the mail archive
../postings/2017/
maintained by:
DAn Ellis <dpwe@ee.columbia.edu>
Electrical Engineering Dept., Columbia University