FFmpeg 2.0.7
Since* 1.0
#

Change the PTS (presentation timestamp) of the input frames.

setpts works on video frames, asetpts on audio frames.

This filter accepts the following options:

expr

The expression which is evaluated for each frame to construct its timestamp.

The expression is evaluated through the eval API and can contain the following constants:

FRAME_RATE

frame rate, only defined for constant frame-rate video

PTS

the presentation timestamp in input

N

the count of the input frame for video or the number of consumed samples, not including the current frame for audio, starting from 0.

NB_CONSUMED_SAMPLES

the number of consumed samples, not including the current frame (only audio)

NB_SAMPLES, S

the number of samples in the current frame (only audio)

SAMPLE_RATE, SR

audio sample rate

STARTPTS

the PTS of the first frame

STARTT

the time in seconds of the first frame

INTERLACED

tell if the current frame is interlaced

T

the time in seconds of the current frame

TB

the time base

POS

original position in the file of the frame, or undefined if undefined for the current frame

PREV_INPTS

previous input PTS

PREV_INT

previous input time in seconds

PREV_OUTPTS

previous output PTS

PREV_OUTT

previous output time in seconds

RTCTIME

wallclock (RTC) time in microseconds. This is deprecated, use time(0) instead.

RTCSTART

wallclock (RTC) time at the start of the movie in microseconds

#

Examples

  • Start counting PTS from zero

    setpts=PTS-STARTPTS
  • Apply fast motion effect:

    setpts=0.5*PTS
  • Apply slow motion effect:

    setpts=2.0*PTS
  • Set fixed rate of 25 frames per second:

    setpts=N/(25*TB)
  • Set fixed rate 25 fps with some jitter:

    setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  • Apply an offset of 10 seconds to the input PTS:

    setpts=PTS+10/TB
  • Generate timestamps from a "live source" and rebase onto the current timebase:

    setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  • Generate timestamps by counting samples:

    asetpts=N/SR/TB