Fix incorrect video depth being written in ISOBMFF for video tracks with an alpha channel (fixes #450)

This commit is contained in:
Vanilagy
2026-07-30 17:45:33 +02:00
parent c3df2a24e5
commit d5362e20ad
3 changed files with 19 additions and 10 deletions
+6 -2
View File
@@ -718,8 +718,12 @@ export const videoSampleDescription = (
u32(0x00480000), // Vertical resolution
u32(0), // Reserved
u16(1), // Frame count
Array(32).fill(0), // Compressor name
u16(0x0018), // Depth
// Compressor name
ascii('Mediabunny'),
Array(32 - 'Mediabunny'.length).fill(0),
u16(trackData.info.hasAlphaChannel ? 32 : 24), // Depth
i16(0xffff), // Pre-defined
], [
VIDEO_CODEC_TO_CONFIGURATION_BOX[trackData.track.source._codec]?.(trackData) ?? null,
+5
View File
@@ -108,6 +108,7 @@ export type IsobmffTrackData = {
* https://stackoverflow.com/questions/24884827
*/
requiresAnnexBTransformation: boolean;
hasAlphaChannel: boolean;
};
} | {
track: OutputAudioTrack;
@@ -413,6 +414,9 @@ export class IsobmffMuxer extends Muxer {
den: displayAspectHeight * decoderConfig.codedWidth,
});
// Kicks for ProRes 4444.
const hasAlphaChannel = decoderConfig.codec === 'ap4h' || decoderConfig.codec === 'ap4x';
const newTrackData: IsobmffVideoTrackData = {
muxer: this,
track,
@@ -423,6 +427,7 @@ export class IsobmffMuxer extends Muxer {
pixelAspectRatio,
decoderConfig: decoderConfig,
requiresAnnexBTransformation,
hasAlphaChannel,
},
timescale,
samples: [],