79484074

Date: 2025-03-04 15:09:54
Score: 1
Natty:
Report link

Thanks to this awnser I found that it was because I was using camera videos, this cameras uses annex B, which means i have a start code. AVCC do not need the start code but instead needs the size of the NAL.

Here is my method to convert Annex B to AVCC

    private ConvertAnnexB2AVCC(nal: Uint8Array): Uint8Array {
        const nalLength = nal.length;

        // Big endian size format
        const lengthHeader = new Uint8Array(4);
        lengthHeader[0] = (nalLength >> 24) & 0xFF;
        lengthHeader[1] = (nalLength >> 16) & 0xFF;
        lengthHeader[2] = (nalLength >> 8) & 0xFF;
        lengthHeader[3] = (nalLength) & 0xFF;

        // Create a new buffer with the size at the start
        let avccNal = new Uint8Array(4 + nalLength);
        avccNal.set(lengthHeader, 0);
        avccNal.set(nal, 4);

        return avccNal;
    }

Hope it'll help someone !

Reasons:
  • Blacklisted phrase (0.5): Thanks
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: Casah__