mirror of
https://github.com/arcodange-org/mediabunny.git
synced 2026-09-27 19:03:46 +02:00
feat: Add support for custom MP4 metadata with mdta format (#132)
* feat: Add support for custom MP4 metadata with mdta format
- Add metadataFormat option ('mdir' | 'mdta') to IsobmffOutputFormatOptions
- Implement complete mdta format with keys box generation
- Enable custom metadata fields readable by ffmpeg/ffprobe
- Maintain backward compatibility with default mdir format
* Refactor ISOBMFF metadata tag writing logic
* Autism
---------
Co-authored-by: tanfu <[email protected]>
Co-authored-by: Vanilagy <[email protected]>
This commit is contained in:
co-authored by
tanfu
Vanilagy
parent
d426d36386
commit
420423bc0f
@@ -64,6 +64,7 @@ The following options are available:
|
||||
type IsobmffOutputFormatOptions = {
|
||||
fastStart?: false | 'in-memory' | 'reserve' | 'fragmented';
|
||||
minimumFragmentDuration?: number;
|
||||
metadataFormat?: 'mdir' | 'mdta' | 'udta' | 'auto';
|
||||
|
||||
onFtyp?: (data: Uint8Array, position: number) => unknown;
|
||||
onMoov?: (data: Uint8Array, position: number) => unknown;
|
||||
@@ -94,6 +95,12 @@ type IsobmffOutputFormatOptions = {
|
||||
The default option; it behaves like `'in-memory'` when using [`BufferTarget`](./writing-media-files#buffertarget) and like `false` otherwise.
|
||||
- `minimumFragmentDuration`\
|
||||
Only relevant when `fastStart` is `'fragmented'`. Sets the minimum duration in seconds a fragment must have to be finalized and written to the file. Defaults to 1 second.
|
||||
- `metadataFormat`\
|
||||
The metadata format to use for writing metadata tags.
|
||||
- `'auto'` (default): Behaves like `'mdir'` for MP4 and like `'udta'` for QuickTime, matching FFmpeg's default behavior.
|
||||
- `'mdir'`: Write tags into `moov/udta/meta` using the 'mdir' handler format.
|
||||
- `'mdta'`: Write tags into `moov/udta/meta` using the 'mdta' handler format, equivalent to FFmpeg's `use_metadata_tags` flag. This allows for custom keys of arbitrary length.
|
||||
- `'udta'`: Write tags directly into `moov/udta`.
|
||||
- `onFtyp`\
|
||||
Will be called once the ftyp (File Type) box of the output file has been written.
|
||||
- `onMoov`\
|
||||
|
||||
Reference in New Issue
Block a user