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


Subject: Re: [AUDITORY] Converting audio file from WAV to MP3 changes file duration. Why?
From:    Julien Bloit  <julien.bloit@xxxxxxxx>
Date:    Wed, 15 Nov 2017 10:15:55 +0000
List-Archive:<http://lists.mcgill.ca/scripts/wa.exe?LIST=AUDITORY>

--001a11411d6806e6b5055e02cab4 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi, Zero-padding is applied for filtering purposes, see a (rather old) explanation here: http://lame.sourceforge.net/tech-FAQ.txt A command line tool like "afinfo" will be able to tell you how many valid audio frames are in the mp3, and which are the priming and reamainder frames. Julien On Wed, Nov 15, 2017 at 8:57 AM, 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 > > --001a11411d6806e6b5055e02cab4 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable <div dir=3D"ltr">Hi,=C2=A0<div><br><div>Zero-padding is applied for filteri= ng purposes, see a (rather old) explanation here:=C2=A0</div></div><div><a = href=3D"http://lame.sourceforge.net/tech-FAQ.txt">http://lame.sourceforge.n= et/tech-FAQ.txt</a><br></div><div><br></div><div>A command line tool like &= quot;afinfo&quot; will be able to tell you how many valid audio frames are = in the mp3, and which are the priming and reamainder frames.</div><div><br>= </div><div>Julien</div></div><div class=3D"gmail_extra"><br><div class=3D"g= mail_quote">On Wed, Nov 15, 2017 at 8:57 AM, Windau, G.R.W. (G=C3=BCnter) <= span dir=3D"ltr">&lt;<a href=3D"mailto:G.Windau@xxxxxxxx" target=3D"_b= lank">G.Windau@xxxxxxxx</a>&gt;</span> wrote:<br><blockquote class=3D"= gmail_quote" style=3D"margin:0 0 0 .8ex;border-left: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><div class=3D"h5"> <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_2354986082132685589Apple-interchange-newline"> </div></div><div><div><div class=3D"h5"> <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> </div></div><span id=3D"m_2354986082132685589cid:82310ACF-9C5E-447E-A967-6D= 688383CBA4@xxxxxxxx">&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_2354986082132685589Apple-style-span" style=3D"color:rgb(12= 1,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 Wi= ndau | Technical Support Group=C2=A0</span></span><span class=3D"m_23549860= 82132685589Apple-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">|</span></span><span style=3D"color:rgb(121,= 121,121);font-family:Verdana">=C2=A0</span><span class=3D"m_235498608213268= 5589Apple-style-span" style=3D"color:rgb(121,121,121);font-family:Calibri,s= ans-serif;font-size:15px"><span lang=3D"NL" style=3D"font-size:8pt;font-fam= ily:Verdana,sans-serif">Dept. Biophysics=C2=A0</span></span><span class=3D"m_2354986082132685589Apple-st= yle-span" style=3D"color:rgb(121,121,121);font-family:Calibri,sans-serif;fo= nt-size:15px"><span lang=3D"NL" style=3D"font-size:8pt;font-family:Verdana,= sans-serif">|=C2=A0</span></span><span class=3D"m_2354986082132685589Apple-= style-span" style=3D"color:rgb(121,121,121);font-family:Verdana,sans-serif;= 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_235498608= 2132685589Apple-style-span" style=3D"color:rgb(121,121,121);font-family:Cal= ibri,sans-serif;font-size:15px"><span lang=3D"NL" style=3D"font-size:8pt;fo= nt-family:Verdana,sans-serif">|=C2=A0</span></span><span class=3D"m_2354986= 082132685589Apple-style-span" style=3D"color:rgb(121,121,121);font-family:C= alibri,sans-serif;font-size:15px"><span lang=3D"NL" style=3D"font-size:8pt;= font-family:Verdana,sans-serif">Radboud</span></span><span class=3D"m_23549= 86082132685589Apple-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">=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_2354986082132685589Apple-style-span" style=3D= "color:rgb(121,121,121);font-family:Calibri,sans-serif;font-size:15px"><spa= n lang=3D"NL" style=3D"font-size:8pt;font-family:Verdana,sans-serif"><a hre= f=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></span><= span class=3D"m_2354986082132685589Apple-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_23549860821326= 85589Apple-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-fa= mily:Verdana,sans-serif">|=C2=A0</span></span><span class=3D"m_235498608213= 2685589Apple-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">room 00.817=C2=A0</span></span><span class=3D"m_2354986082132685589Apple-style-= span" style=3D"color:rgb(121,121,121);font-family:Calibri,sans-serif;font-s= ize:15px"><span lang=3D"NL" style=3D"font-size:8pt;font-family:Verdana,sans= -serif">|</span></span><span class=3D"m_2354986082132685589Apple-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-ser= if">=C2=A0E:=C2=A0<a href=3D"mailto:G.Windau@xxxxxxxx" target=3D"_blan= k">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_235498608213= 2685589Apple-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">|=C2=A0</span><span lang=3D"NL" style=3D"font-si= ze: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></s= pan></span></div> </div> </div> <br> </div> </div> </blockquote></div><br></div> --001a11411d6806e6b5055e02cab4--


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