Use more parts of codec string to determine av1C

This commit is contained in:
David Payr
2024-12-30 00:16:22 +01:00
parent 94b43bf8da
commit 06cedf1a26
2 changed files with 9 additions and 9 deletions
+1 -1
View File
@@ -21,7 +21,7 @@
const output = new Metamuxer.Output({ target, format });
const mediaSource = new Metamuxer.VideoFrameSource({
codec: 'vp9',
codec: 'av1',
bitrate: 1e6
});
output.addVideoTrack(mediaSource);
+8 -8
View File
@@ -646,18 +646,18 @@ export const av1C = (trackData: IsobmffVideoTrackData) => {
const profile = Number(parts[1]);
const levelAndTier = parts[2]!;
const level = Number(levelAndTier.slice(0, -1));
const tier = levelAndTier.slice(-1) === 'H' ? 1 : 0;
const bitDepth = Number(parts[3]);
const secondByte = (profile << 5) + level;
// The following values are educated, very likely guesses (typical 4:2:0 chroma subsampling)
const tier = levelAndTier.slice(-1) === 'H' ? 1 : 0;
const bitDepth = Number(parts[3]);
const highBitDepth = bitDepth === 8 ? 0 : 1;
const twelveBit = 0;
const monochrome = 0;
const chromaSubsamplingX = 1;
const chromaSubsamplingY = 1;
const chromaSamplePosition = 1; // CSP_VERTICAL
const monochrome = parts[4] ? Number(parts[4]) : 0;
const chromaSubsamplingX = parts[5] ? Number(parts[5][0]) : 1;
const chromaSubsamplingY = parts[5] ? Number(parts[5][1]) : 1;
const chromaSamplePosition = parts[5] ? Number(parts[5][2]) : 0; // CSP_UNKNOWN
const thirdByte = (tier << 7)
+ ((bitDepth === 8 ? 0 : 1) << 6)
+ (highBitDepth << 6)
+ (twelveBit << 5)
+ (monochrome << 4)
+ (chromaSubsamplingX << 3)