[FFmpeg-devel] [PATCH 2/2] Wrong bit rate in MPEG2 video file (Ticket #1862)

Michael Niedermayer michaelni at gmx.at
Mon Oct 29 15:07:24 CET 2012


On Mon, Oct 29, 2012 at 05:53:44PM +0900, Heesuk Jung wrote:
[...]
>  mpegvideo_parser.c |    6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> bd0d08ec8139ae324b523b3a1124a876e19b2d30  0002-Wrong-bit-rate-in-MPEG2-video-file-Ticket-1862.patch
> From 3820bdf09366c27c3080cc668a25f63b2828eba7 Mon Sep 17 00:00:00 2001
> From: Heesuk Jung <heesuk.jung at lge.com>
> Date: Mon, 29 Oct 2012 17:48:10 +0900
> Subject: [PATCH 2/2] Wrong bit rate in MPEG2 video file (Ticket #1862)
> 
> mpegvideo parser sometime get maximum bit rate which is 0x3FFFF*400.
> But maximum bit rate of MPEG2 can not be 0x3FFFF*400 but 80Mbps in case 1080p.
> When bit rate is 0x3FFFF*400, set bit rate zero.
> 
> * Problematic link
> https://docs.google.com/open?id=0B6r7ZfWFIypCUkhPa0dyTGdFSE0
> ---
>  libavcodec/mpegvideo_parser.c |    6 +++++-
>  1 files changed, 5 insertions(+), 1 deletions(-)
>  mode change 100644 => 100755 libavcodec/mpegvideo_parser.c
> 
> diff --git a/libavcodec/mpegvideo_parser.c b/libavcodec/mpegvideo_parser.c
> old mode 100644
> new mode 100755
> index c60d3cd..a60bfd1
> --- a/libavcodec/mpegvideo_parser.c
> +++ b/libavcodec/mpegvideo_parser.c
> @@ -67,7 +67,11 @@ static void mpegvideo_extract_headers(AVCodecParserContext *s,
>                  frame_rate_index = buf[3] & 0xf;
>                  pc->frame_rate.den = avctx->time_base.den = ff_mpeg12_frame_rate_tab[frame_rate_index].num;
>                  pc->frame_rate.num = avctx->time_base.num = ff_mpeg12_frame_rate_tab[frame_rate_index].den;
> -                avctx->bit_rate = ((buf[4]<<10) | (buf[5]<<2) | (buf[6]>>6))*400;
> +                if (((buf[4]<<10) | (buf[5]<<2) | (buf[6]>>6)) == 0x3FFFF) {
> +                    avctx->bit_rate = 0;
> +                } else {
> +                    avctx->bit_rate = ((buf[4]<<10) | (buf[5]<<2) | (buf[6]>>6))*400;
> +                }

The check has to be done later because these are only the low 18bit
of the mpeg2 bitrate. (for mpeg1 its the full bitrate field)

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Concerning the gods, I have no means of knowing whether they exist or not
or of what sort they may be, because of the obscurity of the subject, and
the brevity of human life -- Protagoras
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20121029/1c1ddfcb/attachment.asc>


More information about the ffmpeg-devel mailing list