mirror of
https://github.com/immich-app/immich.git
synced 2026-02-28 09:38:43 +03:00
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:
@@ -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: | |
|
| `MP2T` | `.mts` `.m2ts` `.m2t` | :white_check_mark: | |
|
||||||
| `MP4` | `.mp4` `.insv` | :white_check_mark: | |
|
| `MP4` | `.mp4` `.insv` | :white_check_mark: | |
|
||||||
| `MPEG` | `.mpg` `.mpe` `.mpeg` | :white_check_mark: | |
|
| `MPEG` | `.mpg` `.mpe` `.mpeg` | :white_check_mark: | |
|
||||||
|
| `MXF` | `.mxf` | :white_check_mark: | |
|
||||||
| `QUICKTIME` | `.mov` | :white_check_mark: | |
|
| `QUICKTIME` | `.mov` | :white_check_mark: | |
|
||||||
| `WEBM` | `.webm` | :white_check_mark: | |
|
| `WEBM` | `.webm` | :white_check_mark: | |
|
||||||
| `WMV` | `.wmv` | :white_check_mark: | |
|
| `WMV` | `.wmv` | :white_check_mark: | |
|
||||||
|
|||||||
@@ -110,6 +110,7 @@ const validVideos = [
|
|||||||
'.mp4',
|
'.mp4',
|
||||||
'.mpg',
|
'.mpg',
|
||||||
'.mts',
|
'.mts',
|
||||||
|
'.mxf',
|
||||||
'.vob',
|
'.vob',
|
||||||
'.webm',
|
'.webm',
|
||||||
'.wmv',
|
'.wmv',
|
||||||
|
|||||||
@@ -76,6 +76,7 @@ describe('mimeTypes', () => {
|
|||||||
{ mimetype: 'image/x-sony-sr2', extension: '.sr2' },
|
{ mimetype: 'image/x-sony-sr2', extension: '.sr2' },
|
||||||
{ mimetype: 'image/x-sony-srf', extension: '.srf' },
|
{ mimetype: 'image/x-sony-srf', extension: '.srf' },
|
||||||
{ mimetype: 'image/x3f', extension: '.x3f' },
|
{ mimetype: 'image/x3f', extension: '.x3f' },
|
||||||
|
{ mimetype: 'application/mxf', extension: '.mxf' },
|
||||||
{ mimetype: 'video/3gpp', extension: '.3gp' },
|
{ mimetype: 'video/3gpp', extension: '.3gp' },
|
||||||
{ mimetype: 'video/3gpp', extension: '.3gpp' },
|
{ mimetype: 'video/3gpp', extension: '.3gpp' },
|
||||||
{ mimetype: 'video/avi', extension: '.avi' },
|
{ mimetype: 'video/avi', extension: '.avi' },
|
||||||
@@ -188,7 +189,9 @@ describe('mimeTypes', () => {
|
|||||||
|
|
||||||
it('should contain only video mime types', () => {
|
it('should contain only video mime types', () => {
|
||||||
const values = Object.values(mimeTypes.video).flat();
|
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)) {
|
for (const [extension, v] of Object.entries(mimeTypes.video)) {
|
||||||
|
|||||||
@@ -98,6 +98,7 @@ const video: Record<string, string[]> = {
|
|||||||
'.mpeg': ['video/mpeg'],
|
'.mpeg': ['video/mpeg'],
|
||||||
'.mpg': ['video/mpeg'],
|
'.mpg': ['video/mpeg'],
|
||||||
'.mts': ['video/mp2t'],
|
'.mts': ['video/mp2t'],
|
||||||
|
'.mxf': ['application/mxf'],
|
||||||
'.vob': ['video/mpeg'],
|
'.vob': ['video/mpeg'],
|
||||||
'.webm': ['video/webm'],
|
'.webm': ['video/webm'],
|
||||||
'.wmv': ['video/x-ms-wmv'],
|
'.wmv': ['video/x-ms-wmv'],
|
||||||
@@ -141,9 +142,12 @@ export const mimeTypes = {
|
|||||||
const contentType = lookup(filename);
|
const contentType = lookup(filename);
|
||||||
if (contentType.startsWith('image/')) {
|
if (contentType.startsWith('image/')) {
|
||||||
return AssetType.Image;
|
return AssetType.Image;
|
||||||
} else if (contentType.startsWith('video/')) {
|
}
|
||||||
|
|
||||||
|
if (contentType.startsWith('video/') || contentType === 'application/mxf') {
|
||||||
return AssetType.Video;
|
return AssetType.Video;
|
||||||
}
|
}
|
||||||
|
|
||||||
return AssetType.Other;
|
return AssetType.Other;
|
||||||
},
|
},
|
||||||
getSupportedFileExtensions: () => [...Object.keys(image), ...Object.keys(video)],
|
getSupportedFileExtensions: () => [...Object.keys(image), ...Object.keys(video)],
|
||||||
|
|||||||
Reference in New Issue
Block a user