diff options
author | Timo Teräs <timo.teras@iki.fi> | 2014-12-04 12:00:10 +0200 |
---|---|---|
committer | Timo Teräs <timo.teras@iki.fi> | 2014-12-04 12:00:10 +0200 |
commit | a22b228c20bb2e9ec09270beb68c556396690792 (patch) | |
tree | 13bfa1654a35ded689d0639dc0212ec5562b2036 /main/ffmpeg/fix-flv-extradata.patch | |
parent | 8f2469e413757e12582b651b24f49b0fb0072a34 (diff) | |
download | aports-a22b228c20bb2e9ec09270beb68c556396690792.tar.bz2 aports-a22b228c20bb2e9ec09270beb68c556396690792.tar.xz |
main/ffmpeg: fix flv/aac metadata when using bitfilters
Diffstat (limited to 'main/ffmpeg/fix-flv-extradata.patch')
-rw-r--r-- | main/ffmpeg/fix-flv-extradata.patch | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/main/ffmpeg/fix-flv-extradata.patch b/main/ffmpeg/fix-flv-extradata.patch new file mode 100644 index 0000000000..2fe5b08bcc --- /dev/null +++ b/main/ffmpeg/fix-flv-extradata.patch @@ -0,0 +1,44 @@ +https://trac.ffmpeg.org/ticket/3175 + +This patch is slightly cleaned up version of: +http://lists.ffmpeg.org/pipermail/ffmpeg-devel/2014-May/157791.html + +diff -ru ffmpeg-2.3.4.orig/libavformat/flvenc.c ffmpeg-2.3.4/libavformat/flvenc.c +--- ffmpeg-2.3.4.orig/libavformat/flvenc.c 2014-10-03 04:49:20.000000000 -0300 ++++ ffmpeg-2.3.4/libavformat/flvenc.c 2014-12-04 11:37:23.286586875 -0200 +@@ -414,11 +414,35 @@ + if (enc->codec_id == AV_CODEC_ID_AAC) { + avio_w8(pb, get_audio_flags(s, enc)); + avio_w8(pb, 0); // AAC sequence header ++ if (enc->extradata_size < 2) { ++ static const int mpeg4audio_sample_rates[16] = { ++ 96000, 88200, 64000, 48000, 44100, 32000, ++ 24000, 22050, 16000, 12000, 11025, 8000, 7350 ++ }; ++ int sample_rate_index; ++ ++ av_log(s, AV_LOG_WARNING, "AAC extradata empty!.\n"); ++ for (sample_rate_index = 0; sample_rate_index < 16; sample_rate_index++) ++ if (enc->sample_rate == mpeg4audio_sample_rates[sample_rate_index]) ++ break; ++ ++ if (sample_rate_index < 16 && (enc->extradata = av_mallocz(2)) != NULL) { ++ enc->extradata_size = 2; ++ enc->extradata[0] = 0x10 | (sample_rate_index>>1); ++ enc->extradata[1] = (sample_rate_index & 0x01)<<7 | enc->channels <<3; ++ } ++ } ++ if (enc->extradata_size >= 2) ++ av_log(s, AV_LOG_DEBUG, "AAC extradata size %d: %02x:%02x.\n", enc->extradata_size, enc->extradata[0], enc->extradata[1]); + avio_write(pb, enc->extradata, enc->extradata_size); + } else { + avio_w8(pb, enc->codec_tag | FLV_FRAME_KEY); // flags + avio_w8(pb, 0); // AVC sequence header + avio_wb24(pb, 0); // composition time ++ if(enc->extradata_size>=2) ++ av_log(s, AV_LOG_DEBUG, "Video extradata size %d: %02x:%02x.\n", enc->extradata_size, enc->extradata[0], enc->extradata[1]); ++ else ++ av_log(s, AV_LOG_WARNING, "Video extradata empty!.\n"); + ff_isom_write_avcc(pb, enc->extradata, enc->extradata_size); + } + data_size = avio_tell(pb) - pos; |