[FFmpeg-devel] [PATCH]Support tag H263 both for QuickTime / Perian and Flash Media Server

Carl Eugen Hoyos cehoyos at ag.or.at
Sat Dec 1 17:11:34 CET 2012


On Saturday 01 December 2012 02:14:35 pm Michael Niedermayer wrote:
> On Sat, Dec 01, 2012 at 10:11:27AM +0000, Carl Eugen Hoyos wrote:
> > Michael Niedermayer <michaelni <at> gmx.at> writes:
> > > > > Flash Media Server streams f4v containing Sorenson Spark with tag
> > > > > H263, some QuickTime users like to remux their H263 streams into
> > > > > mov. I don't know how this can be solved differently.
> > >
> > > maybe ok but do you have a testcase so i can take a look if theres no
> > > cleaner way ?
> >
> > http://samples.ffmpeg.org/F4V/
> >
> > Everything != "f4v" is H263
>
> st->codec->codec_name contains Sorenson H263
> that is more correct to test, adding a test to the existing one for:
> if (!memcmp(st->codec->codec_name, "Planar Y'CbCr 8-bit 4:2:0", 25))
>
> might work

New patch attached.

Thank you, Carl Eugen
-------------- next part --------------
diff --git a/libavformat/isom.c b/libavformat/isom.c
index 2c412dd..be36f1e 100644
--- a/libavformat/isom.c
+++ b/libavformat/isom.c
@@ -227,7 +227,7 @@ const AVCodecTag ff_codec_movvideo_tags[] = {
 
     { AV_CODEC_ID_DIRAC,     MKTAG('d', 'r', 'a', 'c') },
     { AV_CODEC_ID_DNXHD,     MKTAG('A', 'V', 'd', 'n') }, /* AVID DNxHD */
-//  { AV_CODEC_ID_FLV1,      MKTAG('H', '2', '6', '3') }, /* Flash Media Server */
+//  { AV_CODEC_ID_FLV1,      MKTAG('H', '2', '6', '3') }, /* Flash Media Server, forced in demuxer */
     { AV_CODEC_ID_MSMPEG4V3, MKTAG('3', 'I', 'V', 'D') }, /* 3ivx DivX Doctor */
     { AV_CODEC_ID_RAWVIDEO,  MKTAG('A', 'V', '1', 'x') }, /* AVID 1:1x */
     { AV_CODEC_ID_RAWVIDEO,  MKTAG('A', 'V', 'u', 'p') },
diff --git a/libavformat/mov.c b/libavformat/mov.c
index 149bd20..f380b39 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -1259,7 +1259,6 @@ int ff_mov_read_stsd_entries(MOVContext *c, AVIOContext *pb, int entries)
             int color_greyscale;
             int color_table_id;
 
-            st->codec->codec_id = id;
             avio_rb16(pb); /* version */
             avio_rb16(pb); /* revision level */
             avio_rb32(pb); /* vendor */
@@ -1283,6 +1282,11 @@ int ff_mov_read_stsd_entries(MOVContext *c, AVIOContext *pb, int entries)
             /* codec_tag YV12 triggers an UV swap in rawdec.c */
             if (!memcmp(st->codec->codec_name, "Planar Y'CbCr 8-bit 4:2:0", 25))
                 st->codec->codec_tag=MKTAG('I', '4', '2', '0');
+            /* Flash Media Server streams files with Sorenson Spark and tag H263 */
+            if (!memcmp(st->codec->codec_name, "Sorenson H263", 13)
+                && format == MKTAG('H','2','6','3'))
+                id = AV_CODEC_ID_FLV1;
+            st->codec->codec_id = id;
 
             st->codec->bits_per_coded_sample = avio_rb16(pb); /* depth */
             color_table_id = avio_rb16(pb); /* colortable id */


More information about the ffmpeg-devel mailing list