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

Timezone parsing fix and mov rotation extraction #466

Conversation

baloghf87
Copy link

Hi Drew,

I did some improvements in the library:

  • I found that timezone information gets lost when extracting metadata from some images, because the library expects it to be in HH:mm format, but actually it is in HHmm.

  • We needed to extract rotation angle from MOV files, so I implemented very basic handling of track headers.

Best regards,
Ferenc

@drewnoakes drewnoakes merged commit 1319185 into drewnoakes:master Mar 28, 2020
@drewnoakes
Copy link
Owner

Thanks for the great contribution. Nice and clean.

@drewnoakes
Copy link
Owner

I just ran this over the test image library and found it regressed mp4/uuid540.mp4, throwing an exception. Can you take a look?

@drewnoakes
Copy link
Owner

Also, can you provide a (small) sample file that contains GPS data for regression testing? We don't have a lot of MP4/QuickTime test data.

@baloghf87
Copy link
Author

I just checked it quickly, for me it runs without issues on uuid540.mp4. What exception do you get? I'll take a closer look at it soon...

@baloghf87
Copy link
Author

The files I used for testing location extraction are

  • MP4: 7.6 MB
  • MOV: 10.5 MB

Are these considered small? :)

@Nadahar
Copy link
Contributor

Nadahar commented Mar 28, 2020

Are these considered small? :)

Yes, video files are often huge 😉

@drewnoakes
Copy link
Owner

I see:

java.lang.NullPointerException
	at java.util.regex.Matcher.getTextLength(Matcher.java:1283)
	at java.util.regex.Matcher.reset(Matcher.java:309)
	at java.util.regex.Matcher.<init>(Matcher.java:229)
	at java.util.regex.Pattern.matcher(Pattern.java:1093)
	at com.drew.metadata.mp4.boxes.UserDataBox.addMetadata(UserDataBox.java:64)
	at com.drew.metadata.mp4.Mp4BoxHandler.processUserData(Mp4BoxHandler.java:106)
	at com.drew.metadata.mp4.Mp4BoxHandler.processBox(Mp4BoxHandler.java:94)
	at com.drew.imaging.mp4.Mp4Reader.processBoxes(Mp4Reader.java:61)
	at com.drew.imaging.mp4.Mp4Reader.processBoxes(Mp4Reader.java:59)
	at com.drew.imaging.mp4.Mp4Reader.extract(Mp4Reader.java:45)
	at com.drew.imaging.mp4.Mp4MetadataReader.readMetadata(Mp4MetadataReader.java:57)
	at com.drew.imaging.ImageMetadataReader.readMetadata(ImageMetadataReader.java:177)
	at com.drew.imaging.ImageMetadataReader.readMetadata(ImageMetadataReader.java:124)
	at com.drew.imaging.ImageMetadataReader.readMetadata(ImageMetadataReader.java:204)
	at com.drew.imaging.ImageMetadataReader.main(ImageMetadataReader.java:253)

The code currently assumes coordinateString is non-null, which is not necessarily true.

@drewnoakes
Copy link
Owner

Are these considered small? :)

They're small, but if you're able to make them smaller somehow it'd be great. Git doesn't like large files, and the metadata is usually very small. The image library repo is already enormous. Perhaps there's some software that trims them to just a few frames of video without removing any metadata.

@Nadahar
Copy link
Contributor

Nadahar commented Mar 29, 2020

Perhaps there's some software that trims them to just a few frames of video without removing any metadata.

I've successfully used FFmpeg to truncate video files while retaining metadata before, using copy for all tracks and then using the -t option to control duration. I can't guarantee that the metadata will always be intact for all formats and codec combinations, but it has worked the times I've done it.

drewnoakes added a commit that referenced this pull request Mar 29, 2020
The "©xyz" marker can appear anywhere within the udta chunk. There appears to be a structure to the entries in this data, though I couldn't find documentation on it. This commit introduces a loop that walks through items until one with location data is found.

Builds on work in #466.
@drewnoakes
Copy link
Owner

I played around with location extraction and filed #468 which catches a few more cases.

@baloghf87
Copy link
Author

https://drive.google.com/open?id=15WnvT9u6-B5CyghNvicFWTGaSRUShgPG

Sorry for the late reply, i had a very busy week. I could not manage to truncate MOV files retaining metadata, it only worked for MP4.

@baloghf87
Copy link
Author

Is there anything else I can help you with?

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.

None yet

3 participants