Skip to content

Instantly share code, notes, and snippets.

@romen
Created September 14, 2012 01:17
Show Gist options
  • Save romen/3719207 to your computer and use it in GitHub Desktop.
Save romen/3719207 to your computer and use it in GitHub Desktop.
Patch libav to avoid waveformatextensible header in AVI with >2 channels audio streams
--- a/libavformat/riffenc.c 2014-02-23 22:59:10.000000000 +0100
+++ b/libavformat/riffenc.c 2014-03-26 15:12:11.000000000 +0100
@@ -70,7 +70,10 @@
if (!frame_size)
frame_size = enc->frame_size;
- waveformatextensible = (enc->channels > 2 && enc->channel_layout) ||
+ /* Patched libav to avoid waveformatextensible header in AVI with
+ * >2 channels audio streams to improve compatibility as per
+ * http://ffmpeg-users.933282.n4.nabble.com/AC3-encoding-problem-wrong-audio-tag-tp4651779p4651810.html */
+ waveformatextensible = (enc->channels > 20 && enc->channel_layout) ||
enc->sample_rate > 48000 ||
av_get_bits_per_sample(enc->codec_id) > 16;
@romen
Copy link
Author

romen commented Mar 26, 2014

Updated for ffmpeg 2.0+

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment