diff mbox

[FFmpeg-devel,2/2] avformat/flvenc: add no_sequence_end flags for flvflags

Message ID CADxeRwkRqkNLEV=cEtuak7SmLsOohvpghQpiAVZYcrEdXsv+zA@mail.gmail.com
State Accepted
Headers show

Commit Message

Steven Liu Sept. 13, 2016, 2:10 p.m. UTC
when split flv file by flv format at first, and cat flvs file
into one flv file, the flv sequence end is be used,
then the whole flv have many flv sequence end TAG.
this flags can give user an option to ignore write sequence end TAG

Signed-off-by: Steven Liu <lingjiujianke@gmail.com>
---
 libavformat/flvenc.c | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)


     file_size = avio_tell(pb);
@@ -723,6 +726,7 @@ static int flv_write_packet(AVFormatContext *s,
AVPacket *pkt)
 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" },
     { NULL },
 };

--
2.7.4 (Apple Git-66)

Comments

Michael Niedermayer Sept. 14, 2016, 12:31 a.m. UTC | #1
On Tue, Sep 13, 2016 at 10:10:40PM +0800, Steven Liu wrote:
[...]
>  flvenc.c |   18 +++++++++++-------
>  1 file changed, 11 insertions(+), 7 deletions(-)
> 42fedcf3213941fce3f2c0a6ea879002e178fa75  0002-avformat-flvenc-add-no_sequence_end-flags-for-flvfla.patch
> From c0297aa790e72b14bd01fcb5862e66636bc43400 Mon Sep 17 00:00:00 2001
> From: Steven Liu <lingjiujianke@gmail.com>
> Date: Tue, 13 Sep 2016 22:03:59 +0800
> Subject: [PATCH 2/2] avformat/flvenc: add no_sequence_end flags for flvflags
> 
> when split flv file by flv format at first, and cat flvs file
> into one flv file, the flv sequence end is be used,
> then the whole flv have many flv sequence end TAG.
> this flags can give user an option to ignore write sequence end TAG
> 
> Signed-off-by: Steven Liu <lingjiujianke@gmail.com>
> ---
>  libavformat/flvenc.c | 18 +++++++++++-------
>  1 file changed, 11 insertions(+), 7 deletions(-)

missing update to docs/


