[FFmpeg-devel] PES packet length

Michael Niedermayer michaelni
Mon Dec 3 11:08:28 CET 2007

On Thu, Nov 29, 2007 at 12:23:30PM -0800, Werner Altewischer wrote:
> 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
> - Is it possible to increase this packet_size without consequences and if so
> what would be the maximum value?

not commenting on the smartness of the idea, but if you want to use really
large packet_sizes then you will need the patch below, as well as latest svn
and specifiying a larger buffer size for audio with -abufsize
and of course setting the actual packet size with -packetsize

Index: libavformat/mpegenc.c
--- libavformat/mpegenc.c	(revision 11116)
+++ libavformat/mpegenc.c	(working copy)
@@ -355,7 +355,7 @@
             /* This value HAS to be used for VCD (see VCD standard, p. IV-7).
                Right now it is also used for everything else.*/
-            stream->max_buffer_size = 4 * 1024;
+            stream->max_buffer_size = 4 * 1024 + st->codec->rc_buffer_size/8;
         case CODEC_TYPE_VIDEO:

Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

There will always be a question for which you do not know the correct awnser.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20071203/599b189b/attachment.pgp>

More information about the ffmpeg-devel mailing list