[FFmpeg-devel] qt-faststart bug near 4GB

Eran Kornblau eran.kornblau at kaltura.com
Fri May 25 16:40:21 EEST 2018


Hi all,

We encountered a rather extreme edge case with qt-faststart - we transcoded some video with ffmpeg,
and the offset of the last video frame in the resulting mp4 was slightly less than 4GB.
Since it was less than 4GB, ffmpeg used an 'stco' atom and not a 'co64' atom.
When we ran qt-faststart on this file, it added the moov atom size to all offsets in the 'stco' atom, causing
an overflow in the offsets of the frames close to the end of the file. The end of the video was therefore
corrupt and could not be played.
I think the solution here is to 'upgrade' the 'stco' atom to 'co64' if such an edge case happens. However,
looking at the code of qt-faststart, I see that it doesn't actually parse the atom tree, but rather looks
for the strings 'stco' / 'co64'. Changing 'stco' to 'co64' requires updating the size of all the atom in which
it's contained (moov, trak, mdia etc.)
Therefore, such a change would probably be more of a rewrite of this utility than a patch, so wanted to
check whether anyone has any thoughts on this before I start writing...

Thanks!

Eran


More information about the ffmpeg-devel mailing list