Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect sample count and duration for audio #1121

Open
0xf0f opened this issue May 16, 2019 · 10 comments
Open

Incorrect sample count and duration for audio #1121

0xf0f opened this issue May 16, 2019 · 10 comments

Comments

@0xf0f
Copy link

0xf0f commented May 16, 2019

The reported sample count (and by extension duration) of audio tracks seems to be incorrect.
I've tried this with several different files of varying formats so far. (FLAC, WAV, AIF, MP3).
See sbraz/pymediainfo#70 for test code and output.

@JeromeMartinez
Copy link
Member

Looks like rounding issues in the way it is computed.
Definitely something we should fix at some point, but don't expect a quick fix, at least on free support.

@DvdKhl
Copy link

DvdKhl commented Sep 3, 2020

This seems to be a regression: DvdKhl/AVDump3#50
Version 18.20 seem to report correct values.
In my case only avi files are so far affected and cannot be explained by rounding errors.

@JeromeMartinez
Copy link
Member

Actually I forgot this issue ticket but was just working on it (#1289), would it be better with latest snapshots?

@JeromeMartinez
Copy link
Member

I was working on WAV, wondering about the other formats, but I'll check with AVI and others when I have some free time.

@DvdKhl
Copy link

DvdKhl commented Sep 3, 2020

And it looks like the last version where it worked was not 18.20 as I said earlier but 0.7.42.
We'll try one of the snapshots and then report back if it is already fixed.

@kheldorn
Copy link

kheldorn commented Sep 3, 2020

I've got 3 files here showing this weird behaviour. Checking some old MIL versions I have lying around:

MIL 0.7.42:

  <Audio>
    <Count>157</Count>
    <StreamCount>1</StreamCount>
    <StreamKind>Audio</StreamKind>
    <StreamKindID>0</StreamKindID>
    <ID>1</ID>
    <Format>WMA</Format>
    <Format_Commercial>WMA</Format_Commercial>
    <Format_Version>Version 2</Format_Version>
    <CodecID>161</CodecID>
    <CodecID-Info>Windows Media Audio</CodecID-Info>
    <CodecID-Url>http://www.microsoft.com/windows/windowsmedia/format/codecdownload.aspx</CodecID-Url>
    <Codec>161</Codec>
    <Codec-Info>Windows Media Audio 2</Codec-Info>
    <Codec-Url>http://www.microsoft.com/windows/windowsmedia/format/codecdownload.aspx</Codec-Url>
    <Codec-CC>161</Codec-CC>
    <Duration Unit="ms">5028307</Duration>
    <BitRate Unit="bps">9992</BitRate>
    <Channels Unit="channel">1</Channels>
    <SamplingRate Unit="Hz">11025</SamplingRate>
    <SamplingCount>55437085</SamplingCount>
    <Resolution Unit="bit">16</Resolution>
    <BitDepth Unit="bit">16</BitDepth>
    <StreamSize Unit="byte">6280356</StreamSize>
    <StreamSize_Proportion>0.03342</StreamSize_Proportion>
    <Interleave_VideoFrames>4.19</Interleave_VideoFrames>
    <Interleave_Duration>139</Interleave_Duration>
    <Interleave_Preload>696</Interleave_Preload>
  </Audio>

MIL 0.7.90:

  <Audio>
    <Count>272</Count>
    <StreamCount>1</StreamCount>
    <StreamKind>Audio</StreamKind>
    <StreamKindID>0</StreamKindID>
    <ID>1</ID>
    <Format>WMA</Format>
    <Format_Commercial>WMA</Format_Commercial>
    <Format_Version>Version 2</Format_Version>
    <CodecID>161</CodecID>
    <CodecID-Info>Windows Media Audio</CodecID-Info>
    <CodecID-Url>http://www.microsoft.com/windows/windowsmedia/format/codecdownload.aspx</CodecID-Url>
    <Codec>161</Codec>
    <Codec-Info>Windows Media Audio 2</Codec-Info>
    <Codec-Url>http://www.microsoft.com/windows/windowsmedia/format/codecdownload.aspx</Codec-Url>
    <Codec-CC>161</Codec-CC>
    <Duration Unit="ms">17646</Duration>
    <Source_Duration Unit="ms">5028307</Source_Duration>
    <BitRate Unit="bps">9992</BitRate>
    <Channels Unit="channel">1</Channels>
    <SamplingRate Unit="Hz">11025</SamplingRate>
    <SamplingCount>194547</SamplingCount>
    <Resolution Unit="bit">16</Resolution>
    <BitDepth Unit="bit">16</BitDepth>
    <StreamSize Unit="byte">6280356</StreamSize>
    <StreamSize_Proportion>0.03342</StreamSize_Proportion>
    <Interleave_VideoFrames>4.19</Interleave_VideoFrames>
    <Interleave_Duration>139</Interleave_Duration>
    <Interleave_Preload>696</Interleave_Preload>
  </Audio>

MIL 0.7.99:

  <Audio>
    <Count>275</Count>
    <StreamCount>1</StreamCount>
    <StreamKind>Audio</StreamKind>
    <StreamKindID>0</StreamKindID>
    <ID>1</ID>
    <Format>WMA</Format>
    <Format_Commercial>WMA</Format_Commercial>
    <Format_Version>Version 2</Format_Version>
    <CodecID>161</CodecID>
    <CodecID-Info>Windows Media Audio</CodecID-Info>
    <CodecID-Url>http://www.microsoft.com/windows/windowsmedia/format/codecdownload.aspx</CodecID-Url>
    <Codec>161</Codec>
    <Codec-Info>Windows Media Audio 2</Codec-Info>
    <Codec-Url>http://www.microsoft.com/windows/windowsmedia/format/codecdownload.aspx</Codec-Url>
    <Codec-CC>161</Codec-CC>
    <Duration Unit="ms">17646</Duration>
    <Source_Duration Unit="ms">5028307</Source_Duration>
    <BitRate Unit="bps">9992</BitRate>
    <Channels Unit="channel">1</Channels>
    <SamplingRate Unit="Hz">11025</SamplingRate>
    <SamplingCount>194547</SamplingCount>
    <Resolution Unit="bit">16</Resolution>
    <BitDepth Unit="bit">16</BitDepth>
    <StreamSize Unit="byte">6280356</StreamSize>
    <StreamSize_Proportion>0.03342</StreamSize_Proportion>
    <Interleave_VideoFrames>4.19</Interleave_VideoFrames>
    <Interleave_Duration>139</Interleave_Duration>
    <Interleave_Preload>696</Interleave_Preload>
  </Audio>

MIL 18.12:

  <Audio>
    <Count>277</Count>
    <StreamCount>1</StreamCount>
    <StreamKind>Audio</StreamKind>
    <StreamKindID>0</StreamKindID>
    <ID>1</ID>
    <Format>WMA</Format>
    <Format_Commercial>WMA</Format_Commercial>
    <Format_Version>Version 2</Format_Version>
    <CodecID>161</CodecID>
    <CodecID-Info>Windows Media Audio</CodecID-Info>
    <CodecID-Url>http://www.microsoft.com/windows/windowsmedia/format/codecdownload.aspx</CodecID-Url>
    <Duration Unit="ms">17646</Duration>
    <Source_Duration Unit="ms">5028307</Source_Duration>
    <BitRate Unit="bps">9992</BitRate>
    <Channels Unit="channel">1</Channels>
    <SamplingRate Unit="Hz">11025</SamplingRate>
    <SamplingCount>194547</SamplingCount>
    <BitDepth Unit="bit">16</BitDepth>
    <StreamSize Unit="byte">6280356</StreamSize>
    <StreamSize_Proportion>0.03342</StreamSize_Proportion>
    <Interleave_VideoFrames>4.19</Interleave_VideoFrames>
    <Interleave_Duration Unit="ms">139</Interleave_Duration>
    <Interleave_Preload Unit="ms">696</Interleave_Preload>
  </Audio>

MIL 20.08:

  <Audio>
    <Count Unit="">280</Count>
    <StreamCount Unit="">1</StreamCount>
    <StreamKind Unit="">Audio</StreamKind>
    <StreamKindID Unit="">0</StreamKindID>
    <ID Unit="">1</ID>
    <Format Unit="">WMA</Format>
    <Format_Commercial Unit="">WMA</Format_Commercial>
    <Format_Version Unit="">Version 2</Format_Version>
    <CodecID Unit="">161</CodecID>
    <CodecID-Info Unit="">Windows Media Audio</CodecID-Info>
    <CodecID-Url Unit="">http://www.microsoft.com/windows/windowsmedia/format/codecdownload.aspx</CodecID-Url>
    <Duration Unit="ms">17646</Duration>
    <Source_Duration Unit="ms">5028307</Source_Duration>
    <BitRate Unit="bps">9992</BitRate>
    <Channels Unit="channel">1</Channels>
    <SamplingRate Unit="Hz">11025</SamplingRate>
    <SamplingCount Unit="">194547</SamplingCount>
    <BitDepth Unit="bit">16</BitDepth>
    <StreamSize Unit="byte">6280356</StreamSize>
    <StreamSize_Proportion Unit="">0.03342</StreamSize_Proportion>
    <Interleave_VideoFrames Unit="">4.19</Interleave_VideoFrames>
    <Interleave_Duration Unit="ms">139</Interleave_Duration>
    <Interleave_Preload Unit="ms">696</Interleave_Preload>
  </Audio>

@kheldorn
Copy link

kheldorn commented Sep 3, 2020

So somewhere between 0.7.42 and 0.7.90 the regression was introduced ... the correct duration was moved to a newly introduced <Source_Duration/> node and the original node now carries ... whatever duration that might be.

@kheldorn
Copy link

kheldorn commented Sep 3, 2020

Just checked with 20.08.20200828. Same result.

<track type="Audio">
  <ID>1</ID>
  <Format>WMA</Format>
  <Format_Version>2</Format_Version>
  <CodecID>161</CodecID>
  <Duration>17.646</Duration>
  <Source_Duration>5028.307</Source_Duration>
  <BitRate>9992</BitRate>
  <Channels>1</Channels>
  <SamplingRate>11025</SamplingRate>
  <SamplingCount>194547</SamplingCount>
  <BitDepth>16</BitDepth>
  <StreamSize>6280356</StreamSize>
  <StreamSize_Proportion>0.03342</StreamSize_Proportion>
  <Interleave_VideoFrames>4.19</Interleave_VideoFrames>
  <Interleave_Duration>0.139</Interleave_Duration>
  <Interleave_Preload>0.696</Interleave_Preload>
</track>

If you want one (or all three) of the files I got here, let me know.

@JeromeMartinez
Copy link
Member

the correct duration was moved to a newly introduced <Source_Duration/> node and the original node now carries ... whatever duration that might be.

This is another issue not related to a rounding issue, more an issue about potential mismatch between container and raw stream (we aim to detect container related duration, sometimes the container indicates to play only a portion of the file).
Please open a specific ticket with a sample file (could be private sending if the file is copyrighted).

@kheldorn
Copy link

kheldorn commented Sep 3, 2020

Well, the detected sampling count changed between 0.7.42 and 0.7.90 for these files too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants