[FFmpeg-devel] [PATCH]lavf/mpegtsenc: Automatically insert dump_extra for asp muxing

Carl Eugen Hoyos cehoyos at ag.or.at
Tue Nov 8 13:25:00 EET 2016


Hi!

Attached patch allows automatic insertion of dump_extra when 
remuxing mpeg4 asp.

Please comment, Carl Eugen
-------------- next part --------------
From 8ff75d4fa9127f3f02dde9408795f27c8d0e9c2c Mon Sep 17 00:00:00 2001
From: Carl Eugen Hoyos <cehoyos at ag.or.at>
Date: Tue, 8 Nov 2016 12:22:26 +0100
Subject: [PATCH] lavf/mpegtsenc: Automatically insert dump_extra for asp
 muxing.

---
 libavformat/mpegtsenc.c |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c
index 71a6642..9e98fd2 100644
--- a/libavformat/mpegtsenc.c
+++ b/libavformat/mpegtsenc.c
@@ -28,6 +28,7 @@
 #include "libavutil/opt.h"
 
 #include "libavcodec/internal.h"
+#include "libavcodec/mpeg4video.h"
 
 #include "avformat.h"
 #include "avio_internal.h"
@@ -1823,8 +1824,12 @@ static int mpegts_check_bitstream(struct AVFormatContext *s, const AVPacket *pkt
                               (st->codecpar->extradata_size > 0 &&
                                st->codecpar->extradata[0] == 1)))
             ret = ff_stream_add_bitstream_filter(st, "hevc_mp4toannexb", NULL);
+    } else if (st->codecpar->codec_id == AV_CODEC_ID_MPEG4) {
+        if (pkt->size >= 5 && AV_RB32(pkt->data) != VOS_STARTCODE &&
+                              st->codecpar->extradata_size >= 5 &&
+                              AV_RB32(st->codecpar->extradata) == VOS_STARTCODE)
+            ret = ff_stream_add_bitstream_filter(st, "dump_extra", NULL);
     }
-
     return ret;
 }
 
-- 
1.7.10.4



More information about the ffmpeg-devel mailing list