enzo1982 / mp4v2

Reviving the MP4v2 project...
https://mp4v2.org
Other
135 stars 50 forks source link

`mp4info` - Wrong duration value? #18

Open sandreas opened 2 years ago

sandreas commented 2 years ago

Hey @enzo1982,

recently I had an issue in m4b-tool, where mp4info reported a wrong duration value (I assume a wrong one, cause the user also reported it as wrong).

> mp4info 001-finished.m4b | grep secs
1       audio   MPEG-4 AAC LC, 213.179 secs, 67 kbps, 22050 Hz
>
> tone dump 001-finished.m4b | grep duration               
│          duration │ 00:03:33.134              │
> 

The shift is only 45ms, but it is summing up to a greater value when using multiple files.

This is the first time ever that mp4info is wrong about the duration of a file, so I wonder, what the problem is. Surely, you cannot reproduce this without the files, but unfortunately, they can't be shared publicly. So let me know when you have the time to care about this - I'll invite you to a private repository to share one of the files with you, so that you can reproduce the problem.

enzo1982 commented 2 years ago

Hi Andreas,

I'll have time to have a look at those files this weekend. So would be great if you could share them with me.

From your description, I would guess that the difference is due to tone considering gapless information (iTunSMPB or elst) and stripping delay and padding samples, which mp4info does not.

Thus far, I considered that out of scope for MP4v2 and something that has to be supported by 3rd party software integrating the library. It might make sense to add this to mp4info, though.

sandreas commented 2 years ago

I emailed you the file to freac.org, please let me know if you got it and were able to reproduce the issue. If it did not work, please let me know how you wanna share the file.

Thank you.

enzo1982 commented 2 years ago

Thank you for providing the file!

As suspected, the file uses an edit list (elst) box to signal encoder delay of 1024 samples. tone apparently considers this when reporting the duration, while mp4info does not.

I'll see if I can add support for this to mp4info. We can leave this issue open until then.

sandreas commented 2 years ago

I'll see if I can add support for this to mp4info. We can leave this issue open until then.

Great, thank you.