[FFmpeg-devel] Re : Re: [PATCH] Wrong duration in TS container (Ticket #1836)

Michael Niedermayer michaelni at gmx.at
Tue Oct 30 21:16:12 CET 2012


On Tue, Oct 30, 2012 at 10:44:00PM +0900, Hee Suk Jung wrote:
> 
> Hi Hendrik
> 
> Thanks for your feedback.
> I comment my opinion for your question and update new patch.
> 
> Hendrik wrote:
> > The way the calculation is written, it will always result in a
> > division by zero if bitrate is < 10000.
> > I would recommend to re-order the calcuation into this form:
> >
> > (filesize * 8) / bitrate * limit_filesize_multiple * 1000000
> >
> > As an alternative, move one factor 1000 into the filesize
> > multiplication, to preserve a bit more accuracy in these integer
> > division.
>  --> Yes, root casuse of problem is that bit rate is under 1 kbps.
>      And so I change calculation order as your suggestion.
> 
> >
> > Personally, i think this check can also easily go wrong. What if only
> > the audio stream in a file has a determined bitrate, and the video
> > does not?
> > It would trigger this, and discard a possibly perfectly valid duration.
>  --> I don't think so.
>      We suppose that bit rate of video stream is NULL and audio bit rate is 500kbps.
>      Total bit rate of streams is too smaller than actual bit rate.
>      When estimated duration is bigger than refernce duration,
>      we use new duration.
>      (reference duration : (filesize * 8) / bitrate * limit_filesize_multiple * 1000000 )
>      And so duration is not changed becasue very small bit rate (<< actual bit rate) make
>      so big reference duration.
> 
> I hope your feedback.
> 
> Thanks.
> 
> From 8beba62059f0139d85a9142d8ec99958685323fb Mon Sep 17 00:00:00 2001
> From: Heesuk Jung
> Date: Tue, 30 Oct 2012 05:42:36 -0700
> 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 points as below.
> 
> 1. check if duration estimation is reasonable or not.
> 
> examine if estimated duration is valid based on bit rate information.
> The duration is regarded as abnormal value if it is unreasonably bigger
> than file size / average bit rate.
> 
> 2. check if PTS time diff is reasonable or not.
> 
> Duration is determined comparing PTS time diff with estimated duration.
> (Actually final duration is selected as bigger value in PTS time diff and
> estimated duration) 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).
> ---
>  libavformat/utils.c |   87 +++++++++++++++++++++++++++++++++++++++++++++++++--
>  1 file changed, 84 insertions(+), 3 deletions(-)
>  mode change 100644 => 100755 ffprobe.c
>  mode change 100644 => 100755 libavformat/utils.c

trying to apply this with git am produces:
Applying: Re : Re: [PATCH] Wrong duration in TS container (Ticket #1836)
Using index info to reconstruct a base tree...
error: patch failed: libavformat/utils.c:2089
error: libavformat/utils.c: patch does not apply
Did you hand edit your patch?
It does not apply to blobs recorded in its index.
Cannot fall back to three-way merge.
Patch failed at 0001 Re : Re: [PATCH] Wrong duration in TS container (Ticket #1836)
When you have resolved this problem run "git am --resolved".
If you would prefer to skip this patch, instead run "git am --skip".
To restore the original branch and stop patching run "git am --abort".

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Why not whip the teacher when the pupil misbehaves? -- Diogenes of Sinope
-------------- 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/20121030/c90134ec/attachment.asc>


More information about the ffmpeg-devel mailing list