Created
August 8, 2022 09:06
-
-
Save sky0014/491cd2c39b38515ddfec0fa6f9a00cee to your computer and use it in GitHub Desktop.
convert annex-b format to normal nalu
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (v.getUint32(offset + lengthSize) === 1) { | |
const bytes = new Uint8Array( | |
arrayBuffer, | |
dataOffset + offset + 4, | |
naluSize | |
); | |
const nals = parseNal({ | |
codec: Codec.H264, | |
bytes | |
}); | |
nals.nals.forEach(nal => { | |
const writer = new BufferWriter( | |
new ArrayBuffer(nal.naluData.length + 4) | |
); | |
writer.writeUint32(nal.naluData.length).write(nal.naluData); | |
nalArray.push(new Uint8Array(writer.buf)); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment