[FFmpeg-devel] Does ffmpeg allow negative cts_offset in mp4 trun box?

Matt Wolenetz wolenetz at google.com
Sat Oct 1 01:08:29 EEST 2016


Per spec, if cts_offset is signed, the box version needs to be set to 1.
Yet I see no corresponding condition around this in libavformat/movenc.c;
version is hardcoded to 0 and the *signed int32* typed value is written out.

This can cause issues in players if they follow the spec and expect a
version 0 box to contain unsigned int32 cts_offset values. If ffmpeg had a
negative value, a conformant player will interpret that value as a huge
positive value (due to version 0 logic).

Does ffmpeg somehow guarantee that trun cts_offsets are always positive? If
not, this looks like a bug in ffmpeg mp4 muxing.


More information about the ffmpeg-devel mailing list