2
votes

I am currently parsing a MPEG-DASH stream initialization segment (generated by FFMPEG) and I noticed that the timescale is specified at multiple different places in my file:

  • In the movie header box (mvhd): 1000
  • In the media header box of my video track (mdhd): 15360
  • In the AVC Configuration box (avcC) more precisely in the VUI section of the sequence parameter set NAL unit: 60

Why is it specified in so many different places? Why do they have different values? Is there a hierarchy in these value? For example does 60 overrides 15360 and 15360 overrides 1000?

Here's the command I used to generate the file I am looking at:

ffmpeg -f v4l2 -pixel_format yuyv422 -vcodec rawvideo -framerate 30 -video_size 640x360 -i /dev/video0 \
        -f dash -remove_at_exit false -use_template true -use_timeline true -streaming true -window_size 5 -extra_window_size 5 -seg_duration 5 -vcodec libx264 -b:v 1M -maxrate 1M -bufsize 2M  -pix_fmt yuv420p -r 30 -s 640x360 -aspect 16:9 /var/www/html/media/live.mpd
1

1 Answers

2
votes

In the movie header box (mvhd): 1000

This is the movie timescale. It's used in places such as the duration field of edit list entries.

In the media header box of my video track (mdhd): 15360

This is the track timescale. This is used for the sample timestamp field in edit list entries and the duration field in the stts, stss, ctts boxes. ffmpeg (& other apps) will generate timestamps based on this timescale.

In the AVC Configuration box (avcC) more precisely in the VUI section of the sequence parameter set NAL unit: 60

That's the encoder time-base. The encoder uses timestamps denominated in this time-base for ratecontrol purposes. This is the tbc value that ffmpeg shows. This is internal to the bitstream and the container pays no heed to it.