[FFmpeg-devel] [RFC][PATCH] Fix timebase for filtered frames

Alexander Strange astrange
Sat Oct 30 07:53:01 CEST 2010


On Oct 29, 2010, at 7:52 PM, Stefano Sabatini wrote:

> Check attached patch.
> 
> This is not the best solution, as one of the purposes of the timebases
> in the filterchain was to avoid potentially lossy PTS conversion.
> 
> For an example of a failing command try this:
> ffmpeg -t 5 -i INPUT -vf settb=1/100 -y OUTPUT
> 
> This actually happens only using the settb filter, but the filterchain
> may change anyway the timebase of the output (maybe the setpts, and
> the overlay, will have this power), so that needs to be fixed.
> 
> Anyway looking at the ffmpeg.c code I got lost, for example:
> 
> static double
> get_sync_ipts(const AVOutputStream *ost)
> {
>    const AVInputStream *ist = ost->sync_ist;
>    return (double)(ist->pts - start_time)/AV_TIME_BASE;
> }
> 
> start_time is expressed in AV_TIME_BASE, and the code seems to assume
> that ist->pts is also expressed in AV_TIME_BASE, which is not just the
> case as it is usually expressed using the timebase in
> ist->st->time_base.

ist->pts is always in AV_TIME_BASE, it's converted at the top of output_packet().

In case you want to get rid of that, here's two patches I wrote but never tested beyond compiling.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Add-a-new-function-av_rescale_q2d.patch
Type: application/octet-stream
Size: 1815 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20101030/9645cf04/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-in-progress-Reduce-the-number-of-rational-base-conve.patch
Type: application/octet-stream
Size: 12048 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20101030/9645cf04/attachment-0001.obj>



More information about the ffmpeg-devel mailing list