gpac / mp4box.js

JavaScript version of GPAC's MP4Box tool
https://gpac.github.io/mp4box.js/
BSD 3-Clause "New" or "Revised" License
1.98k stars 333 forks source link

Demux and get vps sps pps not right #225

Closed numberwolf closed 3 years ago

numberwolf commented 3 years ago

This is vps by stream analyzer(software) image

This is vps by mp4box.js image

Can not decode and play image

File [

https://user-images.githubusercontent.com/11828206/102516009-5db9e480-40c9-11eb-937e-84468156b90b.mp4

](url)

cconcolato commented 3 years ago

I don't know how you construct the naluVPS in your play.js file, but when I load it in http://localhost:9000/test/filereader.html the data looks correct:image I think in your code you forget that the VPS array is an array that starts with a number of NAL:

for (j=0; j < numOfArrays; j++) {
unsigned int(1) array_completeness;
bit(1) reserved = 0;
unsigned int(6) NAL_unit_type;
unsigned int(16) numNalus;
for (i=0; i< numNalus; i++) {
unsigned int(16) nalUnitLength;
bit(8*nalUnitLength) nalUnit;
}
}

That's why your buffers all start with 0,0,0,1