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

Add support for MP4 UUID and MOV XMP boxes #451

Closed
wants to merge 5 commits into from

Conversation

kerenby
Copy link
Contributor

@kerenby kerenby commented Jan 2, 2020

No description provided.

Copy link
Owner

@drewnoakes drewnoakes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have a sample file in the images repo that triggers this? If not, can you provide one for regression testing?


public class Mp4UserBoxDirectory extends Mp4MediaDirectory {
public static final Integer TAG_UUID = 901;
public static final Integer TAG_LENGTH = 902;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This tag is redundant, given it can be derived from the data itself.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Added XmpAtom for Mov format
  • Fixed issue with offset in mp4 if size mdat box is 64-bit (it's typically only the Media Data Box)
  • Added mp4 and mov files with "UUID" box and "XMP_" atom and tests

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the update. Sorry I wasn't more clear about the test data. We can't add test media data to this repo without it becoming huge. There's a separate repo for this:

https://github.com/drewnoakes/metadata-extractor-images

I uploaded the test data you provided (thanks very much for preparing these):

drewnoakes/metadata-extractor-images@0f1e3cd

I'm happy to edit your PR's commits to remove those files, unless you'd like to do so.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, sure, you can move these files, thanks

drewnoakes added a commit to drewnoakes/metadata-extractor-images that referenced this pull request Jan 5, 2020
@drewnoakes drewnoakes changed the title Added parsing uuid boxes Add support for MP4 UUID and MOV XMP boxes Jan 5, 2020
@drewnoakes
Copy link
Owner

Thanks for your patience. I've only just had a chance to look at this.

Running this over the MP4 sample files we have produces some diffs like this:

diff --git a/mp4/metadata/java/Issue 306.mp4.txt b/mp4/metadata/java/Issue 306.mp4.txt
index c213c15..ea9409a 100644
--- a/mp4/metadata/java/Issue 306.mp4.txt	
+++ b/mp4/metadata/java/Issue 306.mp4.txt	
@@ -17,6 +17,9 @@ TYPE: MP4
 [MP4 - 0x010e] Next Track ID = 3
 [MP4 - 0x0200] Rotation = 0
 
+[UUID - 0x0385] uuid = 50524f46-21d2-4fce-bb88-695cfac9c740
+[UUID - 0x0386] data = [124 values]
+
 [MP4 Video - 0x0065] Creation Time = Thu Nov 16 19:24:56 +11:00 2017
 [MP4 Video - 0x0066] Modification Time = Thu Nov 16 19:25:00 +11:00 2017
 [MP4 Video - 0x0068] ISO 639-2 Language Code = und
@@ -31,6 +34,9 @@ TYPE: MP4
 [MP4 Video - 0x00cf] Vertical Resolution = 96
 [MP4 Video - 0x00d6] Frame Rate = 25
 
+[UUID - 0x0385] uuid = 55534d54-21d2-4fce-bb88-695cfac9c740
+[UUID - 0x0386] data = [28 values]
+
 [MP4 Sound - 0x0065] Creation Time = Thu Nov 16 19:24:56 +11:00 2017
 [MP4 Sound - 0x0066] Modification Time = Thu Nov 16 19:25:00 +11:00 2017
 [MP4 Sound - 0x0068] ISO 639-2 Language Code = und
@@ -40,6 +46,9 @@ TYPE: MP4
 [MP4 Sound - 0x012f] Sample Size = 16
 [MP4 Sound - 0x0130] Sample Rate = 48000
 
+[UUID - 0x0385] uuid = 55534d54-21d2-4fce-bb88-695cfac9c740
+[UUID - 0x0386] data = [28 values]
+
 [File Type - 0x0001] Detected File Type Name = MP4
 [File Type - 0x0002] Detected File Type Long Name = MPEG-4 Part 14
 [File Type - 0x0003] Detected MIME Type = video/mp4
@@ -50,8 +59,11 @@ TYPE: MP4
 [File - 0x0003] File Modified Date = <omitted for regression testing as checkout dependent>
 
 - MP4
+- UUID
 - MP4 Video
+- UUID
 - MP4 Sound
+- UUID
 - File Type
 - File

What is the value of these UUID blocks to you? Are these GUIDs random, or do they hold special meaning? Can you elaborate on your use case here please?

@drewnoakes
Copy link
Owner

I looked a little further at this and understand more about the role of the UUID boxes. They're extension points for data defined outside the spec, and several well known UUIDs point to data that we already know how to decode.

I've updated the commits in your PR to remove the test data, and added support for processing some of the known UUID values (Exif, IPTC, XMP, etc).

I've changed the code to not store the XMP string, but rather to parse it using XmpReader immediately.

Looks like this PR was configured so that I cannot push to your branch, so I'll need to open a new PR with those changes.

@drewnoakes
Copy link
Owner

Replaced by #455. Thanks again for this awesome contribution! You still have author credit on the commits in the other PR.

@drewnoakes drewnoakes closed this Jan 15, 2020
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