From 825809cf7e5e010df2f05120da8decd04db56751 Mon Sep 17 00:00:00 2001 From: Mike Boers Date: Wed, 8 Jun 2016 21:06:58 -0400 Subject: [PATCH] Clear the codec_tag when creating a stream from a template This is generally expected when re-muxing --- av/container/output.pyx | 5 +++++ include/libavcodec/avcodec.pxd | 2 ++ 2 files changed, 7 insertions(+) diff --git a/av/container/output.pyx b/av/container/output.pyx index 7cad6ea7f..17a9732d9 100644 --- a/av/container/output.pyx +++ b/av/container/output.pyx @@ -69,6 +69,11 @@ cdef class OutputContainer(Container): # Copy from the template. if template is not None: lib.avcodec_copy_context(codec_context, template._codec_context) + # Reset the codec tag assuming we are remuxing. + codec_context.codec_tag = 0 + # Copy flags assuming we are remuxing.s + if self.proxy.ptr.oformat.flags & lib.AVFMT_GLOBALHEADER: + codec_context.flags |= lib.CODEC_FLAG_GLOBAL_HEADER # Now lets set some more sane video defaults elif codec.type == lib.AVMEDIA_TYPE_VIDEO: diff --git a/include/libavcodec/avcodec.pxd b/include/libavcodec/avcodec.pxd index ac0767ed9..5cefc5eaa 100644 --- a/include/libavcodec/avcodec.pxd +++ b/include/libavcodec/avcodec.pxd @@ -90,7 +90,9 @@ cdef extern from "libavcodec/avcodec.pyav.h" nogil: AVMediaType codec_type char codec_name[32] + unsigned int codec_tag AVCodecID codec_id + int flags int thread_count