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

Heesuk Jung heesuk.jung at lge.com
Mon Oct 29 09:53:44 CET 2012


>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;

+                }

                 avctx->codec_id = AV_CODEC_ID_MPEG1VIDEO;

             }

             break;

-- 

1.7.0.4

 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-Wrong-bit-rate-in-MPEG2-video-file-Ticket-1862.patch
Type: application/octet-stream
Size: 1654 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20121029/1e4d7d3a/attachment.obj>


More information about the ffmpeg-devel mailing list