[FFmpeg-devel] m1v support in ffmpeg libavformat/mov.c

François Revol revol
Wed Aug 20 00:53:41 CEST 2008


> Hi Francois,
>     I have found a type of QuickTime video which works in QuickTime
> player application, but not in ffmpeg.  It appears that the QuickTime
> player application thinks it's acceptable to wrap an MPEG1 stream in 
> a
> .mov file.

Hi Gordon,
thanks for telling, but please, use the mailing list, so others can 
see.

> I have an example file, and have made some patches to the
> libavformat/mov.c source to allow for the processing of the file.  
> The

Also, patches are supposed to be sent in diff format (preferably 
unified diff).
svn diff will generate them. Sending bits of code prevents telling 
which part of the file you refer to, which version, as well as which 
lines actually changed.

You do use the svn version, don't you ?

> file now processes, however, the stream codec framerate differs
> significantly from the container framerate, so the output video
> appears very short.  I'm afraid that my skills aren't quite up to
> snuff, and after a few hours of trying different things, I'm deciding
> to cry "uncle" and to pass the issue along to someone who actually
> knows something about these things.  If the solution isn't 
> immediately
> obvious to you, you can throw it back to me and I'll keep at it, but
> after having reviewed your code, you clearly know leaps and bounds
> more about this stuff than I do.

I'll have a look at it, but I didn't touch mov.c for quite some time, 
maybe someone else will be faster.
It might be possible the mpeg1 stream has to be sniffed by the codec to 
detect correct framerate.

Fran?ois.

> Example file:
> http://www.gmccreight.com/m1v_in_mov.mov
> 
> 
> Patch #1 (m1v option added):
> 
> else if(type == MKTAG('m','1','a',' '))
>     st->codec->codec_id = CODEC_ID_MP2;
> else if(type == MKTAG('m','1','v',' '))
>     st->codec->codec_id = CODEC_ID_MPEG1VIDEO;
> else if(type == MKTAG('s','u','b','p')) {
>     st->codec->codec_type = CODEC_TYPE_SUBTITLE;
> }
> 
> 
> Patch #2 (handle CODEC_ID_MPEG1VIDEO) case:
> 
> case CODEC_ID_AMR_NB:
>     st->codec->frame_size= sc->samples_per_frame;
>     st->codec->sample_rate= 8000;
>     st->codec->channels= 1; /* really needed */
>     break;
> case CODEC_ID_MP2:
> case CODEC_ID_MPEG1VIDEO:
>     st->codec->codec_type = CODEC_TYPE_VIDEO;
>     break;
> case CODEC_ID_MP3:
>     st->codec->codec_type = CODEC_TYPE_AUDIO; /* force type after 
> stsd
> for m1a hdlr */
>     st->need_parsing = AVSTREAM_PARSE_FULL;
>     break;
> 





More information about the ffmpeg-devel mailing list