[FFmpeg-devel] PES packet length

Måns Rullgård mans
Mon Dec 3 10:06:53 CET 2007


Trent Piepho <xyzzy at speakeasy.org> writes:

> On Sun, 2 Dec 2007, [iso-8859-1] M?ns Rullg?rd wrote:
>> "Werner Altewischer" <werner.altewischer at gmail.com> writes:
>>
>> > I notice that muxing an MPEG program stream sometimes gives a
>> > large overhead (up to 5% of total stream size). I looked in the
>> > mpegenc.c file and it uses a constant packet_size of 2048 bytes
>> > for any kind of stream. I assume that increasing the packet size
>> > would lower this overhead.
>> >
>> > - Is this assumption true
>>
>> It's maths.
>>
>> > - Is it possible to increase this packet_size without
>> > consequences and if so
>>
>> It depends.  Such files would not be DVD-compatible, and could very
>> well cause trouble for hardware decoders with small buffers.
>>
>> > what would be the maximum value?
>>
>> 65535
>
> A video elementary stream, if in a transport stream, is allowed to have
> variable length PES packets (the size field is 0) that are longer than
> 65535 bytes.  It's very common for HD broadcast tv.  One frame per packet
> and the frames can be >> than 64k.

This is possible in a transport stream because the
payload_unit_start_indicator signals the start of a PES packet.  In a
program stream, which the OP asked about, the size must be known in
order to find the end of the packet.

-- 
M?ns Rullg?rd
mans at mansr.com




More information about the ffmpeg-devel mailing list