Commit a22b228c authored by Timo Teräs's avatar Timo Teräs

main/ffmpeg: fix flv/aac metadata when using bitfilters

parent 8f2469e4
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=ffmpeg
pkgver=2.3.4
pkgrel=1
pkgrel=2
pkgdesc="Complete and free Internet live audio and video broadcasting solution for Linux/Unix"
url="http://ffmpeg.org/"
arch="all"
......@@ -14,6 +14,7 @@ makedepends="lame-dev libvorbis-dev xvidcore-dev zlib-dev
depends=
source="http://ffmpeg.org/releases/ffmpeg-$pkgver.tar.bz2
configure-dlvsym.patch
fix-flv-extradata.patch
fix-defines.patch
fix-libv4l2-errors.patch"
......@@ -80,13 +81,16 @@ libs() {
md5sums="d6a0c7f0827a2446ca2bed11ac9bf608 ffmpeg-2.3.4.tar.bz2
d041c60890392d80f74a567523f4c54d configure-dlvsym.patch
5f39e099cd7dfe71bb2f6b6615623d67 fix-flv-extradata.patch
fad4fc1e886146a4a2befc8fda052d50 fix-defines.patch
2b6897f352583ee8efdc0c09ef27a30f fix-libv4l2-errors.patch"
sha256sums="2f7dece56ea72a22c7cf49e50b58eaadef340457404395cc0479c843b42344f8 ffmpeg-2.3.4.tar.bz2
ffd6beadaea4cdbc1326fe396d8cd34b3efb791a865a32f64b3fe998b679c1d0 configure-dlvsym.patch
8324bd3e154c151e64df36afd1edf05b8dc2dcd8e520208be0355a34b4209ad5 fix-flv-extradata.patch
4ccac0cf75fe53685c4cdda4061f7248de9a9b98e11f8e3aed8e1822b94d35d1 fix-defines.patch
872236e91e393b62a1a9d7aebdf0c417314f874a67cef55ad37b39ee57cf9edb fix-libv4l2-errors.patch"
sha512sums="bfb2c33a1d10bd5f8f226a82ca99a9486d1e68e54f8cdb996b13f57a49e731ce9c0606392d92e8486e6cbc9ee75d241cf1abb2127ca274ce1ee67144e6b86c6a ffmpeg-2.3.4.tar.bz2
d9bb652093b1c2d03cead78bcafd59fc8305f36fe5359ac5d7caf038889f1239829e288c07e77a11bbef89de5fe54a5eae50a1c4718ec77137bb677ef9069e54 configure-dlvsym.patch
d4d369055ef9ec8742f971786b05b89a5748a32cee711f623b71e8aea54b004bebda4e618017a351162647360632b13bcc7f09059938734e692ec841fe769c46 fix-flv-extradata.patch
ea2630d4ae5383bc24a322318aa8c41af745145755333660deec4ed256096eca73a49c41a0921544dfaa53d8087378cb2b5654001332c7262ea39f18e5c472c8 fix-defines.patch
56bba30f200c748d47d60d2b18147522dbceec7e8c97f434d3dbfa239547113a3e9d3b280e22816adeafa994b22eefac4b968448afef1a07aa1c46d3ec359e68 fix-libv4l2-errors.patch"
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;
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment