[FFmpeg-devel] [PATCH] mpegtsenc: Force writing PCR-only packet to PCR stream if the current stream is not the PCR stream

Tomas Härdin tomas.hardin
Thu Oct 7 13:29:10 CEST 2010

On Wed, 2010-10-06 at 15:10 -0700, Baptiste Coudurier wrote:
> On 10/06/2010 04:33 AM, Tomas H?rdin wrote:
> > ...
> >
> > When writing non-video streams PCR still needs to be written
> > periodically, but PCR may only be written for streams whose PID matches
> > a service's PCR PID (typically the first video stream). The patch uses a
> > simple solution for this: write a PCR-only packet with the video
> > stream's PID, similarly to how such packets are written when padding for
> > CBR mode. This is of course a bit wasteful when muxing VBR, but it is
> > more correct AFAICT.
> I agree, although the perfect solution would be write PCR based on 
> timing. Specifications says that delta between PCRs shall be <= 0.1s
> > ...
> >
> > A better solution would of course be to interleave the PES packets that
> > make up the last few packets of each stream of each service, and make
> > sure PCR is written for all services when required. At the moment I am
> > more concerned with the muxer outputting a compliant bitstream though,
> > rather than being the most efficient implementation.
> I agree with that.

Hopefully I'll be given time later to improve the muxer. I have some
ideas how this could be done without being too complicated.

> > [...]
>  >
> > +
> > +        if(write_pcr&&  ts_st->pid != ts_st->service->pcr_pid) {
> > +            /* write a pcr-only packet to the pcr stream since pcr needs to be
> > +             * written but the current stream is not the pcr stream
> > +             * FIXME: this is slightly wasteful in VBR mode */
> Please no new FIXME, you can check wether you are in VBR mode or not.

Shouldn't PCR be written either way, even if doing VBR? Perhaps it
should say NOTE instead of FIXME, or nothing at all. Attached patch
simply removes it.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: force_pcr2.patch
Type: text/x-patch
Size: 1571 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20101007/22d123cf/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20101007/22d123cf/attachment.pgp>

More information about the ffmpeg-devel mailing list