[FFmpeg-devel] [PATCH] mpegts: pcr period option for variable bitrate multiplexing

Predrag Filipovic agoracsinc at gmail.com
Sun Mar 27 05:03:12 CEST 2016


My sincere apology:
- can you please use my originally sent patch that is (exactly) the same
  as this one ... it was send through different Email server
  - Feb 19, 2016 19:11:41 EDT (US)
  - same Subject, from predrag at agora-cs.com

I did (tried to) re-send from this new gmail account - had to open it since
hight-level traffic started creating issues on my corp. Eamil account ...
- Note: git patch and send-email are "by the book", my guess is gmail
  creates issues that were not addressed or not easily found by browsing

To your question: resulting transport streams were tested / passed through
Manzanita and MSight analysers and internal analyser (by my client company).
Changes are good enough for ATSC (100ms PCR period) for streams with
10 fps or higher. Working on "proper system" (FFMPEG addition) that would
have no limitations regarding fps (see commit comments).

My apology, thanks for your attention

Predrag Filipovic

On Sat, Mar 26, 2016 at 10:55 AM, Michael Niedermayer <
michael at niedermayer.cc> wrote:

> On Fri, Mar 25, 2016 at 12:50:29PM -0400, Predrag Filipovic wrote:
> > Enable proper PCR insertion for VBR multiplexing (muxrate not specified).
> > Insertion timing is based on video frame keys and frame period,
> consequently
> > pcr period precision is limited to +/- one video frame period.
> >
> > Signed-off-by: Predrag Filipovic <agoracsinc at gmail.com>
> > ---
> >  libavformat/mpegtsenc.c | 80
> +++++++++++++++++++++++++++++++++++++------------
> >  1 file changed, 61 insertions(+), 19 deletions(-)
> >
> > diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c
> > index 7656720..7ed9076 100644
> > --- a/libavformat/mpegtsenc.c
> > +++ b/libavformat/mpegtsenc.c
> > @@ -105,6 +105,7 @@ typedef struct MpegTSWrite {
> >      int tables_version;
> >      double pat_period;
> >      double sdt_period;
> > +    int64_t last_pcr_ts;
> >      int64_t last_pat_ts;
> >      int64_t last_sdt_ts;
> >
> > @@ -903,6 +904,9 @@ static int mpegts_init(AVFormatContext *s)
> >          ts_st = pcr_st->priv_data;
> >
> >      if (ts->mux_rate > 1) {
> > +        if (ts->pcr_period >= INT_MAX/2) {
> > +            ts->pcr_period = PCR_RETRANS_TIME;
> > +        }
> >          service->pcr_packet_period = (int64_t)ts->mux_rate *
> ts->pcr_period /
> >                                       (TS_PACKET_SIZE * 8 * 1000);
> >          ts->sdt_packet_period      = (int64_t)ts->mux_rate *
> SDT_RETRANS_TIME /
> > @@ -931,10 +935,19 @@ static int mpegts_init(AVFormatContext *s)
> >              service->pcr_packet_period =
> >                  ts_st->user_tb.den / (10 * ts_st->user_tb.num);
> >          }
> > -        if (!service->pcr_packet_period)
> > +        /* if pcr_period specified, mark pcr_packet_period as NA
> (=INT_MAX) */
> > +        if (ts->pcr_period < INT_MAX/2) {
> > +            service->pcr_packet_period = INT_MAX;
> > +        } else {
> > +        if (!service->pcr_packet_period) {
> >              service->pcr_packet_period = 1;
> > +        } else if (service->pcr_packet_period == INT_MAX) {
> > +            service->pcr_packet_period--;
> > +        }
> > +        }
>
> there is somethig wrong with the indention here
>
> have you tested the patch with multiple programs ?
> what have you used to test that the TS after this patch is more
> valid than before ?
>
> [...]
> --
> Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> Many things microsoft did are stupid, but not doing something just because
> microsoft did it is even more stupid. If everything ms did were stupid they
> would be bankrupt already.
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
>


More information about the ffmpeg-devel mailing list