-
Notifications
You must be signed in to change notification settings - Fork 47
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 time zone parsing for "*_Date" attributes (#52) #54
Conversation
Prior to this commit, this library would apply the local system time zone to UTC timestamps. For instance, <Encoded_Date>UTC 2018-03-30 12:12:08</Encoded_Date> would produce >> MediaInfo.from(file).video.encoded_date => 2018-03-30 12:12:08 -0700 This commit addresses this problem by moving the "UTC" prefix to the end of the string before parsing it.
This commit fixes #52. A separate issue?For the sake of clarity, it also adds two unimplemented spec examples for a separate-but-related issue, which can be summarized thusly:
Consider the metadata provided in <media ref="Desktop/test.MOV">
<track type="General">
<File_Modified_Date>UTC 2018-03-30 12:12:08</File_Modified_Date>
<File_Modified_Date_Local>2018-03-30 08:12:08</File_Modified_Date_Local>
</track>
</media> It's reasonable to assume here that What to do?First off, let's be clear that this problem was not introduced by this PR. Rather, the changes in this PR have merely solved half of a problem: previously, both kinds of timestamps were broken; now, only one is. I don't think there's a clean solution, though. The only reliable to way infer what the value of It's not ideal, but I think this problem should either be ignored entirely, or Thoughts? |
Should this change and the second comment/issue be mentioned in the README? |
Yes, that is a better idea! How's this? |
For the record, based on the research I've done, there is no universal standard for timestamps in video/audio file metadata, but ISO 8601 comes pretty close. I checked a few files media files on my own computer (.mp4, .mov, .m4a) and they all stored the timestamp data as UTC. I even used ffmpeg to try to set a non-UTC timestamp on a video file, and ffmpeg converted it to UTC before saving (i.e., it added seven hours to the time and added the UTC label). Note that the timestamp may still be incorrect for other reasons. For instance, the .mov file I linked to in #52 was taken on a digital camera that I have to manually set the time on. I set it to local time, then took a video at 15:48 local time, and it was recorded as 15:48 UTC. This is not a bug in mediainfo; it's a flaw in the design of the camera. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Prior to this commit,
this library would apply the local system time zone to UTC timestamps.
For instance,
would produce
This commit addresses this problem
by moving the "UTC" prefix to the end of the string before parsing it.