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

Carl Eugen Hoyos cehoyos at ag.or.at
Wed Nov 21 02:01:11 CET 2012


On Wednesday 14 November 2012 11:59:37 am Carl Eugen Hoyos wrote:
> Hi!
>
> 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.

New patch attached.

Please comment, Carl Eugen
-------------- next part --------------
diff --git a/libavformat/isom.c b/libavformat/isom.c
index 3271056..45e99cd 100644
--- a/libavformat/isom.c
+++ b/libavformat/isom.c
@@ -228,7 +228,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 cff9c92..838a727 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -1257,7 +1257,14 @@ int ff_mov_read_stsd_entries(MOVContext *c, AVIOContext *pb, int entries)
             st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
         } else if (st->codec->codec_type != AVMEDIA_TYPE_AUDIO && /* do not overwrite codec type */
                    format && format != MKTAG('m','p','4','s')) { /* skip old asf mpeg4 tag */
+            AVDictionaryEntry *major_brand = av_dict_get(c->fc->metadata, "major_brand", NULL, AV_DICT_MATCH_CASE);
+            /* Flash Media Server streams files with Sorenson Spark and tag H263 */
+            if (format == MKTAG('H','2','6','3') && major_brand &&
+                strstr(major_brand->value, "f4v")) {
+                id = AV_CODEC_ID_FLV1;
+            } else {
-            id = ff_codec_get_id(ff_codec_movvideo_tags, format);
+                id = ff_codec_get_id(ff_codec_movvideo_tags, format);
+            }
             if (id <= 0)
                 id = ff_codec_get_id(ff_codec_bmp_tags, format);
             if (id > 0)


More information about the ffmpeg-devel mailing list