APPLICATION: A CLI tool to parse mp4 file, show boxes and validate the structure
winlinvip opened this issue · 2 comments
winlinvip commented
Like objs/research/librtmp/srs_flv_parser
, I need a mp4 parser CLI.
winlinvip commented
winlin:srs winlin$ ./objs/srs_mp4_parser html/dash/testpic_2s/V300/init.mp4
SRS MP4 parser/3.0.24, parse and show the mp4 boxes structure.
[2017-06-04 10:36:15.663][Trace][2384][0] Parse MP4 file html/dash/testpic_2s/V300/init.mp4, verbose=0
[2017-06-04 10:36:15.664][Trace][2384][0] MP4 file open success
[2017-06-04 10:36:15.664][Trace][2384][0] MP4 box reader open success
html/dash/testpic_2s/V300/init.mp4
ftyp, 32B, brands:iso5,0(isom,iso5,dash,mp42)
skip, 37B, free 29B
0x00, 0x00, 0x00, 0x1d, 0x6d, 0x6f, 0x62, 0x69
moov, 646B, 3 boxes
mvhd, 108B, FB(4B), 0ms, TBN=90000, nTID=3
trak, 490B, 2 boxes
tkhd, 92B, FB(4B,V0,0x07), track #2, 0TBN, size=640x360
mdia, 390B, 3 boxes
mdhd, 32B, FB(4B), TBN=90000, 0TBN
hdlr, 59B, FB(4B), vide, MobiTV Video Media handler
minf, 291B, 3 boxes
vmhd, 20B, FB(4B)
dinf, 36B, 1 boxes
dref, 28B, FB(4B), 1 childs(+)
URL: Same file
stbl, 227B, 5 boxes
stsd, 151B, FB(4B), 1 childs(+)
avc1, 135B, refs#1, size=640x360, 1 boxes
avcC, 49B, AVC Config: 41B
0x01, 0x64, 0x00, 0x1e, 0xff, 0xe1, 0x00, 0x19,
0x67, 0x64, 0x00, 0x1e, 0xac, 0xd9, 0x40, 0xa0,
0x2f, 0xf9, 0x61, 0x00, 0x00, 0x03, 0x00, 0x01,
0x00, 0x00, 0x03, 0x00, 0x3c, 0x8f, 0x16, 0x2d,
0x96, 0x01, 0x00, 0x05, 0x68, 0xeb, 0xec, 0xb2,
0x2c
stts, 16B, FB(4B), 0 childs (+)
stsc, 16B, FB(4B), 0 childs (+)
stsz, 20B, FB(4B), size=0, 0 childs (+)
stco, 16B, FB(4B), 0 childs (+)
mvex, 40B, 1 boxes
trex, 32B, FB(4B), track=#2, default-sample(index:1, size:0, duration:0, flags:0)
[2017-06-04 10:36:15.664][Trace][2384][0] Parse complete
winlin:srs winlin$
winlinvip commented
winlin:srs winlin$ ./objs/srs_mp4_parser html/dash/testpic_2s/V300/743408904.m4s
SRS MP4 parser/3.0.24, parse and show the mp4 boxes structure.
[2017-06-04 10:35:08.703][Trace][2326][0] Parse MP4 file html/dash/testpic_2s/V300/743408904.m4s, verbose=0
[2017-06-04 10:35:08.704][Trace][2326][0] MP4 file open success
[2017-06-04 10:35:08.704][Trace][2326][0] MP4 box reader open success
html/dash/testpic_2s/V300/743408904.m4s
styp, 24B, brands:msdh,0(msdh,dash)
moof, 1048B, 2 boxes
mfhd, 16B, FB(4B), sequence=743408904
traf, 1024B, 3 boxes
tfhd, 16B, FB(4B,V0,0x20000), track=2, moof-base
tfdt, 20B, FB(4B,V1,0x00), bmdt=133813602720000
trun, 980B, FB(4B,V0,0xf01), samples=60, data-offset=1056
duration=3000, size=7319, flags=33554432, cts=6000
duration=3000, size=597, flags=16777216, cts=15000
duration=3000, size=371, flags=16777216, cts=6000
duration=3000, size=218, flags=16777216, cts=0
duration=3000, size=266, flags=16777216, cts=3000
duration=3000, size=438, flags=16777216, cts=15000
duration=3000, size=327, flags=16777216, cts=6000
duration=3000, size=297, flags=16777216, cts=0
mdat, 37692B, total 37684 bytes
[2017-06-04 10:35:08.704][Trace][2326][0] Parse complete