[FFmpeg-devel] [PATCH] Wrong duration in TS container (Ticket #1836)
Heesuk Jung
heesuk.jung at lge.com
Mon Oct 22 05:51:46 CEST 2012
Hi Liu,
I comment answer as below.
> there is no ic->iformat->name == "mpegps"
I have not add this line
Jung, what's meaning you add this mpegps line?
-> I believe that estimate_timings_from_pts function is designed for
MPEG-PS.
Because remark of estimate_timings_from_pts function is "only usable
for MPEG-PS streams"
Thanks
-----Original Message-----
From: ffmpeg-devel-bounces at ffmpeg.org
[mailto:ffmpeg-devel-bounces at ffmpeg.org] On Behalf Of Steven Liu
Sent: Monday, October 22, 2012 12:48 PM
To: FFmpeg development discussions and patches
Cc: donggul.kim at lge.com; wonsik at google.com; chungshik at google.com;
dwkang at google.com
Subject: Re: [FFmpeg-devel] [PATCH] Wrong duration in TS container (Ticket
#1836)
2012/10/22 Michael Niedermayer <michaelni at gmx.at>:
> On Sun, Oct 21, 2012 at 02:21:32PM +0900, Heesuk Jung wrote:
>> Fix indentation.
> [...]
>> utils.c | 32 +++++++++++++++++++++++++++++---
>> 1 file changed, 29 insertions(+), 3 deletions(-)
>> 899a139c6d9a33211ebddafa54ec568fa7ef2551
>> 0001-Wrong-duration-in-TS-container-Ticket-1836.patch
>> From 2723ad65908531d136b828e4c9e615104a12beb8 Mon Sep 17 00:00:00
>> 2001
>> From: Heesuk Jung <heesuk.jung at lge.com>
>> Date: Sun, 21 Oct 2012 13:21:23 +0900
>> Subject: [PATCH] Wrong duration in TS container (Ticket #1836)
>>
>> Libavformat somtimes get wrong duration in some TS conatiner.
>> Please refer the problem description and file link in Ticket #1836.
>> (http://ffmpeg.org/trac/ffmpeg/ticket/1836)
>>
>> I have just modified 2 point as below.
>>
>> 1. Duration determination considering time diff and file size / bit rate.
>>
>> Duration is determined base on PTS time diff (end time - start ime)
>> but sometime is unreasonably so big.
>> I suggest that don't beleive duration based on PTS time diff if time
>> diff is bigger than hueristic value (file size / average bit rate * 2).
>>
>> 2. Change condition when estimate_timings_from_pts is called.
>>
>> The estimate_timings_from_pts function is designed for MPEG-PS.
>> And so I changed condition from MPEG-TS to MPEG-PS
>> ---
>> libavformat/utils.c | 32 +++++++++++++++++++++++++++++---
>> 1 files changed, 29 insertions(+), 3 deletions(-) mode change
>> 100644 => 100755 libavformat/utils.c
>>
>> diff --git a/libavformat/utils.c b/libavformat/utils.c old mode
>> 100644 new mode 100755 index 745dcaa..d322907
>> --- a/libavformat/utils.c
>> +++ b/libavformat/utils.c
> [...]
>
>> @@ -2077,8 +2100,11 @@ static void
>> update_stream_timings(AVFormatContext *ic)
>>
>> if (start_time != INT64_MAX) {
>> ic->start_time = start_time;
>> - if (end_time != INT64_MIN)
>> - duration = FFMAX(duration, end_time - start_time);
>> + if (end_time != INT64_MIN) {
>> + if (valid_duration_from_pts(start_time, end_time,
avio_size(ic->pb), ic->bit_rate)) {
>> + duration = FFMAX(duration, end_time - start_time);
>> + }
>> + }
>> }
>> if (duration != INT64_MIN && duration > 0 && ic->duration ==
AV_NOPTS_VALUE) {
>> ic->duration = duration;
>
> this makes stream durations and file duration inconsistent
Michael Niedermayer,
You mean ,the first mpegts file's duration time very large is not wrong?
When i use ffmpeg to cut and transcode an mkv file use -ss -t, the
duration time is very big
The duration is right if i use this patch
>
>
>> @@ -2233,7 +2259,7 @@ static void estimate_timings(AVFormatContext *ic,
int64_t old_offset)
>> }
>>
>> if ((!strcmp(ic->iformat->name, "mpeg") ||
>> - !strcmp(ic->iformat->name, "mpegts")) &&
>> + !strcmp(ic->iformat->name, "mpegps")) &&
>
> there is no ic->iformat->name == "mpegps"
I have not add this line
Jung, what's meaning you add this mpegps line?
>
> [...]
>
> --
> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> Complexity theory is the science of finding the exact solution to an
> approximation. Benchmarking OTOH is finding an approximation of the
> exact
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel at ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
More information about the ffmpeg-devel
mailing list