Skip to content

Commit 054678c

Browse files
committed
Set the global header flag if the container format requires it
Some containers, e.g. Matroska, requires the headers be written in the global headers section, not in each packet. The encoder should be notified, if that is the case.
1 parent a311629 commit 054678c

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/AvTranscoder/file/OutputFile.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,16 @@ IOutputStream& OutputFile::addVideoStream(const VideoCodec& videoDesc)
4242
stream.codec->level = videoDesc.getAVCodecContext().level;
4343
stream.codec->field_order = videoDesc.getAVCodecContext().field_order;
4444

45+
if (_formatContext.getAVOutputFormat().flags & AVFMT_GLOBALHEADER) {
46+
stream.codec->flags = CODEC_FLAG_GLOBAL_HEADER;
47+
}
48+
49+
// if the codec is experimental, allow it
50+
if(videoDesc.getAVCodec().capabilities & CODEC_CAP_EXPERIMENTAL) {
51+
LOG_WARN("This codec is considered experimental by libav/ffmpeg:" << videoDesc.getCodecName());
52+
stream.codec->strict_std_compliance = FF_COMPLIANCE_EXPERIMENTAL;
53+
}
54+
4555
// some codecs need/can use extradata to decode
4656
uint8_t* srcExtradata = videoDesc.getAVCodecContext().extradata;
4757
const int srcExtradataSize = videoDesc.getAVCodecContext().extradata_size;

0 commit comments

Comments
 (0)