Skip to content

Conversation

@timonrieger
Copy link
Contributor

@timonrieger timonrieger commented Dec 17, 2025

Description

Adds support for MXF (Material Exchange Format) video files in Immich.

What was added:

  • Added .mxf extension to the supported video formats list
  • Registered application/mxf as the mime type for MXF files (official SMPTE mime type)
  • Updated asset type classification to correctly identify MXF files as video assets
  • Updated tests to validate MXF file handling

Technical details:
MXF is a container format with the mime type application/mxf (not video/mxf). The assetType() function was updated to check file extensions first (against the video and image objects) before falling back to mime type prefixes. This ensures container formats like MXF are correctly classified based on their extension listing, regardless of mime type prefix.

Rationale for 5316bcf:
Container formats (MXF, MOV, MP4, MKV, WebM) can have non-standard mime types. File extensions are more reliable for classification since Immich maintains explicit extension lists for video/image types. By checking extensions first, we ensure that any file extension listed in the video object is correctly classified as AssetType.Video, enabling proper playback, thumbnail generation, and metadata extraction.

Fixes #24640

How Has This Been Tested?

  • Added test case for MXF file extension to mime type mapping
  • Updated test to allow application/mxf in video mime types validation
  • Verified MXF files are correctly classified as AssetType.Video during upload
  • Confirmed video playback endpoint works for MXF files (/api/assets/{id}/video/playback)
  • Verified thumbnail generation works for MXF files
  • Tested that existing video formats (MP4, MOV, etc.) continue to work correctly

Sample files downloaded from https://toolsfairy.com/video-test/sample-mxf-files were used to test the implementation.

Screenshots

Note: the last file upload fails due to size constraints of github codespaces (also happens on standard .mov files)
https://github.com/user-attachments/assets/3e3c895c-cb4b-4f3d-a9eb-299e3130d6b7

Checklist:

  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation if applicable
  • I have no unrelated changes in the PR.
  • I have confirmed that any new dependencies are strictly necessary.
  • I have written tests for new code (if applicable)
  • I have followed naming conventions/patterns in the surrounding code
  • All code in src/services/ uses repositories implementations for database calls, filesystem operations, etc.
  • All code in src/repositories/ is pretty basic/simple and does not have any immich specific logic (that belongs in src/services/)

Please describe to which degree, if any, an LLM was used in creating this pull request.

Used LLM assistance to research MXF mime type specifications and identify the classification logic issue.

* Updated supported formats documentation to include MXF.
* Added MXF to valid video extensions in tests.
* Registered MXF MIME type in mime-types utility.
* Updated video mime type validation to include 'application/mxf'.
* Adjusted asset type determination to recognize MXF as a video container.
@timonrieger
Copy link
Contributor Author

agreed in discord to test not only against sample files, but some "real" files considering .mxf being a broad container format. Will get there on the weekend, due to file size limitations for Github Codespaces.

@immich-push-o-matic
Copy link

📖 Documentation deployed to docs.pr-24644.preview.immich.app

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog:feature documentation Improvements or additions to documentation 🗄️server

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants