bluesky
bluesky

Reputation: 155

Meaning of "ffprobe -v trace demo.mp4" output

The 'mdat box' of Mp4 file may at the last of file. I want to know the position of 'mdat' box using 'ffmpeg' or 'ffprobe'.

Mp4 consists of 'ftyp', 'moov' and 'mdat' BOX. each BOX consists of "BoxHeader" and "BoxData". "BoxHeader" consists of "BoxSize(4Byte)", "BoxType(4Byte)", "BoxLargesize(8Byte, only have when box size exceeding the range of 4Byte expression, then the value of BoxSize is 1)".

In program, you could first read 8 Byte and know the size of 'ftyp box', then seek the size and read 8 Byte to know if the next box is 'moov box'. If not 'moov', it shoud be 'mdat box', then seek cross 'mdat box' to find 'mdat box'...

But I want to use 'ffprobe' to find the position of 'moov'. I use 'ffprobe -v trace demo.mp4', and output is like below

[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fc8fd000e00] Format mov,mp4,m4a,3gp,3g2,mj2 probed with size=2048 and score=100
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fc8fd000e00] type:'ftyp' parent:'root' sz: 28 8 41044500
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fc8fd000e00] ISO: File Type Major Brand: mp42
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fc8fd000e00] type:'moov' parent:'root' sz: 17943 36 41044500
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fc8fd000e00] type:'mvhd' parent:'moov' sz: 108 8 17935

I want to know the meaning of type:'ftyp' parent:'root' sz: 28 8 41044500: type:'ftyp' parent:'root'is easy to know, sz: 28 8 41044500 is really make me confused, I guess 28 is size of ftyp box,but the meaning of 8 41044500 is what?

Could you explain the meaning of sz: 28 8 41044500, and where could find the doc?

Upvotes: 2

Views: 1320

Answers (1)

Gyan
Gyan

Reputation: 93038

Consider

type:'mvhd' parent:'moov' sz: 108 8 17935

type and parent represent the type of the current and parent box respectively.

There are three values for sz (size).

The first value, 108 represents the total size of the current box, including the header.

The second value, 8, represents the starting offset of the box data relative to the start of the box header. This is needed because box size can be 8 bytes and box type can have a UUID, in which case, may be up to 20 bytes long. This offset will be non-zero even if the box has no data e.g. free.

The third value, 17935, is the data size of the parent box.

Upvotes: 2

Related Questions