[FFmpeg-cvslog] avformat/flvenc: use extract_extradata bsf when necessary

Zhao Zhili git at videolan.org
Sun Apr 9 16:45:50 EEST 2023


ffmpeg | branch: master | Zhao Zhili <zhilizhao at tencent.com> | Thu Mar 16 00:27:51 2023 +0800| [34b8af796341887766cfa02fe5f4383039919bb6] | committer: Zhao Zhili

avformat/flvenc: use extract_extradata bsf when necessary

Signed-off-by: Zhao Zhili <zhilizhao at tencent.com>

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

 libavformat/flvenc.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/libavformat/flvenc.c b/libavformat/flvenc.c
index 64ea554dad..fbf7eabaf8 100644
--- a/libavformat/flvenc.c
+++ b/libavformat/flvenc.c
@@ -1023,13 +1023,15 @@ fail:
 static int flv_check_bitstream(AVFormatContext *s, AVStream *st,
                                const AVPacket *pkt)
 {
-    int ret = 1;
-
     if (st->codecpar->codec_id == AV_CODEC_ID_AAC) {
         if (pkt->size > 2 && (AV_RB16(pkt->data) & 0xfff0) == 0xfff0)
-            ret = ff_stream_add_bitstream_filter(st, "aac_adtstoasc", NULL);
+            return ff_stream_add_bitstream_filter(st, "aac_adtstoasc", NULL);
     }
-    return ret;
+    if (!st->codecpar->extradata_size &&
+            (st->codecpar->codec_id == AV_CODEC_ID_H264 ||
+             st->codecpar->codec_id == AV_CODEC_ID_MPEG4))
+        return ff_stream_add_bitstream_filter(st, "extract_extradata", NULL);
+    return 1;
 }
 
 static void flv_deinit(AVFormatContext *s)



More information about the ffmpeg-cvslog mailing list