[FFmpeg-devel] [PATCH]Improve MPEG-in-mov detection

Michael Niedermayer michaelni at gmx.at
Sat Oct 20 02:24:30 CEST 2012


On Fri, Oct 19, 2012 at 07:41:29PM +0200, Carl Eugen Hoyos wrote:
> Hi!
> 
> Sorry for coming late!
> 
> I found one MPEG-in-mov sample that is still recognised as mov (it has a 
> description of "\x0\x0\x0\x0") and tried to read the QuickTime specification.
> 
> As I understand it, we should search for "MPEG" media description, patch is 
> attached.
> (I also verified that QuickTime accepts other values than "m1s " for 
> mpeg-in-mov.)
> 
> Please comment, Carl Eugen

CC-ing Petter


>  mov.c |   17 ++++++++---------
>  1 file changed, 8 insertions(+), 9 deletions(-)
> 969f7dad379c73515053bb482e23e6edb74675c0  patchmovmpeg.diff
> diff --git a/libavformat/mov.c b/libavformat/mov.c
> index b296c24..24b68c8 100644
> --- a/libavformat/mov.c
> +++ b/libavformat/mov.c
> @@ -2908,15 +2908,14 @@ static int mov_probe(AVProbeData *p)
>           * MOV-packed MPEG-PS */
>          offset = moov_offset;
>  
> -        while(offset < (p->buf_size - 20)){ /* Sufficient space */
> -               /* We found an actual stsd atom */
> -            if(AV_RL32(p->buf+offset)       == MKTAG('s','t','s','d') &&
> -               /* Make sure there's only one stream */
> -               AV_RB32(p->buf + offset + 8)  == 1 &&
> -               AV_RL32(p->buf + offset + 16) == MKTAG('m','1','s',' ')
> -            ){
> -                av_log(NULL, AV_LOG_WARNING, "Found m1s tag indicating this is a MOV-packed MPEG-PS.\n");
> -                /* We found an stsd atom describing an MPEG-PS-in-MOV, return a
> +        while(offset < (p->buf_size - 16)){ /* Sufficient space */
> +               /* We found an actual hdlr atom */
> +            if(AV_RL32(p->buf + offset     ) == MKTAG('h','d','l','r') &&
> +               AV_RL32(p->buf + offset +  8) == MKTAG('m','h','l','r') &&
> +               AV_RL32(p->buf + offset + 12) == MKTAG('M','P','E','G')){
> +                av_log(NULL, AV_LOG_WARNING, "Found media data tag MPEG indicating this is a MOV-packed MPEG-PS.\n");
> +                /* We found a media handler reference atom describing an
> +                 * MPEG-PS-in-MOV, return a
>                   * low score to force expanding the probe window until
>                   * mpegps_probe finds what it needs */
>                  return 5;

> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Asymptotically faster algorithms should always be preferred if you have
asymptotical amounts of data
-------------- 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/20121020/d77b34ba/attachment.asc>


More information about the ffmpeg-devel mailing list