mirror of
https://github.com/arcodange-org/mediabunny.git
synced 2026-10-03 22:03:49 +02:00
Fix incorrect video depth being written in ISOBMFF for video tracks with an alpha channel (fixes #450)
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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: [],
|
||||
|
||||
Reference in New Issue
Block a user