In many older QuickTime files, the audio format, or "fourcc", is
0x00000000 (AV_CODEC_ID_NONE). 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 861ecae89d3a33ae9dffa34494569fb9994071ff Mon Sep 17 00:00:00 2001
From: Mats Peterson <matsp...@yahoo.com>
Date: Mon, 4 Jan 2016 21:40:25 +0100
Subject: [PATCH] lavf/mov: Audio and AV_CODEC_ID_NONE

In many older QuickTime files, the audio format, or "fourcc", is
0x00000000 (AV_CODEC_ID_NONE). 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 |   11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index 78081ce..f3ed85e 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -1899,6 +1899,17 @@ static void mov_parse_stsd_audio(MOVContext *c, AVIOContext *pb,
         sc->samples_per_frame = 160;
         sc->bytes_per_frame   = 33;
         break;
+    case AV_CODEC_ID_NONE:
+        if (st->codec->bits_per_coded_sample == 8) {
+            st->codec->codec_tag = MKTAG('r','a','w',' ');
+            st->codec->codec_id = ff_codec_get_id(ff_codec_movaudio_tags,
+                    st->codec->codec_tag);
+        } else if (st->codec->bits_per_coded_sample == 16) {
+            st->codec->codec_tag = MKTAG('t','w','o','s');
+            st->codec->codec_id = ff_codec_get_id(ff_codec_movaudio_tags,
+                    st->codec->codec_tag);
+        }
+        break;
     default:
         break;
     }
-- 
1.7.10.4

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

Reply via email to