[FFmpeg-devel] [PATCH] Re: movenc.c: Allow MPEG2.mov playable under QuickTime Player

Baptiste Coudurier baptiste.coudurier
Fri Feb 11 02:30:47 CET 2011

On 02/10/2011 05:04 PM, Takashi Mochizuki wrote:
>> You can do this in a simpler way, check if trk->entry is 0 in
>> mov_write_packet, and force SYNC_SAMPLE.
> It also requires to patch mov_write_stss_tag(), to make both stss and
> stps in one func. call. Cheking track->cluster[i].flags inside for()
> loop and update both stss/stps atom accordingly. I think it is
> strict, but not fast. Dividing stps and stss atom writer in two
> function seems to be better way though.

No it doesn't, try:
if (trk->entry == 0)
     trk->cluster[0].flags = MOV_SYNC_SAMPLE;

or check for trk->entry == 0 before parsing the mpeg2 frame.

>> Also you _will_ have the first 2 b frames _broken_ during playback
>> this is not wanted, you must adjust the edit list accordingly.
> I think it is not required. Under my test clip, first 2 b frame
> correctly handled in QuickTime (QTKit apps) without edts hack.

No they can't, if this is the case, your file is actually _closed gop_ 
but not marked as so.

> edts hack is common way for mp4 container. But it is not applied if
> it is mov container. (QuickTime uses edls-elst atom for just
> cut/copy/paste/trim media, not for frame adjust)

First, edts is not a hack. Second FCP uses it for exactly that same 
reason, except that it will _keep_ the keyframe before so the 2 b frames 
can be decoded.

Key fingerprint                 8D77134D20CC9220201FC5DB0AC9325C5C1ABAAA
FFmpeg maintainer                                  http://www.ffmpeg.org

More information about the ffmpeg-devel mailing list