@item PREV_OUTPTS
previous output PTS
+@item RTCTIME
+wallclock (RTC) time in microseconds
+
+@item RTCSTART
+wallclock (RTC) time at the start of the movie in microseconds
+
@end table
Some examples follow:
# fixed rate 25 fps with some jitter
setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
+
+# generate timestamps from a "live source" and rebase onto the current timebase
+setpts='(RTCTIME - RTCSTART) / (TB * 1000000)"
@end example
@anchor{setsar}
#include "libavutil/eval.h"
#include "libavutil/internal.h"
#include "libavutil/mathematics.h"
+#include "libavutil/time.h"
#include "avfilter.h"
#include "internal.h"
#include "video.h"
"PTS", ///< original pts in the file of the frame
"STARTPTS", ///< PTS at start of movie
"TB", ///< timebase
+ "RTCTIME", ///< wallclock (RTC) time in micro seconds
+ "RTCSTART", ///< wallclock (RTC) time at the start of the movie in micro seconds
NULL
};
VAR_PTS,
VAR_STARTPTS,
VAR_TB,
+ VAR_RTCTIME,
+ VAR_RTCSTART,
VAR_VARS_NB
};
SetPTSContext *setpts = inlink->dst->priv;
setpts->var_values[VAR_TB] = av_q2d(inlink->time_base);
+ setpts->var_values[VAR_RTCSTART] = av_gettime();
av_log(inlink->src, AV_LOG_VERBOSE, "TB:%f\n", setpts->var_values[VAR_TB]);
return 0;
setpts->var_values[VAR_INTERLACED] = frame->video->interlaced;
setpts->var_values[VAR_PTS ] = TS2D(frame->pts);
setpts->var_values[VAR_POS ] = frame->pos == -1 ? NAN : frame->pos;
+ setpts->var_values[VAR_RTCTIME ] = av_gettime();
d = av_expr_eval(setpts->expr, setpts->var_values, NULL);
frame->pts = D2TS(d);