The following text was contributed by @murmur to the HbbTV Specification WG activity on DRM guidelines but is not related to DRM. It was felt the developer portal may be a suitable home.
BTRT box in init.mp4 files:
some older HbbTV players may crash if BTRT(bitrate) box is before SINF box.
solution is to drop BTRT box or write after SINF box.
correct ordering is MOOV/TRAK/MDIA/MINF/STBL/STSD/ENCV/SINF, /BTRT
dash and hls players don't need BTRT so it's safe to drop from the init segment.
SENC box in segment.m4s files:
some older HbbTV players may crash if SENC(sample encryption) box is before TRUN
(fragment run) box.
solution is to write after TRUN box
correct ordering is MOOF/TRAF/TFHD, /TFDT, /TRUN, /SAIZ, /SAIO, /SENC
SIDX box in segment.m4s files:
write one SIDX box at the start of segment file with 1..n references to MOOF/MDAT
fragments.
use single fragment (MOOF/MDAT pair) for best compatibility.
Segment durations:
Dash specification allows a small +/- variation in m4s segment file durations. It is relatively easy
to split video stream by using an even integer FPS-GOP(Group of Picture) values.
Audio segments may not 100% match to video segments unless video segmenting is fine tuned
to follow the audio codec packet sizes. It is best not to use AAC 44100Hz but always transcode
48000Hz sample rate.
The following table describes the easy to understand even-integer and less known non-integer
durations to have a fully aligned video and audio segment durations. It may not always be
possible to use non-integer value in some of the encoder and packager tools.
H264, H265 Video and AAC Audio (48000Hz, 1024 packet size)
use 8 seconds segment duration to fully match both segments
align video IDR key frames to 2-8 seconds interval
every other even-integer values produce a small +/- variation in audio durations when
comparing the same $Number.m4s files (video/1..n.m4s = audio/1..n.m4s).
H264, H265 Video (25fps, 50fps) and AAC Audio (48000Hz, 1024 packet size)
use 3.84 seconds segment duration to fully match both segments
align video IDR key frames to 3.84 seconds interval
H264, H265 Video (30fps, 60fps) and AAC Audio (48000Hz, 1024 packet size)
use 3.20 seconds segment duration to fully match both segments
align video IDR key frames to 3.20 seconds interval
The following text was contributed by @murmur to the HbbTV Specification WG activity on DRM guidelines but is not related to DRM. It was felt the developer portal may be a suitable home.
BTRT box in init.mp4 files: