feat: add .mxf file support (#24644)

* feat: add support for MXF format in media handling

* Updated supported formats documentation to include MXF.
* Added MXF to valid video extensions in tests.
* Registered MXF MIME type in mime-types utility.

* fix: enhance MXF handling in mime-types utility

* Updated video mime type validation to include 'application/mxf'.
* Adjusted asset type determination to recognize MXF as a video container.

* chore: clean up

---------

Co-authored-by: Jason Rasmussen <jason@rasm.me>
This commit is contained in:
Timon
2026-02-19 07:39:41 +01:00
committed by GitHub
parent e520fc3b63
commit 316f86d25e
4 changed files with 11 additions and 2 deletions

View File

@@ -38,6 +38,7 @@ For the full list, refer to the [Immich source code](https://github.com/immich-a
| `MP2T` | `.mts` `.m2ts` `.m2t` | :white_check_mark: | |
| `MP4` | `.mp4` `.insv` | :white_check_mark: | |
| `MPEG` | `.mpg` `.mpe` `.mpeg` | :white_check_mark: | |
| `MXF` | `.mxf` | :white_check_mark: | |
| `QUICKTIME` | `.mov` | :white_check_mark: | |
| `WEBM` | `.webm` | :white_check_mark: | |
| `WMV` | `.wmv` | :white_check_mark: | |

View File

@@ -110,6 +110,7 @@ const validVideos = [
'.mp4',
'.mpg',
'.mts',
'.mxf',
'.vob',
'.webm',
'.wmv',

View File

@@ -76,6 +76,7 @@ describe('mimeTypes', () => {
{ mimetype: 'image/x-sony-sr2', extension: '.sr2' },
{ mimetype: 'image/x-sony-srf', extension: '.srf' },
{ mimetype: 'image/x3f', extension: '.x3f' },
{ mimetype: 'application/mxf', extension: '.mxf' },
{ mimetype: 'video/3gpp', extension: '.3gp' },
{ mimetype: 'video/3gpp', extension: '.3gpp' },
{ mimetype: 'video/avi', extension: '.avi' },
@@ -188,7 +189,9 @@ describe('mimeTypes', () => {
it('should contain only video mime types', () => {
const values = Object.values(mimeTypes.video).flat();
expect(values).toEqual(values.filter((mimeType) => mimeType.startsWith('video/')));
expect(values).toEqual(
values.filter((mimeType) => mimeType.startsWith('video/') || mimeType === 'application/mxf'),
);
});
for (const [extension, v] of Object.entries(mimeTypes.video)) {

View File

@@ -98,6 +98,7 @@ const video: Record<string, string[]> = {
'.mpeg': ['video/mpeg'],
'.mpg': ['video/mpeg'],
'.mts': ['video/mp2t'],
'.mxf': ['application/mxf'],
'.vob': ['video/mpeg'],
'.webm': ['video/webm'],
'.wmv': ['video/x-ms-wmv'],
@@ -141,9 +142,12 @@ export const mimeTypes = {
const contentType = lookup(filename);
if (contentType.startsWith('image/')) {
return AssetType.Image;
} else if (contentType.startsWith('video/')) {
}
if (contentType.startsWith('video/') || contentType === 'application/mxf') {
return AssetType.Video;
}
return AssetType.Other;
},
getSupportedFileExtensions: () => [...Object.keys(image), ...Object.keys(video)],