In many older QuickTime files, the audio format, or "fourcc", is
0x00000000. The QuickTime File Format Specification states the following
regarding this situation:

"This format descriptor should not be used, but may be found in some
files. Samples are assumed to be stored in either 'raw ' or 'twos'
format, depending on the sample size field in the sound description."

MPlayer handles this logic by itself, but FFmpeg/FFplay currently does
not.

Mats

--
Mats Peterson
http://matsp888.no-ip.org/~mats/
>From 640e12e8450a630f1569009094ac1bd51d8cfebf Mon Sep 17 00:00:00 2001
From: Mats Peterson <matsp...@yahoo.com>
Date: Fri, 8 Jan 2016 12:59:13 +0100
Subject: [PATCH v3] lavf/mov: Audio and fourcc 0x00000000

In many older QuickTime files, the audio format, or "fourcc", is
0x00000000. The QuickTime File Format Specification states the following
regarding this situation:

"This format descriptor should not be used, but may be found in some
files. Samples are assumed to be stored in either 'raw ' or 'twos'
format, depending on the sample size field in the sound description."

MPlayer handles this logic by itself, but FFmpeg/FFplay currently does
not.

Mats

---
 libavformat/mov.c |   16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index 78081ce..f6462f7 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -1812,9 +1812,16 @@ static void mov_parse_stsd_audio(MOVContext *c, AVIOContext *pb,
                                  AVStream *st, MOVStreamContext *sc)
 {
     int bits_per_sample, flags;
-    uint16_t version = avio_rb16(pb);
+    uint32_t format;
+    uint16_t version;
     AVDictionaryEntry *compatible_brands = av_dict_get(c->fc->metadata, "compatible_brands", NULL, AV_DICT_MATCH_CASE);
 
+    avio_seek(pb, -12, SEEK_CUR);
+    format = avio_rb32(pb);
+    avio_seek(pb, 8, SEEK_CUR);
+
+    version = avio_rb16(pb);
+
     avio_rb16(pb); /* revision level */
     avio_rb32(pb); /* vendor */
 
@@ -1863,6 +1870,13 @@ static void mov_parse_stsd_audio(MOVContext *c, AVIOContext *pb,
         }
     }
 
+    if (format == 0) {
+        if (st->codec->bits_per_coded_sample == 8)
+            st->codec->codec_id = mov_codec_id(st, MKTAG('r','a','w',' '));
+        else if (st->codec->bits_per_coded_sample == 16)
+            st->codec->codec_id = mov_codec_id(st, MKTAG('t','w','o','s'));
+    }
+
     switch (st->codec->codec_id) {
     case AV_CODEC_ID_PCM_S8:
     case AV_CODEC_ID_PCM_U8:
-- 
1.7.10.4

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

Reply via email to