amarghosh / mp4viewer

MP4 file analyser for converting ISO-bmff atoms into json, or display them on the command line or a GTK based window
https://pypi.org/project/mp4viewer/
MIT License
51 stars 20 forks source link

fixed issue with signed compositional offsets #5

Closed markniebur closed 6 years ago

markniebur commented 6 years ago

That was a bug in the initial changes I sent to you. According to the spec, trun is:

aligned(8) class TrackRunBox extends FullBox(‘trun’, version, tr_flags) {
unsigned int(32) sample_count;
// the following are optional fields
signed int(32) data_offset;
unsigned int(32) first_sample_flags;
// all fields in the following array are optional
{
unsigned int(32) sample_duration;
unsigned int(32) sample_size;
unsigned int(32) sample_flags
if (version == 0) { unsigned int(32) sample_composition_time_offset; }
else { signed int(32) sample_composition_time_offset; }
}[ sample_count ]
}

So composition offset should always be 32 bits.