mirror of
https://github.com/arcodange-org/mediabunny.git
synced 2026-10-03 05:43:50 +02:00
Use more parts of codec string to determine av1C
This commit is contained in:
+1
-1
@@ -21,7 +21,7 @@
|
|||||||
const output = new Metamuxer.Output({ target, format });
|
const output = new Metamuxer.Output({ target, format });
|
||||||
|
|
||||||
const mediaSource = new Metamuxer.VideoFrameSource({
|
const mediaSource = new Metamuxer.VideoFrameSource({
|
||||||
codec: 'vp9',
|
codec: 'av1',
|
||||||
bitrate: 1e6
|
bitrate: 1e6
|
||||||
});
|
});
|
||||||
output.addVideoTrack(mediaSource);
|
output.addVideoTrack(mediaSource);
|
||||||
|
|||||||
@@ -646,18 +646,18 @@ export const av1C = (trackData: IsobmffVideoTrackData) => {
|
|||||||
const profile = Number(parts[1]);
|
const profile = Number(parts[1]);
|
||||||
const levelAndTier = parts[2]!;
|
const levelAndTier = parts[2]!;
|
||||||
const level = Number(levelAndTier.slice(0, -1));
|
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;
|
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 twelveBit = 0;
|
||||||
const monochrome = 0;
|
const monochrome = parts[4] ? Number(parts[4]) : 0;
|
||||||
const chromaSubsamplingX = 1;
|
const chromaSubsamplingX = parts[5] ? Number(parts[5][0]) : 1;
|
||||||
const chromaSubsamplingY = 1;
|
const chromaSubsamplingY = parts[5] ? Number(parts[5][1]) : 1;
|
||||||
const chromaSamplePosition = 1; // CSP_VERTICAL
|
const chromaSamplePosition = parts[5] ? Number(parts[5][2]) : 0; // CSP_UNKNOWN
|
||||||
const thirdByte = (tier << 7)
|
const thirdByte = (tier << 7)
|
||||||
+ ((bitDepth === 8 ? 0 : 1) << 6)
|
+ (highBitDepth << 6)
|
||||||
+ (twelveBit << 5)
|
+ (twelveBit << 5)
|
||||||
+ (monochrome << 4)
|
+ (monochrome << 4)
|
||||||
+ (chromaSubsamplingX << 3)
|
+ (chromaSubsamplingX << 3)
|
||||||
|
|||||||
Reference in New Issue
Block a user