Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

this.ext incorrectly parsed in MP4BoxOutputFile.addTrack({avcDecoderConfigRecord}) #308

Open
vjeux opened this issue Dec 27, 2022 · 0 comments

Comments

@vjeux
Copy link

vjeux commented Dec 27, 2022

If you run the following code:

const MP4BoxOutputFile = MP4Box.createFile();
const trackID = MP4BoxOutputFile.addTrack({
  width,
  height,
  brands: ['mp42', 'isom'],
  timescale: 90000,
  language: 21956,
  name: 'VideoHandler',

  // https://gist.github.com/uupaa/8493378ec15f644a3d2b
  avcDecoderConfigRecord: (new Uint8Array([
    1, // configurationVersion
    77, // AVCProfileIndication
    0, // profile_compatibility
    40, // AVCLevelIndication
    0b111111 << 2 ^ // reserved
      3, // lengthSizeMinusOne
    0b111 << 5 ^ // reserved
    
      1, // numOfSequenceParameterSets
    0, 27, // sequenceParameterSetLength
    39, 77, 0, 40, 137, 139, 96, 60, 1, 19, 242, 224, 33, 129, 128, 2, 238, 0, 0, 187, 130, 247, 190, 15, 132, 66, 55, // sequenceParameterSetNALUnit

    1, // numOfPictureParameterSets
    0, 4, // pictureParameterSetLength
    40, 238, 31, 32, // pictureParameterSetNALUnit

    // ???
    0, 0, 0, 16, 115, 116, 116, 115
  ])).buffer,
});

I would expect this.ext to be [0, 0, 0, 16, 115, 116, 116, 115]. But this.ext isn't there.

I've tracked the issue there:

The avcC box is created here:
https://github.com/gpac/mp4box.js/blob/master/src/isofile-advanced-creation.js#L86

which calls the parse function but this.size and this.hdr_size are undefined.
https://github.com/gpac/mp4box.js/blob/master/src/parsing/avcC.js#L10

So toparse here is NaN and it doesn't add the ext.
https://github.com/gpac/mp4box.js/blob/master/src/parsing/avcC.js#L27

In practice the ext data is probably garbage anyway in my case (I'm still trying to understand the file format) but figured I would mention it here if you think it should be fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant