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

MP4ConvertTime problems with not integer divisible timescale. #6

Closed
GoogleCodeExporter opened this issue Mar 31, 2016 · 7 comments
Closed

Comments

@GoogleCodeExporter
Copy link

MP4ConvertTime() does not correctly handle the case when two timescale are not 
divisible in 
integer, and returns wrong duration. This causes QuickTime to read the track 
with a shorter length.

Original issue reported on code.google.com by damiog on 5 Dec 2008 at 3:43

@GoogleCodeExporter
Copy link
Author

Please provide a short code-snippet which shows 2 cases; one where 
MP4ConvertTime() works as intended, and 
one where it returns wrong duration.

Original comment by Kona8l...@gmail.com on 8 Dec 2008 at 10:34

@GoogleCodeExporter
Copy link
Author

For example: MP4ConvertTime(5618688, 48000, 600) returns 65844, while a correct 
value would be ~70234.

MP4ConvertTime(1000, 48000, 24000); works as advertised instead.

Well it seems the problem is that using integer to do this calculation may 
result in some approximation, I don't 
think it would do any harm to use float for everything.

Original comment by damiog on 8 Dec 2008 at 11:37

@GoogleCodeExporter
Copy link
Author

I do not get the results you list -- how can you get negative; it's an unsigned 
64-bit int. Need more information, 
maybe it's your platform or compiler. The results I got are 70233 which is 
correct.

This would probably be easier if you dropped by IRC.freenode.net channel #mp4v2 
.

Original comment by Kona8l...@gmail.com on 8 Dec 2008 at 12:12

@GoogleCodeExporter
Copy link
Author

Woops sorry, yes MP4ConvertTime is working fine, the bugs must be somewhere 
else. I'll try to track it down.
Btw I am not getting a negative number, but a smaller number. It was a tilde 
(~) not a - ;)

Original comment by damiog on 8 Dec 2008 at 1:49

@GoogleCodeExporter
Copy link
Author

The problem was in void MP4Track::UpdateDurations(MP4Duration duration). It was 
transforming the duration of 
each sample to the new timescale and then it added it to the track duration. 
This was introducing a small 
conversion error for each sample that was accumulated over time. I fixed it by 
calculating a new media duration 
from the track duration.


Original comment by damiog on 8 Dec 2008 at 2:51

Attachments:

@GoogleCodeExporter
Copy link
Author

patch applied to trunk@195

Original comment by Kona8l...@gmail.com on 24 Dec 2008 at 9:30

@GoogleCodeExporter
Copy link
Author

Original comment by Kona8l...@gmail.com on 24 Dec 2008 at 9:30

  • Changed state: Fixed

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

1 participant