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

Stefano Sabatini stefano.sabatini-lala
Sat Oct 30 01:52:13 CEST 2010

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

Maybe I'm just tired, anyway if someone wants to help me understand
how that is supposed to work that would be great.
FFmpeg = Frightening Free Miracolous Peaceful Energized God

More information about the ffmpeg-devel mailing list