[FFmpeg-devel] [PATCH 2/2] Wrong bit rate in MPEG2 video file (Ticket #1862)
Heesuk Jung
heesuk.jung at lge.com
Tue Oct 30 01:10:42 CET 2012
Hi,
I don't think that 0x3FFFF value is valid bit rate.
Michael wrote :
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)
-> You're right and mpeg1 video has full 18 bits field for bit rate
description.
But 0x3FFFF of bit rate filed does not indicate bit rate but variable
bit rate.
Actually MPEG2 video is up to 80 Mbps and 104857200 bps (== 0x3FFFF X
400) is impossible.
In conclusion, I change from 0x3FFFF to zero because meaning of 0x3FFFF
is variable bit rate.
I update simpler patch for this issue and hope your feedback.
(If e-mail patch is broken, please check attached patch file.)
Thanks !
>From 541c50e4f4bf935733e1772754424b9d83953983 Mon Sep 17 00:00:00 2001
From: Heesuk Jung <heesuk.jung at lge.com>
Date: Mon, 29 Oct 2012 05:56:20 -0700
Subject: [PATCH] Wrong bit rate in MPEG2 video file (Ticket #1862)
mpegvideo parser sometime get wrong stream bit rate which is 0x3FFFF*400.
But maximum bit rate of MPEG2 video is up to 80 Mbps in case 1920x1080
resolution.
When bit rate is 0x3FFFF*400, set bit rate zero.
* Problematic link
https://docs.google.com/open?id=0B6r7ZfWFIypCUkhPa0dyTGdFSE0
---
libavcodec/mpegvideo_parser.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/libavcodec/mpegvideo_parser.c b/libavcodec/mpegvideo_parser.c
index c60d3cd..ff440fe 100644
--- a/libavcodec/mpegvideo_parser.c
+++ b/libavcodec/mpegvideo_parser.c
@@ -68,6 +68,9 @@ static void mpegvideo_extract_headers(AVCodecParserContext
*s,
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 (avctx->bit_rate == 0x3FFFF*400) {
+ avctx->bit_rate = 0;
+ }
avctx->codec_id = AV_CODEC_ID_MPEG1VIDEO;
}
break;
--
1.7.9.5
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Wrong-bit-rate-in-MPEG2-video-file-Ticket-1862.patch
Type: application/octet-stream
Size: 1367 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20121030/2f59ef82/attachment.obj>
More information about the ffmpeg-devel
mailing list