diff options
author | Niobos <niobos@dest-unreach.be> | 2009-09-17 19:07:09 +0000 |
---|---|---|
committer | Baptiste Coudurier <baptiste.coudurier@gmail.com> | 2009-09-17 19:07:09 +0000 |
commit | 9deba199fd5830ebb20063a340cda7a6a6819604 (patch) | |
tree | 2bd4658cacc2975cd49ff3e0ddeeff31cb209fb7 /libavformat | |
parent | bb8cd7b3cfec0dda275291e638f289d63487234c (diff) | |
download | ffmpeg-9deba199fd5830ebb20063a340cda7a6a6819604.tar.gz |
fix pes overhead computation, patch by Niobos, niobos at dest-unreach dot be
Originally committed as revision 19902 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat')
-rw-r--r-- | libavformat/mpegtsenc.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c index 7138009716..48df4386da 100644 --- a/libavformat/mpegtsenc.c +++ b/libavformat/mpegtsenc.c @@ -428,10 +428,18 @@ static int mpegts_write_header(AVFormatContext *s) total_bit_rate += st->codec->bit_rate; /* 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); - else - total_bit_rate += total_bit_rate * 25 / DEFAULT_PES_PAYLOAD_SIZE; + st->codec->codec_type == CODEC_TYPE_SUBTITLE) { + /* 1 PES per frame + * 19 bytes of PES header + * on average a half TS-packet (184/2) of padding-overhead every PES */ + total_bit_rate += (19 + 184/2)*8 / av_q2d(st->codec->time_base); + } else { + /* 1 PES per DEFAULT_PES_PAYLOAD_SIZE bytes of audio data + * 14 bytes of PES header + * on average a half TS-packet (184/2) of padding-overhead every PES */ + total_bit_rate += (14 + 184/2) * + st->codec->bit_rate / DEFAULT_PES_PAYLOAD_SIZE; + } } /* if no video stream, use the first stream as PCR */ |