Skip to content

TIKA-4838: Expose the MP4 audio and video track codecs (audio:format, video:format) - #3062

Open
dschmidt wants to merge 3 commits into
apache:mainfrom
dschmidt:TIKA-audio-format
Open

TIKA-4838: Expose the MP4 audio and video track codecs (audio:format, video:format)#3062
dschmidt wants to merge 3 commits into
apache:mainfrom
dschmidt:TIKA-audio-format

Conversation

@dschmidt

@dschmidt dschmidt commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Adds audio:format and video:format, each the track's four-character codec identifier from the MP4/QuickTime sample description (audio: mp4a/alac/ac-3; video: avc1/hev1).

TikaMp4SoundHandler/TikaMp4VideoHandler already read the sample-entry format fourcc (audio uses it to detect drms/enca protected streams; video ignored it); this exposes it as metadata. Because it comes from the track, both are set for video/* files, where xmpDM:audioCompressor does not fire and xmpDM:videoCompressor carries the compressor name (encoder string, e.g. "Lavc… libx264"), not the codec fourcc.

For protected streams the value is the protection scheme fourcc (drms/enca/encv/drmi); audio additionally sets audio:has-drm. Both are per-stream values: with several tracks they reflect the last one, like audio:bitrate/video:bitrate.

Verified against an M4A (mp4a), a video/mp4 with H.264 video + AAC audio (avc1 + mp4a), and a DRM-protected M4A (drms); metadata schema registries updated.

https://issues.apache.org/jira/browse/TIKA-4838

Follows TIKA-4779, TIKA-4800 and TIKA-4802.

@dschmidt
dschmidt force-pushed the TIKA-audio-format branch 2 times, most recently from 5452bf9 to cc7b684 Compare August 24, 2026 13:52
@dschmidt dschmidt changed the title TIKA-4838: Expose the MP4 audio track codec (audio:format) TIKA-4838: Expose the MP4 audio and video track codecs (audio:format, video:format) Aug 24, 2026
@dschmidt
dschmidt marked this pull request as ready for review August 24, 2026 14:31
@THausherr
THausherr requested a lite review from Copilot August 24, 2026 15:24

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Warning

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

Expose MP4/QuickTime track codec FourCCs as audio:format and video:format, including recovery of original codecs for protected streams via nested frma boxes.

Changes:

  • Add new Audio.FORMAT and Video.FORMAT metadata properties and register schema keys.
  • Populate audio:format/video:format from sample description entries, with frma fallback for protected streams.
  • Add parser tests asserting the new metadata for audio-only and video+audio MP4s.

Reviewed changes

Copilot reviewed 7 out of 8 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
tika-parsers/.../MP4ParserTest.java Adds assertions/tests for audio:format and video:format.
tika-parsers/.../TikaMp4VideoHandler.java Extracts video codec FourCC and recovers original FourCC for protected video streams.
tika-parsers/.../TikaMp4SoundHandler.java Extracts audio codec FourCC and recovers original FourCC for protected audio streams.
tika-metadata-schema/.../metadata-keys.json Registers audio:format and video:format keys.
tika-metadata-schema/.../metadata-key-fields.json Maps Audio.FORMAT/Video.FORMAT fields to the new keys.
tika-core/.../Video.java Adds Video.FORMAT property with Javadoc.
tika-core/.../Audio.java Adds Audio.FORMAT property with Javadoc.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread tika-core/src/main/java/org/apache/tika/metadata/Video.java Outdated
… video:format)

TikaMp4SoundHandler/TikaMp4VideoHandler read the sample-entry format fourcc
but only use it for other purposes (audio: DRM detection; video: nothing).
Expose it as audio:format and video:format, each the track's four-character
codec identifier (e.g. mp4a/alac/ac-3, avc1/hev1). This gives the per-track
codec for video/* files, where xmpDM:audioCompressor does not fire and
xmpDM:videoCompressor carries the compressor name. For protected streams the
value is the protection scheme fourcc (drms/enca/encv/drmi); audio also sets
audio:has-drm. Follows TIKA-4779, TIKA-4800 and TIKA-4802.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 7 out of 8 changed files in this pull request and generated 2 comments.

Comment thread tika-core/src/main/java/org/apache/tika/metadata/Audio.java
Comment thread tika-core/src/main/java/org/apache/tika/metadata/Video.java

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 7 out of 8 changed files in this pull request and generated 1 comment.

@dschmidt
dschmidt requested a lite review from Copilot August 24, 2026 21:18

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

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