> 
> diff --git a/libavformat/flvenc.c b/libavformat/flvenc.c
> index a3623f8..9e95b8d 100644
> --- a/libavformat/flvenc.c
> +++ b/libavformat/flvenc.c
> @@ -63,6 +63,7 @@ static const AVCodecTag flv_audio_codec_ids[] = {
>  
>  typedef enum {
>      FLV_AAC_SEQ_HEADER_DETECT = (1 << 0),
> +    FLV_NO_SEQUENCE_END = (1 << 1),
>  } FLVFlags;
>  
>  typedef struct FLVContext {
> @@ -527,13 +528,15 @@ static int flv_write_trailer(AVFormatContext *s)
>      FLVContext *flv = s->priv_data;
>      int i;
>  
> -    /* Add EOS tag */
> -    for (i = 0; i < s->nb_streams; i++) {
> -        AVCodecParameters *par = s->streams[i]->codecpar;
> -        FLVStreamContext *sc = s->streams[i]->priv_data;
> -        if (par->codec_type == AVMEDIA_TYPE_VIDEO &&
> -                (par->codec_id == AV_CODEC_ID_H264 || par->codec_id == AV_CODEC_ID_MPEG4))
> -            put_avc_eos_tag(pb, sc->last_ts);
> +    if (flv->flags & FLV_NO_SEQUENCE_END == 0) {

please add a (), that makes greping for order or precedenc bugs much
easier

[...]
Steven Liu Sept. 14, 2016, 1:42 a.m. UTC | #2
2016-09-14 8:31 GMT+08:00 Michael Niedermayer <michael@niedermayer.cc>:

> On Tue, Sep 13, 2016 at 10:10:40PM +0800, Steven Liu wrote:
> [...]
> >  flvenc.c |   18 +++++++++++-------
> >  1 file changed, 11 insertions(+), 7 deletions(-)
> > 42fedcf3213941fce3f2c0a6ea879002e178fa75  0002-avformat-flvenc-add-no_
> sequence_end-flags-for-flvfla.patch
> > From c0297aa790e72b14bd01fcb5862e66636bc43400 Mon Sep 17 00:00:00 2001
> > From: Steven Liu <lingjiujianke@gmail.com>
> > Date: Tue, 13 Sep 2016 22:03:59 +0800
> > Subject: [PATCH 2/2] avformat/flvenc: add no_sequence_end flags for
> flvflags
> >
> > when split flv file by flv format at first, and cat flvs file
> > into one flv file, the flv sequence end is be used,
> > then the whole flv have many flv sequence end TAG.
> > this flags can give user an option to ignore write sequence end TAG
> >
> > Signed-off-by: Steven Liu <lingjiujianke@gmail.com>
> > ---
> >  libavformat/flvenc.c | 18 +++++++++++-------
> >  1 file changed, 11 insertions(+), 7 deletions(-)
>
> missing update to docs/
>
>
> >
> > diff --git a/libavformat/flvenc.c b/libavformat/flvenc.c
> > index a3623f8..9e95b8d 100644
> > --- a/libavformat/flvenc.c
> > +++ b/libavformat/flvenc.c
> > @@ -63,6 +63,7 @@ static const AVCodecTag flv_audio_codec_ids[] = {
> >
> >  typedef enum {
> >      FLV_AAC_SEQ_HEADER_DETECT = (1 << 0),
> > +    FLV_NO_SEQUENCE_END = (1 << 1),
> >  } FLVFlags;
> >
> >  typedef struct FLVContext {
> > @@ -527,13 +528,15 @@ static int flv_write_trailer(AVFormatContext *s)
> >      FLVContext *flv = s->priv_data;
> >      int i;
> >
> > -    /* Add EOS tag */
> > -    for (i = 0; i < s->nb_streams; i++) {
> > -        AVCodecParameters *par = s->streams[i]->codecpar;
> > -        FLVStreamContext *sc = s->streams[i]->priv_data;
> > -        if (par->codec_type == AVMEDIA_TYPE_VIDEO &&
> > -                (par->codec_id == AV_CODEC_ID_H264 || par->codec_id ==
> AV_CODEC_ID_MPEG4))
> > -            put_avc_eos_tag(pb, sc->last_ts);
> > +    if (flv->flags & FLV_NO_SEQUENCE_END == 0) {
>
> please add a (), that makes greping for order or precedenc bugs much
> easier
>
> [...]
>

Hi Michael,

      I found the flvenc has no document  in doc/muxers,
      can i update this patch first, and update the second for refine the
flvenc doc?
Michael Niedermayer Sept. 14, 2016, 2 a.m. UTC | #3
On Wed, Sep 14, 2016 at 09:42:48AM +0800, Steven Liu wrote:
> 2016-09-14 8:31 GMT+08:00 Michael Niedermayer <michael@niedermayer.cc>:
> 
> > On Tue, Sep 13, 2016 at 10:10:40PM +0800, Steven Liu wrote:
> > [...]
> > >  flvenc.c |   18 +++++++++++-------
> > >  1 file changed, 11 insertions(+), 7 deletions(-)
> > > 42fedcf3213941fce3f2c0a6ea879002e178fa75  0002-avformat-flvenc-add-no_
> > sequence_end-flags-for-flvfla.patch
> > > From c0297aa790e72b14bd01fcb5862e66636bc43400 Mon Sep 17 00:00:00 2001
> > > From: Steven Liu <lingjiujianke@gmail.com>
> > > Date: Tue, 13 Sep 2016 22:03:59 +0800
> > > Subject: [PATCH 2/2] avformat/flvenc: add no_sequence_end flags for
> > flvflags
> > >
> > > when split flv file by flv format at first, and cat flvs file
> > > into one flv file, the flv sequence end is be used,
> > > then the whole flv have many flv sequence end TAG.
> > > this flags can give user an option to ignore write sequence end TAG
> > >
> > > Signed-off-by: Steven Liu <lingjiujianke@gmail.com>
> > > ---
> > >  libavformat/flvenc.c | 18 +++++++++++-------
> > >  1 file changed, 11 insertions(+), 7 deletions(-)
> >
> > missing update to docs/
> >
> >
> > >
> > > diff --git a/libavformat/flvenc.c b/libavformat/flvenc.c
> > > index a3623f8..9e95b8d 100644
> > > --- a/libavformat/flvenc.c
> > > +++ b/libavformat/flvenc.c
> > > @@ -63,6 +63,7 @@ static const AVCodecTag flv_audio_codec_ids[] = {
> > >
> > >  typedef enum {
> > >      FLV_AAC_SEQ_HEADER_DETECT = (1 << 0),
> > > +    FLV_NO_SEQUENCE_END = (1 << 1),
> > >  } FLVFlags;
> > >
> > >  typedef struct FLVContext {
> > > @@ -527,13 +528,15 @@ static int flv_write_trailer(AVFormatContext *s)
> > >      FLVContext *flv = s->priv_data;
> > >      int i;
> > >
> > > -    /* Add EOS tag */
> > > -    for (i = 0; i < s->nb_streams; i++) {
> > > -        AVCodecParameters *par = s->streams[i]->codecpar;
> > > -        FLVStreamContext *sc = s->streams[i]->priv_data;
> > > -        if (par->codec_type == AVMEDIA_TYPE_VIDEO &&
> > > -                (par->codec_id == AV_CODEC_ID_H264 || par->codec_id ==
> > AV_CODEC_ID_MPEG4))
> > > -            put_avc_eos_tag(pb, sc->last_ts);
> > > +    if (flv->flags & FLV_NO_SEQUENCE_END == 0) {
> >
> > please add a (), that makes greping for order or precedenc bugs much
> > easier
> >
> > [...]
> >
> 
> Hi Michael,
> 
>       I found the flvenc has no document  in doc/muxers,
>       can i update this patch first, and update the second for refine the
> flvenc doc?

IIRC, ok

[...9
Steven Liu Sept. 14, 2016, 2:04 a.m. UTC | #4
2016-09-14 10:00 GMT+08:00 Michael Niedermayer <michael@niedermayer.cc>:

> On Wed, Sep 14, 2016 at 09:42:48AM +0800, Steven Liu wrote:
> > 2016-09-14 8:31 GMT+08:00 Michael Niedermayer <michael@niedermayer.cc>:
> >
> > > On Tue, Sep 13, 2016 at 10:10:40PM +0800, Steven Liu wrote:
> > > [...]
> > > >  flvenc.c |   18 +++++++++++-------
> > > >  1 file changed, 11 insertions(+), 7 deletions(-)
> > > > 42fedcf3213941fce3f2c0a6ea879002e178fa75
> 0002-avformat-flvenc-add-no_
> > > sequence_end-flags-for-flvfla.patch
> > > > From c0297aa790e72b14bd01fcb5862e66636bc43400 Mon Sep 17 00:00:00
> 2001
> > > > From: Steven Liu <lingjiujianke@gmail.com>
> > > > Date: Tue, 13 Sep 2016 22:03:59 +0800
> > > > Subject: [PATCH 2/2] avformat/flvenc: add no_sequence_end flags for
> > > flvflags
> > > >
> > > > when split flv file by flv format at first, and cat flvs file
> > > > into one flv file, the flv sequence end is be used,
> > > > then the whole flv have many flv sequence end TAG.
> > > > this flags can give user an option to ignore write sequence end TAG
> > > >
> > > > Signed-off-by: Steven Liu <lingjiujianke@gmail.com>
> > > > ---
> > > >  libavformat/flvenc.c | 18 +++++++++++-------
> > > >  1 file changed, 11 insertions(+), 7 deletions(-)
> > >
> > > missing update to docs/
> > >
> > >
> > > >
> > > > diff --git a/libavformat/flvenc.c b/libavformat/flvenc.c
> > > > index a3623f8..9e95b8d 100644
> > > > --- a/libavformat/flvenc.c
> > > > +++ b/libavformat/flvenc.c
> > > > @@ -63,6 +63,7 @@ static const AVCodecTag flv_audio_codec_ids[] = {
> > > >
> > > >  typedef enum {
> > > >      FLV_AAC_SEQ_HEADER_DETECT = (1 << 0),
> > > > +    FLV_NO_SEQUENCE_END = (1 << 1),
> > > >  } FLVFlags;
> > > >
> > > >  typedef struct FLVContext {
> > > > @@ -527,13 +528,15 @@ static int flv_write_trailer(AVFormatContext
> *s)
> > > >      FLVContext *flv = s->priv_data;
> > > >      int i;
> > > >
> > > > -    /* Add EOS tag */
> > > > -    for (i = 0; i < s->nb_streams; i++) {
> > > > -        AVCodecParameters *par = s->streams[i]->codecpar;
> > > > -        FLVStreamContext *sc = s->streams[i]->priv_data;
> > > > -        if (par->codec_type == AVMEDIA_TYPE_VIDEO &&
> > > > -                (par->codec_id == AV_CODEC_ID_H264 || par->codec_id
> ==
> > > AV_CODEC_ID_MPEG4))
> > > > -            put_avc_eos_tag(pb, sc->last_ts);
> > > > +    if (flv->flags & FLV_NO_SEQUENCE_END == 0) {
> > >
> > > please add a (), that makes greping for order or precedenc bugs much
> > > easier
> > >
> > > [...]
> > >
> >
> > Hi Michael,
> >
> >       I found the flvenc has no document  in doc/muxers,
> >       can i update this patch first, and update the second for refine the
> > flvenc doc?
>
> IIRC, ok
>
> patch update:
check if the flvenc in no sequence mode, and give the debug message for it.
Michael Niedermayer Sept. 14, 2016, 12:51 p.m. UTC | #5
On Wed, Sep 14, 2016 at 10:04:27AM +0800, Steven Liu wrote:
> 2016-09-14 10:00 GMT+08:00 Michael Niedermayer <michael@niedermayer.cc>:
> 
> > On Wed, Sep 14, 2016 at 09:42:48AM +0800, Steven Liu wrote:
> > > 2016-09-14 8:31 GMT+08:00 Michael Niedermayer <michael@niedermayer.cc>:
> > >
> > > > On Tue, Sep 13, 2016 at 10:10:40PM +0800, Steven Liu wrote:
> > > > [...]
> > > > >  flvenc.c |   18 +++++++++++-------
> > > > >  1 file changed, 11 insertions(+), 7 deletions(-)
> > > > > 42fedcf3213941fce3f2c0a6ea879002e178fa75
> > 0002-avformat-flvenc-add-no_
> > > > sequence_end-flags-for-flvfla.patch
> > > > > From c0297aa790e72b14bd01fcb5862e66636bc43400 Mon Sep 17 00:00:00
> > 2001
> > > > > From: Steven Liu <lingjiujianke@gmail.com>
> > > > > Date: Tue, 13 Sep 2016 22:03:59 +0800
> > > > > Subject: [PATCH 2/2] avformat/flvenc: add no_sequence_end flags for
> > > > flvflags
> > > > >
> > > > > when split flv file by flv format at first, and cat flvs file
> > > > > into one flv file, the flv sequence end is be used,
> > > > > then the whole flv have many flv sequence end TAG.
> > > > > this flags can give user an option to ignore write sequence end TAG
> > > > >
> > > > > Signed-off-by: Steven Liu <lingjiujianke@gmail.com>
> > > > > ---
> > > > >  libavformat/flvenc.c | 18 +++++++++++-------
> > > > >  1 file changed, 11 insertions(+), 7 deletions(-)
> > > >
> > > > missing update to docs/
> > > >
> > > >
> > > > >
> > > > > diff --git a/libavformat/flvenc.c b/libavformat/flvenc.c
> > > > > index a3623f8..9e95b8d 100644
> > > > > --- a/libavformat/flvenc.c
> > > > > +++ b/libavformat/flvenc.c
> > > > > @@ -63,6 +63,7 @@ static const AVCodecTag flv_audio_codec_ids[] = {
> > > > >
> > > > >  typedef enum {
> > > > >      FLV_AAC_SEQ_HEADER_DETECT = (1 << 0),
> > > > > +    FLV_NO_SEQUENCE_END = (1 << 1),
> > > > >  } FLVFlags;
> > > > >
> > > > >  typedef struct FLVContext {
> > > > > @@ -527,13 +528,15 @@ static int flv_write_trailer(AVFormatContext
> > *s)
> > > > >      FLVContext *flv = s->priv_data;
> > > > >      int i;
> > > > >
> > > > > -    /* Add EOS tag */
> > > > > -    for (i = 0; i < s->nb_streams; i++) {
> > > > > -        AVCodecParameters *par = s->streams[i]->codecpar;
> > > > > -        FLVStreamContext *sc = s->streams[i]->priv_data;
> > > > > -        if (par->codec_type == AVMEDIA_TYPE_VIDEO &&
> > > > > -                (par->codec_id == AV_CODEC_ID_H264 || par->codec_id
> > ==
> > > > AV_CODEC_ID_MPEG4))
> > > > > -            put_avc_eos_tag(pb, sc->last_ts);
> > > > > +    if (flv->flags & FLV_NO_SEQUENCE_END == 0) {
> > > >
> > > > please add a (), that makes greping for order or precedenc bugs much
> > > > easier
> > > >
> > > > [...]
> > > >
> > >
> > > Hi Michael,
> > >
> > >       I found the flvenc has no document  in doc/muxers,
> > >       can i update this patch first, and update the second for refine the
> > > flvenc doc?
> >
> > IIRC, ok
> >
> > patch update:
> check if the flvenc in no sequence mode, and give the debug message for it.

>  flvenc.c |   20 +++++++++++++-------
>  1 file changed, 13 insertions(+), 7 deletions(-)
> 79653ec33e282a88ef8a951b6e08f63eac77704b  0001-avformat-flvenc-add-no_sequence_end-flags-for-flvfla.patch
> From 00e11d82f9e817d770f2761067bfa2229da96735 Mon Sep 17 00:00:00 2001
> From: Steven Liu <lingjiujianke@gmail.com>
> Date: Wed, 14 Sep 2016 10:00:52 +0800
> Subject: [PATCH] avformat/flvenc: add no_sequence_end flags for flvflags
> 
> when split flv file by flv format at first, and cat flvs file
> into one flv file, the flv sequence end is be used,
> then the whole flv have many flv sequence end TAG.
> this flags can give user an option to ignore write sequence end TAG
> 
> Signed-off-by: Steven Liu <lingjiujianke@gmail.com>
> ---
>  libavformat/flvenc.c | 20 +++++++++++++-------
>  1 file changed, 13 insertions(+), 7 deletions(-)

applied

thanks

[...]
diff mbox

Patch

diff --git a/libavformat/flvenc.c b/libavformat/flvenc.c
index a3623f8..9e95b8d 100644
--- a/libavformat/flvenc.c
+++ b/libavformat/flvenc.c
@@ -63,6 +63,7 @@  static const AVCodecTag flv_audio_codec_ids[] = {

 typedef enum {
     FLV_AAC_SEQ_HEADER_DETECT = (1 << 0),
+    FLV_NO_SEQUENCE_END = (1 << 1),
 } FLVFlags;

 typedef struct FLVContext {
@@ -527,13 +528,15 @@  static int flv_write_trailer(AVFormatContext *s)
     FLVContext *flv = s->priv_data;
     int i;

-    /* Add EOS tag */
-    for (i = 0; i < s->nb_streams; i++) {
-        AVCodecParameters *par = s->streams[i]->codecpar;
-        FLVStreamContext *sc = s->streams[i]->priv_data;
-        if (par->codec_type == AVMEDIA_TYPE_VIDEO &&
-                (par->codec_id == AV_CODEC_ID_H264 || par->codec_id ==
AV_CODEC_ID_MPEG4))
-            put_avc_eos_tag(pb, sc->last_ts);
+    if (flv->flags & FLV_NO_SEQUENCE_END == 0) {
+        /* Add EOS tag */
+        for (i = 0; i < s->nb_streams; i++) {
+            AVCodecParameters *par = s->streams[i]->codecpar;
+            FLVStreamContext *sc = s->streams[i]->priv_data;
+            if (par->codec_type == AVMEDIA_TYPE_VIDEO &&
+                    (par->codec_id == AV_CODEC_ID_H264 || par->codec_id ==
AV_CODEC_ID_MPEG4))
+                put_avc_eos_tag(pb, sc->last_ts);
+        }
     }