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

Eran Kornblau eran.kornblau at kaltura.com
Fri Jun 1 10:00:20 EEST 2018


> On Thu, May 31, 2018 at 10:11:38AM +0000, Eran Kornblau wrote:
> > > 
> > > -----Original Message-----
> > > From: ffmpeg-devel [mailto:ffmpeg-devel-bounces at ffmpeg.org] On 
> > > Behalf Of Eran Kornblau
> > > Sent: Friday, May 25, 2018 4:40 PM
> > > To: FFmpeg development discussions and patches 
> > > <ffmpeg-devel at ffmpeg.org>
> > > Subject: [FFmpeg-devel] qt-faststart bug near 4GB
> > > 
> > > 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...
> > > 
> > Attaching the patch for this issue.
> > As expected, it required significant changes... hope you will like it 
> > :)
> > 
> > Thanks!
> > 
> > Eran
> 
> about the AV_WB* macros, i like them alot :) but this seems not to apply cleanly:
> 
> Applying: qt-faststart - stco offset bug fix Using index info to reconstruct a base tree...
> M	tools/qt-faststart.c
> Falling back to patching base and 3-way merge...
> Auto-merging tools/qt-faststart.c
> CONFLICT (content): Merge conflict in tools/qt-faststart.c
> error: Failed to merge in the changes.
> Patch failed at 0001 qt-faststart - stco offset bug fix Use 'git am --show-current-patch' to see the failed patch When you have resolved this problem, run "git am --continue".
> If you prefer to skip this patch, run "git am --skip" instead.
> To restore the original branch and stop patching, run "git am --abort".
> 
Sorry Michael, I forgot to revert the previous patch before committing.
Attaching a fixed patch.

Thanks

Eran

> [...]
> 
> -- 
> Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
> 
> Into a blind darkness they enter who follow after the Ignorance, they as if into a greater darkness enter who devote themselves to the Knowledge alone. -- Isha Upanishad
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-qt-faststart-stco-offset-bug-fix.patch
Type: application/octet-stream
Size: 14517 bytes
Desc: 0001-qt-faststart-stco-offset-bug-fix.patch
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20180601/b6220cc1/attachment.obj>


More information about the ffmpeg-devel mailing list