[FFmpeg-devel] [HACK] mov.c: Handle MPEG-in-MOV (#241 and friends)

Michael Niedermayer michaelni at gmx.at
Wed Oct 17 02:35:07 CEST 2012

On Tue, Oct 16, 2012 at 09:33:24PM +0200, Petter Ericson wrote:
> On Tue, Oct 16, 2012 at 06:43:50PM +0200, Hendrik Leppkes wrote:
> > On Tue, Oct 16, 2012 at 5:18 PM, Petter Ericson
> > <petter.ericson at codemill.se> wrote:
> > > Greetings,
> > >
> > > Attached is a patch that handles the files provided in #241 and duplicates.
> > > Needless to say, it is extremely hacky and would benefit from improvements,
> > > but as it stands, it checks for the two places I have found the m1s tag, and
> > > forces continued probing until mpegps_probe gets enough data to find its
> > > own header. I considered using the mpegps demuxer as a "subprocess" simliar
> > > to how DVDemuxer is used, but this proved to be too much trouble for me,
> > > given that it really isn't made to work in that way, and the above
> > > approach got the desired result.
> > >
> > > Improvements (rudimentary MOV parsing in the probe?) very welcome.
> > >
> > 
> > The fixed offset of the tag in the file seems rather arbitrary to me.
> > Did you confirm on multiple samples that its in that exact spot every
> > time?
> I checked two - my own sample and the one in the original ticket. They both
> had the first offset (0x21E). A different duplicate (#600 something) had the
> smaller offset due to missing the initial ftyp section before the moov atom.
> I agree that something better should be found - a fixed offset from the
> moov atom could probably work better, but that again takes us into 
> rudimentary parsing territory. One might refactor the switch/case to use
> score = MAX(returnvalue, score) or something like that, which would at least
> allow slightly more flexibility - I'll cook something up tomorrow and
> resubmit unless someone gets there before me.

if you dont want to write a simple parser. One could simply scan the
first X bytes for a valid looking stsd + m1v tag, that would avoid
the fixed offset and checking 2 tags should make false positives less

Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Democracy is the form of government in which you can choose your dictator
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20121017/50209f87/attachment.asc>

More information about the ffmpeg-devel mailing list