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. Also, Michael Niedermayer, at least in this case, MPlayer seems to look at the codec tag rather than the codec ID in order to determine the codec. Therefore, your patch from 2014 for SMI -> SVQ3 needs to set the 'fourcc' variable to 'SVQ3' as well, which is later copied to st->codec->codec_tag in matroskadec.c. Mats -- Mats Peterson http://matsp888.no-ip.org/~mats/
>From 23eaed6643438aad492df6ef820f5297688078e1 Mon Sep 17 00:00:00 2001 From: Mats Peterson <matsp...@yahoo.com> Date: Tue, 5 Jan 2016 13:38:51 +0100 Subject: [PATCH v3] lavf/matroskadec: A_QUICKTIME/AV_CODEC_ID_NONE + SMI->SVQ3 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. Also, Michael Niedermayer, at least in this case, MPlayer seems to look at the codec tag rather than the codec ID in order to determine the codec. Therefore, your patch from 2014 for SMI -> SVQ3 needs to set the 'fourcc' variable to 'SVQ3' as well, which is later copied to st->codec->codec_tag in matroskadec.c. Mats --- libavformat/matroskadec.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c index 9de7cfb..9b4dd98 100644 --- a/libavformat/matroskadec.c +++ b/libavformat/matroskadec.c @@ -1869,6 +1869,15 @@ static int matroska_parse_tracks(AVFormatContext *s) fourcc = AV_RL32(track->codec_priv.data); codec_id = ff_codec_get_id(ff_codec_movaudio_tags, fourcc); } + if (codec_id == AV_CODEC_ID_NONE) { + if (track->audio.bitdepth == 8) { + fourcc = MKTAG('r','a','w',' '); + codec_id = ff_codec_get_id(ff_codec_movaudio_tags, fourcc); + } else if (track->audio.bitdepth == 16) { + fourcc = MKTAG('t','w','o','s'); + codec_id = ff_codec_get_id(ff_codec_movaudio_tags, fourcc); + } + } } else if (!strcmp(track->codec_id, "V_QUICKTIME") && (track->codec_priv.size >= 21) && (track->codec_priv.data)) { @@ -1878,8 +1887,10 @@ static int matroska_parse_tracks(AVFormatContext *s) fourcc = AV_RL32(track->codec_priv.data); codec_id = ff_codec_get_id(ff_codec_movvideo_tags, fourcc); } - if (codec_id == AV_CODEC_ID_NONE && AV_RL32(track->codec_priv.data+4) == AV_RL32("SMI ")) - codec_id = AV_CODEC_ID_SVQ3; + if (codec_id == AV_CODEC_ID_NONE && AV_RL32(track->codec_priv.data+4) == AV_RL32("SMI ")) { + fourcc = MKTAG('S','V','Q','3'); + codec_id = ff_codec_get_id(ff_codec_movaudio_tags, fourcc); + } if (codec_id == AV_CODEC_ID_NONE) { char buf[32]; av_get_codec_tag_string(buf, sizeof(buf), fourcc); -- 1.7.10.4
_______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel