[FFmpeg-devel] [bug/patch] MPEG-TS muxer: PCR not in sync with PTS/DTS
Baptiste Coudurier
baptiste.coudurier
Tue Jul 28 20:07:52 CEST 2009
Hi,
On Mon, Jul 27, 2009 at 01:37:53PM +0200, Niobos wrote:
> On 26 Jul 2009, at 08:37, Baptiste Coudurier wrote:
> >On Wed, Jul 22, 2009 at 09:52:40AM +0200, Niobos wrote:
> >>
> >>I agree that these calculations are not as clean as they should be.
> >>Another thing to consider is using -maxrate instead of -b to do
> >>these calculations.
> >
> >Well, in CBR, maxrate == bitrate so it wouldn't change much.
> >We indeed to increase total bitrate reasonably to compensate VBR.
>
> I'm not sure on this, but I think in VBR-mode it would be best to
> generate a VBR transport stream: set the muxrate "high enough" and
> step the PCR if needed; only inserting NULL-packets if the muxrate
> is specified to be constant on the command line. What do you think
> of this approach?
I think it would be easier to generate a CBR transport stream, however
I think it's good to generate a VBR ts if it works :)
> [...]
>
> Attached the re-split and edited patches for the overhead and the
> (untouched) varname-change.
> Index: mpegtsenc.c
> ===================================================================
> --- mpegtsenc.c (revision 19505)
> +++ mpegtsenc.c (working copy)
> @@ -163,7 +163,7 @@
> #define DEFAULT_PES_HEADER_FREQ 16
> #define DEFAULT_PES_PAYLOAD_SIZE ((DEFAULT_PES_HEADER_FREQ - 1) * 184 + 170)
>
> -/* we retransmit the SI info at this rate */
> +/* we retransmit the SI info at this rate (in ms) */
> #define SDT_RETRANS_TIME 500
> #define PAT_RETRANS_TIME 100
> #define PCR_RETRANS_TIME 20
> @@ -429,9 +429,10 @@
> /* PES header size */
> if (st->codec->codec_type == CODEC_TYPE_VIDEO ||
> st->codec->codec_type == CODEC_TYPE_SUBTITLE)
> - total_bit_rate += 25 * 8 / av_q2d(st->codec->time_base);
> + total_bit_rate += (19*8 + 92*8) / av_q2d(st->codec->time_base); /* 19B PES header every frame */
> + /* on average 92B of padding at the end of every packet */
> else
> - total_bit_rate += total_bit_rate * 25 / DEFAULT_PES_PAYLOAD_SIZE;
> + total_bit_rate += (14*8 + 92*8) * 7; /* 14B PES header 6.7 times a second */
Sorry, but can you please explain the audio header size, it should
depend on codec bit rate and DEFAULT_PES_PAYLOAD_SIZE, I think.
[...]
--
Baptiste COUDURIER GnuPG Key Id: 0x5C1ABAAA
Key fingerprint 8D77134D20CC9220201FC5DB0AC9325C5C1ABAAA
FFmpeg maintainer http://www.ffmpeg.org
More information about the ffmpeg-devel
mailing list