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

Fix & Improve MediaInfo::Tracks::Attributes.standardize_to_milliseconds. #30

Merged
merged 1 commit into from
Sep 4, 2018

Conversation

01max
Copy link
Contributor

@01max 01max commented Sep 3, 2018

Fix the incorrect results of MediaInfo::Tracks::Attributes.standardize_to_millisecond class method.

The 'minute' regex was triggered by some ms values & the regex used for the scan of the input string was not splitting elements not separated by a space.

Leading to these kind of results :

multiple_streams_no_stream_id_three_video.xml

<Duration>4s 170ms</Duration>
4*1000 + 170 = 4170
previously wrong output : 10204000

vimeo.57652.avi.xml

<Duration>15s 164ms</Duration>
15*1000 + 164 = 15164
previously wrong output : 9855000

I also simplified the switch case by optimizing the regular expressions used for the hours / minutes / seconds, and added a support for iphone .mov specific duration format (ie. 164.536)

I'm joining a test & benchmark output for these updates : test_and_benchmark_output.txt

@NorseGaud NorseGaud self-requested a review September 3, 2018 21:44
@NorseGaud NorseGaud merged commit 743f038 into greatseth:master Sep 4, 2018
@NorseGaud
Copy link
Collaborator

Great catch and solution. 1.1.0 pushed

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

Successfully merging this pull request may close these issues.

2 participants