[FFmpeg-devel] [bug/patch] MPEG-TS muxer: PCR not in sync with PTS/DTS
Niobos
niobos
Mon Sep 7 18:17:17 CEST 2009
On 07 Sep 2009, at 18:05, Stratford, Alan wrote:
> I have been looking at the calculation of total_bit_rate in the latest
> update to this patch. I think that I understand the calculation but
> I am
> confused by the line
>
> total_bit_rate +=
> 4 * total_bit_rate / (TS_PACKET_SIZE-4) + /* TS header size */
> 1000 * 8 * sdt_size / SDT_RETRANS_TIME + /* SDT size
> */
> 1000 * 8 * pat_pmt_size / PAT_RETRANS_TIME + /* PAT+PMT
> size */
> 1000 * 8 * 8 / PCR_RETRANS_TIME; /* PCR size
> */
>
> It is the following part that is causing confusion:
>
> 4 * total_bit_rate / (TS_PACKET_SIZE-4) + /* TS header size */
>
> I believe that this is trying to adjust the total_bit_rate to allow
> for
> the
> fact that the stream will be sent as TS packets, and, therefore, will
> require an extra 4 bytes of data for each 184 bytes in the stream. If
> this is not the case then please ignore the rest of this post, but I
> would greatly appreciate an explanation of what the line does.
Correct
> If my understanding is correct this part should be:
>
> total_bit_rate * TS_PACKET_SIZE / (TS_PACKET_SIZE-4) + /*TS header
> size*/
Also correct, but:
total_bit_rate * TS_PACKET_SIZE / (TS_PACKET_SIZE-4)
= total_bit_rate * (TS_PACKET_SIZE - 4 + 4 ) / (TS_PACKET_SIZE-4)
= total_bit_rate * (1 + 4/(TS_PACKET_SIZE-4) )
= total_bit_rate + 4 * total_bit_rate / (TS_PACKET_SIZE-4)
Hence it's exactly equivalent to
total_bit_rate += 4 * total_bit_rate / (TS_PACKET_SIZE-4);
which is what I used
Niobos
More information about the ffmpeg-devel
mailing list