[FFmpeg-cvslog] avformat/flvenc: add no_metadata to flvflags

Steven Liu git at videolan.org
Tue Nov 22 04:19:18 EET 2016


ffmpeg | branch: master | Steven Liu <lq at chinaffmpeg.org> | Mon Nov 21 20:26:11 2016 +0800| [d316b21dba227fa2a2bce0daf02a62f11821227f] | committer: Steven Liu

avformat/flvenc: add no_metadata to flvflags

some flv have no metadata,
ffmpeg will same with the source flv stream.

Signed-off-by: Steven Liu <lingjiujianke at gmail.com>

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

 doc/muxers.texi      | 3 +++
 libavformat/flvenc.c | 8 +++++++-
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/doc/muxers.texi b/doc/muxers.texi
index 806182a..8689341 100644
--- a/doc/muxers.texi
+++ b/doc/muxers.texi
@@ -148,6 +148,9 @@ Place AAC sequence header based on audio stream data.
 @item no_sequence_end
 Disable sequence end tag.
 
+ at item no_metadata
+Disable metadata tag.
+
 @item add_keyframe_index
 Used to facilitate seeking; particularly for HTTP pseudo streaming.
 @end table
diff --git a/libavformat/flvenc.c b/libavformat/flvenc.c
index 4ca6aea..177052a 100644
--- a/libavformat/flvenc.c
+++ b/libavformat/flvenc.c
@@ -67,6 +67,7 @@ typedef enum {
     FLV_AAC_SEQ_HEADER_DETECT = (1 << 0),
     FLV_NO_SEQUENCE_END = (1 << 1),
     FLV_ADD_KEYFRAME_INDEX = (1 << 2),
+    FLV_NO_METADATA = (1 << 3),
 } FLVFlags;
 
 typedef struct FLVFileposition {
@@ -744,7 +745,11 @@ static int flv_write_header(AVFormatContext *s)
             flv->reserved = 5;
         }
 
-    write_metadata(s, 0);
+    if (flv->flags & FLV_NO_METADATA) {
+        pb->seekable = 0;
+    } else {
+        write_metadata(s, 0);
+    }
 
     for (i = 0; i < s->nb_streams; i++) {
         flv_write_codec_header(s, s->streams[i]->codecpar);
@@ -1055,6 +1060,7 @@ static const AVOption options[] = {
     { "flvflags", "FLV muxer flags", offsetof(FLVContext, flags), AV_OPT_TYPE_FLAGS, {.i64 = 0}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "flvflags" },
     { "aac_seq_header_detect", "Put AAC sequence header based on stream data", 0, AV_OPT_TYPE_CONST, {.i64 = FLV_AAC_SEQ_HEADER_DETECT}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "flvflags" },
     { "no_sequence_end", "disable sequence end for FLV", 0, AV_OPT_TYPE_CONST, {.i64 = FLV_NO_SEQUENCE_END}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "flvflags" },
+    { "no_metadata", "disable metadata for FLV", 0, AV_OPT_TYPE_CONST, {.i64 = FLV_NO_METADATA}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "flvflags" },
     { "add_keyframe_index", "Add keyframe index metadata", 0, AV_OPT_TYPE_CONST, {.i64 = FLV_ADD_KEYFRAME_INDEX}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "flvflags" },
     { NULL },
 };



More information about the ffmpeg-cvslog mailing list