[FFmpeg-cvslog] ffmpeg: Copy extradata if it has been initialized later from the encoder

Michael Niedermayer git at videolan.org
Sun Sep 7 04:19:17 CEST 2014


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Sat Sep  6 04:42:48 2014 +0200| [ab84effdeda931a74d8503891488ed538619a5d3] | committer: Michael Niedermayer

ffmpeg: Copy extradata if it has been initialized later from the encoder

Fixes Ticket3909

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ab84effdeda931a74d8503891488ed538619a5d3
---

 ffmpeg.c |    8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/ffmpeg.c b/ffmpeg.c
index 220816b..0807eec 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -590,6 +590,14 @@ static void write_frame(AVFormatContext *s, AVPacket *pkt, OutputStream *ost)
     AVCodecContext          *avctx = ost->st->codec;
     int ret;
 
+    if (!ost->st->codec->extradata_size && ost->enc_ctx->extradata_size) {
+        ost->st->codec->extradata = av_mallocz(ost->enc_ctx->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);
+        if (ost->st->codec->extradata) {
+            memcpy(ost->st->codec->extradata, ost->enc_ctx->extradata, ost->enc_ctx->extradata_size);
+            ost->st->codec->extradata_size = ost->enc_ctx->extradata_size;
+        }
+    }
+
     if ((avctx->codec_type == AVMEDIA_TYPE_VIDEO && video_sync_method == VSYNC_DROP) ||
         (avctx->codec_type == AVMEDIA_TYPE_AUDIO && audio_sync_method < 0))
         pkt->pts = pkt->dts = AV_NOPTS_VALUE;



More information about the ffmpeg-cvslog mailing list