[FFmpeg-devel,V3,5/7] avformat: add rc_max_rate to AVStream

Submitted by Jun Zhao on Nov. 22, 2018, 2:56 p.m.

Details

Message ID 1542898579-13278-6-git-send-email-mypopydev@gmail.com
State New
Headers show

Commit Message

Jun Zhao Nov. 22, 2018, 2:56 p.m.
This field will be used in demuxer to expose the max bit rate, e,g
in MOV/MP4 esds box.

Signed-off-by: Jun Zhao <mypopydev@gmail.com>
---
 doc/APIchanges         |    3 +++
 libavformat/avformat.h |    6 ++++++
 libavformat/version.h  |    2 +-
 3 files changed, 10 insertions(+), 1 deletions(-)

Comments

Hendrik Leppkes Nov. 22, 2018, 3:12 p.m.
On Thu, Nov 22, 2018 at 4:04 PM Jun Zhao <mypopydev@gmail.com> wrote:
>
> This field will be used in demuxer to expose the max bit rate, e,g
> in MOV/MP4 esds box.
>
> Signed-off-by: Jun Zhao <mypopydev@gmail.com>
> ---
>  doc/APIchanges         |    3 +++
>  libavformat/avformat.h |    6 ++++++
>  libavformat/version.h  |    2 +-
>  3 files changed, 10 insertions(+), 1 deletions(-)
>
> diff --git a/doc/APIchanges b/doc/APIchanges
> index db1879e..0921da1 100644
> --- a/doc/APIchanges
> +++ b/doc/APIchanges
> @@ -15,6 +15,9 @@ libavutil:     2017-10-21
>
>  API changes, most recent first:
>
> +2018-11-xx - xxxxxxxxxx - lavf 58.23.100 - avformat.h
> +  Add rc_max_rate to AVStream
> +
>  -------- 8< --------- FFmpeg 4.1 was cut here -------- 8< ---------
>
>  2018-10-27 - 718044dc19 - lavu 56.21.100 - pixdesc.h
> diff --git a/libavformat/avformat.h b/libavformat/avformat.h
> index fdaffa5..1732c24 100644
> --- a/libavformat/avformat.h
> +++ b/libavformat/avformat.h
> @@ -938,6 +938,12 @@ typedef struct AVStream {
>      AVRational avg_frame_rate;
>
>      /**
> +     * The max bitrate of the encoded data (in bits per second).
> +     * - decoding: set by libavformat
> +     */
> +    int64_t rc_max_rate;
> +


We have AV_PKT_DATA_CPB_PROPERTIES / AVCPBProperties side-data for that.

- Hendrik
mypopy@gmail.com Nov. 23, 2018, 3:16 a.m.
On Thu, Nov 22, 2018 at 11:12 PM Hendrik Leppkes <h.leppkes@gmail.com> wrote:
>
> On Thu, Nov 22, 2018 at 4:04 PM Jun Zhao <mypopydev@gmail.com> wrote:
> >
> > This field will be used in demuxer to expose the max bit rate, e,g
> > in MOV/MP4 esds box.
> >
> > Signed-off-by: Jun Zhao <mypopydev@gmail.com>
> > ---
> >  doc/APIchanges         |    3 +++
> >  libavformat/avformat.h |    6 ++++++
> >  libavformat/version.h  |    2 +-
> >  3 files changed, 10 insertions(+), 1 deletions(-)
> >
> > diff --git a/doc/APIchanges b/doc/APIchanges
> > index db1879e..0921da1 100644
> > --- a/doc/APIchanges
> > +++ b/doc/APIchanges
> > @@ -15,6 +15,9 @@ libavutil:     2017-10-21
> >
> >  API changes, most recent first:
> >
> > +2018-11-xx - xxxxxxxxxx - lavf 58.23.100 - avformat.h
> > +  Add rc_max_rate to AVStream
> > +
> >  -------- 8< --------- FFmpeg 4.1 was cut here -------- 8< ---------
> >
> >  2018-10-27 - 718044dc19 - lavu 56.21.100 - pixdesc.h
> > diff --git a/libavformat/avformat.h b/libavformat/avformat.h
> > index fdaffa5..1732c24 100644
> > --- a/libavformat/avformat.h
> > +++ b/libavformat/avformat.h
> > @@ -938,6 +938,12 @@ typedef struct AVStream {
> >      AVRational avg_frame_rate;
> >
> >      /**
> > +     * The max bitrate of the encoded data (in bits per second).
> > +     * - decoding: set by libavformat
> > +     */
> > +    int64_t rc_max_rate;
> > +
>
>
> We have AV_PKT_DATA_CPB_PROPERTIES / AVCPBProperties side-data for that.
>
> - Hendrik

I suppose AV_PKT_DATA_CPB_PROPERTIES / AVCPBProperties side-data just
expose the data from  encoder like lib264, but now I need to expose
the max bit rate data from container like MOV/MP4, This is the reason
add a new field in AVStream.
Hendrik Leppkes Nov. 23, 2018, 7:28 a.m.
On Fri, Nov 23, 2018 at 4:16 AM mypopy@gmail.com <mypopy@gmail.com> wrote:
>
> On Thu, Nov 22, 2018 at 11:12 PM Hendrik Leppkes <h.leppkes@gmail.com> wrote:
> >
> > On Thu, Nov 22, 2018 at 4:04 PM Jun Zhao <mypopydev@gmail.com> wrote:
> > >
> > > This field will be used in demuxer to expose the max bit rate, e,g
> > > in MOV/MP4 esds box.
> > >
> > > Signed-off-by: Jun Zhao <mypopydev@gmail.com>
> > > ---
> > >  doc/APIchanges         |    3 +++
> > >  libavformat/avformat.h |    6 ++++++
> > >  libavformat/version.h  |    2 +-
> > >  3 files changed, 10 insertions(+), 1 deletions(-)
> > >
> > > diff --git a/doc/APIchanges b/doc/APIchanges
> > > index db1879e..0921da1 100644
> > > --- a/doc/APIchanges
> > > +++ b/doc/APIchanges
> > > @@ -15,6 +15,9 @@ libavutil:     2017-10-21
> > >
> > >  API changes, most recent first:
> > >
> > > +2018-11-xx - xxxxxxxxxx - lavf 58.23.100 - avformat.h
> > > +  Add rc_max_rate to AVStream
> > > +
> > >  -------- 8< --------- FFmpeg 4.1 was cut here -------- 8< ---------
> > >
> > >  2018-10-27 - 718044dc19 - lavu 56.21.100 - pixdesc.h
> > > diff --git a/libavformat/avformat.h b/libavformat/avformat.h
> > > index fdaffa5..1732c24 100644
> > > --- a/libavformat/avformat.h
> > > +++ b/libavformat/avformat.h
> > > @@ -938,6 +938,12 @@ typedef struct AVStream {
> > >      AVRational avg_frame_rate;
> > >
> > >      /**
> > > +     * The max bitrate of the encoded data (in bits per second).
> > > +     * - decoding: set by libavformat
> > > +     */
> > > +    int64_t rc_max_rate;
> > > +
> >
> >
> > We have AV_PKT_DATA_CPB_PROPERTIES / AVCPBProperties side-data for that.
> >
> > - Hendrik
>
> I suppose AV_PKT_DATA_CPB_PROPERTIES / AVCPBProperties side-data just
> expose the data from  encoder like lib264, but now I need to expose
> the max bit rate data from container like MOV/MP4, This is the reason
> add a new field in AVStream.

The side-data can be used from either a demuxer or an encoder - one
describes the original stream, one the newly encoded stream. In fact
movenc already uses it to write this particular field to esds, so
movdec should use the same structure to read it.
See av_stream_new_side_data

- Hendrik

Patch hide | download patch | download mbox

diff --git a/doc/APIchanges b/doc/APIchanges
index db1879e..0921da1 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -15,6 +15,9 @@  libavutil:     2017-10-21
 
 API changes, most recent first:
 
+2018-11-xx - xxxxxxxxxx - lavf 58.23.100 - avformat.h
+  Add rc_max_rate to AVStream
+
 -------- 8< --------- FFmpeg 4.1 was cut here -------- 8< ---------
 
 2018-10-27 - 718044dc19 - lavu 56.21.100 - pixdesc.h
diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index fdaffa5..1732c24 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -938,6 +938,12 @@  typedef struct AVStream {
     AVRational avg_frame_rate;
 
     /**
+     * The max bitrate of the encoded data (in bits per second).
+     * - decoding: set by libavformat
+     */
+    int64_t rc_max_rate;
+
+    /**
      * For streams with AV_DISPOSITION_ATTACHED_PIC disposition, this packet
      * will contain the attached picture.
      *
diff --git a/libavformat/version.h b/libavformat/version.h
index 843f922..70e868f 100644
--- a/libavformat/version.h
+++ b/libavformat/version.h
@@ -32,7 +32,7 @@ 
 // Major bumping may affect Ticket5467, 5421, 5451(compatibility with Chromium)
 // Also please add any ticket numbers that you believe might be affected here
 #define LIBAVFORMAT_VERSION_MAJOR  58
-#define LIBAVFORMAT_VERSION_MINOR  22
+#define LIBAVFORMAT_VERSION_MINOR  23
 #define LIBAVFORMAT_VERSION_MICRO 100
 
 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \