javascriptparsingmedia-playermpeg-dashmedia-source

how to parse `sidx` of MP4 dash file


I'm trying to parse the sidx segment to use it on dash streaming! ( I prefer to use javascript for it )

I have the sidx range and I have already buffered it .. but it's all in hexadecimal. . I'm trying to make it as a known object to calculate segments range and buffer it into sourcebuffer.

here's the sidx

0000 01dc 7369 6478 0000 0000 0000 0001
0001 5f90 0000 0000 0000 0000 0000 0025
0002 9ae6 0006 df92 9000 0000 0002 95b8
0006 df92 9000 0000 0002 96d5 0006 df92
9000 0000 0002 96d7 0006 df92 9000 0000
0002 97d2 0006 df92 9000 0000 0002 a0ae
0006 df92 9000 0000 0002 990c 0006 df92
9000 0000 0002 9814 0006 df92 9000 0000
0002 967f 0006 df92 9000 0000 0002 929c
0006 df92 9000 0000 0002 98a3 0006 df92
9000 0000 0002 96b3 0006 df92 9000 0000
0002 9715 0006 df92 9000 0000 0002 95bb
0006 df92 9000 0000 0002 956e 0006 df92
9000 0000 0002 9513 0006 df92 9000 0000
0002 9816 0006 df92 9000 0000 0002 9e21
0006 df92 9000 0000 0002 9603 0006 df92
9000 0000 0002 99aa 0006 df92 9000 0000
0002 9956 0006 df92 9000 0000 0002 9c49
0006 df92 9000 0000 0002 988e 0006 df92
9000 0000 0002 97a6 0006 df92 9000 0000
0002 9992 0006 df92 9000 0000 0002 9d00
0006 df92 9000 0000 0002 9567 0006 df92
9000 0000 0002 93bd 0006 df92 9000 0000
0002 9775 0006 df92 9000 0000 0002 99c3
0006 df92 9000 0000 0002 920f 0006 df92
9000 0000 0002 96cd 0006 df92 9000 0000
0002 00bd 0006 df92 9000 0000 0002 96f5
0006 df92 9000 0000 0002 97f2 0006 df92
9000 0000 0001 5ee9 0006 df92 9000 0000
0000 37e3 0001 b7d5 9000 0000

and I have to get this from it:

Screenshot from mp4parser

and I have some references for this but I can't get it completely ref1 ref2


Solution

  • Thanks to @kanongil from bitparser now I can parse the bits easily. the structure was the same as the mp4parser and the bit length was on references I shared. You can find everything you need from the links I shared.