Skip to content

Commit

Permalink
Copy over initial_padding, extradata_size and extradata from avctx to
Browse files Browse the repository at this point in the history
newly created audio stream

This is needed for audio codecs that for example use the CodecPrivate
element in the WEBM container. The CodecPrivate field can contain
headers or other additional data. The audio codec OPUS cannot be
decoded without this element. Some audio codecs also define an
initial_padding which can be written as CodecDelay into the WEBM
container.
  • Loading branch information
Felix Matouschek committed Oct 12, 2017
1 parent 45fb210 commit 24c8dfb
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/AVMuxer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,14 @@ bool AVMuxer::Private::prepareStreams()
c->channel_layout = aenc->audioFormat().channelLayoutFFmpeg();
c->channels = aenc->audioFormat().channels();
c->bits_per_raw_sample = aenc->audioFormat().bytesPerSample()*8; // need??

AVCodecContext *avctx = (AVCodecContext *) aenc->codecContext();
c->initial_padding = avctx->initial_padding;
if (avctx->extradata_size) {
c->extradata = avctx->extradata;
c->extradata_size = avctx->extradata_size;
}

audio_streams.push_back(s->id);
}
}
Expand Down

0 comments on commit 24c8dfb

Please sign in to comment.