FFmpeg
Loading...
Searching...
No Matches
vf_fps.c
Go to the documentation of this file.
1/*
2 * Copyright 2007 Bobby Bingham
3 * Copyright 2012 Robert Nagy <ronag89 gmail com>
4 * Copyright 2012 Anton Khirnov <anton khirnov net>
5 * Copyright 2018 Calvin Walton <calvin.walton@kepstin.ca>
6 *
7 * This file is part of FFmpeg.
8 *
9 * FFmpeg is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation; either
12 * version 2.1 of the License, or (at your option) any later version.
13 *
14 * FFmpeg is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
18 *
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with FFmpeg; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22 */
23
24/**
25 * @file
26 * a filter enforcing given constant framerate
27 */
28
29#include <float.h>
30#include <stdint.h>
31
32#include "libavutil/avassert.h"
33#include "libavutil/eval.h"
35#include "libavutil/opt.h"
36#include "avfilter.h"
37#include "ccfifo.h"
38#include "filters.h"
39#include "video.h"
40
46
47static const char *const var_names[] = {
48 "source_fps",
49 "ntsc",
50 "pal",
51 "film",
52 "ntsc_film",
53 NULL
54};
55
64
65static const double ntsc_fps = 30000.0 / 1001.0;
66static const double pal_fps = 25.0;
67static const double film_fps = 24.0;
68static const double ntsc_film_fps = 24000.0 / 1001.0;
69
70typedef struct FPSContext {
71 const AVClass *class;
72
73 double start_time; ///< pts, in seconds, of the expected first frame
74
75 char *framerate; ///< expression that defines the target framerate
76 int rounding; ///< AVRounding method for timestamps
77 int eof_action; ///< action performed for last frame in FIFO
78
79 /* Set during outlink configuration */
80 int64_t in_pts_off; ///< input frame pts offset for start_time handling
81 int64_t out_pts_off; ///< output frame pts offset for start_time handling
82
83 /* Runtime state */
84 int status; ///< buffered input status
85 int64_t status_pts; ///< buffered input status timestamp
86 int64_t last_in_pts; ///< last frame timestamp in input timebase
87 int last_frame_trimmed; ///< last frame ends at or before start_time
88
89 AVFrame *frames[2]; ///< buffered frames
90 int frames_count; ///< number of buffered frames
91 CCFifo cc_fifo; ///< closed captions
92
93 int64_t next_pts; ///< pts of the next frame to output
94
95 /* statistics */
96 int cur_frame_out; ///< number of times current frame has been output
97 int frames_in; ///< number of frames on input
98 int frames_out; ///< number of frames on output
99 int dup; ///< number of frames duplicated
100 int drop; ///< number of framed dropped
101} FPSContext;
102
103#define OFFSET(x) offsetof(FPSContext, x)
104#define V AV_OPT_FLAG_VIDEO_PARAM
105#define F AV_OPT_FLAG_FILTERING_PARAM
106static const AVOption fps_options[] = {
107 { "fps", "A string describing desired output framerate", OFFSET(framerate), AV_OPT_TYPE_STRING, { .str = "25" }, 0, 0, V|F },
108 { "start_time", "Assume the first PTS should be this value.", OFFSET(start_time), AV_OPT_TYPE_DOUBLE, { .dbl = DBL_MAX}, -DBL_MAX, DBL_MAX, V|F },
109 { "round", "set rounding method for timestamps", OFFSET(rounding), AV_OPT_TYPE_INT, { .i64 = AV_ROUND_NEAR_INF }, 0, 5, V|F, .unit = "round" },
110 { "zero", "round towards 0", 0, AV_OPT_TYPE_CONST, { .i64 = AV_ROUND_ZERO }, 0, 0, V|F, .unit = "round" },
111 { "inf", "round away from 0", 0, AV_OPT_TYPE_CONST, { .i64 = AV_ROUND_INF }, 0, 0, V|F, .unit = "round" },
112 { "down", "round towards -infty", 0, AV_OPT_TYPE_CONST, { .i64 = AV_ROUND_DOWN }, 0, 0, V|F, .unit = "round" },
113 { "up", "round towards +infty", 0, AV_OPT_TYPE_CONST, { .i64 = AV_ROUND_UP }, 0, 0, V|F, .unit = "round" },
114 { "near", "round to nearest", 0, AV_OPT_TYPE_CONST, { .i64 = AV_ROUND_NEAR_INF }, 0, 0, V|F, .unit = "round" },
115 { "eof_action", "action performed for last frame", OFFSET(eof_action), AV_OPT_TYPE_INT, { .i64 = EOF_ACTION_ROUND }, 0, EOF_ACTION_NB-1, V|F, .unit = "eof_action" },
116 { "round", "round similar to other frames", 0, AV_OPT_TYPE_CONST, { .i64 = EOF_ACTION_ROUND }, 0, 0, V|F, .unit = "eof_action" },
117 { "pass", "pass through last frame", 0, AV_OPT_TYPE_CONST, { .i64 = EOF_ACTION_PASS }, 0, 0, V|F, .unit = "eof_action" },
118 { NULL }
119};
120
122
124{
125 FPSContext *s = ctx->priv;
126
127 s->status_pts = AV_NOPTS_VALUE;
128 s->next_pts = AV_NOPTS_VALUE;
129
130 return 0;
131}
132
133/* Remove the first frame from the buffer, returning it */
135{
136 AVFrame *frame;
137
138 /* Must only be called when there are frames in the buffer */
139 av_assert1(s->frames_count > 0);
140
141 frame = s->frames[0];
142 s->frames[0] = s->frames[1];
143 s->frames[1] = NULL;
144 s->frames_count--;
145
146 /* Update statistics counters */
147 s->frames_out += s->cur_frame_out;
148 if (s->cur_frame_out > 1) {
149 av_log(ctx, AV_LOG_DEBUG, "Duplicated frame with pts %"PRId64" %d times\n",
150 frame->pts, s->cur_frame_out - 1);
151 s->dup += s->cur_frame_out - 1;
152 } else if (s->cur_frame_out == 0) {
153 av_log(ctx, AV_LOG_DEBUG, "Dropping frame with pts %"PRId64"\n",
154 frame->pts);
155 s->drop++;
156 }
157 s->cur_frame_out = 0;
158
159 return frame;
160}
161
163{
164 FPSContext *s = ctx->priv;
165
166 AVFrame *frame;
167
168 while (s->frames_count > 0) {
171 }
172 ff_ccfifo_uninit(&s->cc_fifo);
173
174 av_log(ctx, AV_LOG_VERBOSE, "%d frames in, %d frames out; %d frames dropped, "
175 "%d frames duplicated.\n", s->frames_in, s->frames_out, s->drop, s->dup);
176}
177
178static int config_props(AVFilterLink* outlink)
179{
180 AVFilterContext *ctx = outlink->src;
181 AVFilterLink *inlink = ctx->inputs[0];
182 FilterLink *il = ff_filter_link(inlink);
183 FilterLink *ol = ff_filter_link(outlink);
184 FPSContext *s = ctx->priv;
185
186 double var_values[VARS_NB], res;
187 int ret;
188
189 var_values[VAR_SOURCE_FPS] = av_q2d(il->frame_rate);
190 var_values[VAR_FPS_NTSC] = ntsc_fps;
191 var_values[VAR_FPS_PAL] = pal_fps;
192 var_values[VAR_FPS_FILM] = film_fps;
193 var_values[VAR_FPS_NTSC_FILM] = ntsc_film_fps;
194 ret = av_expr_parse_and_eval(&res, s->framerate,
195 var_names, var_values,
196 NULL, NULL, NULL, NULL, NULL, 0, ctx);
197 if (ret < 0)
198 return ret;
199
200 ol->frame_rate = av_d2q(res, INT_MAX);
201 outlink->time_base = av_inv_q(ol->frame_rate);
202
203 /* Calculate the input and output pts offsets for start_time */
204 if (s->start_time != DBL_MAX && s->start_time != AV_NOPTS_VALUE) {
205 double first_pts = s->start_time * AV_TIME_BASE;
206 if (first_pts < INT64_MIN || first_pts > INT64_MAX) {
207 av_log(ctx, AV_LOG_ERROR, "Start time %f cannot be represented in internal time base\n",
208 s->start_time);
209 return AVERROR(EINVAL);
210 }
211 s->in_pts_off = av_rescale_q_rnd(first_pts, AV_TIME_BASE_Q, inlink->time_base,
212 s->rounding | AV_ROUND_PASS_MINMAX);
213 s->out_pts_off = av_rescale_q_rnd(first_pts, AV_TIME_BASE_Q, outlink->time_base,
214 s->rounding | AV_ROUND_PASS_MINMAX);
215 s->next_pts = s->out_pts_off;
216 av_log(ctx, AV_LOG_VERBOSE, "Set first pts to (in:%"PRId64" out:%"PRId64") from start time %f\n",
217 s->in_pts_off, s->out_pts_off, s->start_time);
218 }
219
220 ret = ff_ccfifo_init(&s->cc_fifo, ol->frame_rate, ctx);
221 if (ret < 0) {
222 av_log(ctx, AV_LOG_ERROR, "Failure to setup CC FIFO queue\n");
223 return ret;
224 }
225
226 av_log(ctx, AV_LOG_VERBOSE, "fps=%d/%d\n", ol->frame_rate.num, ol->frame_rate.den);
227
228 return 0;
229}
230
231/* Read a frame from the input and save it in the buffer */
233{
234 AVFrame *frame;
235 int ret;
236 int64_t in_pts;
237
238 /* Must only be called when we have buffer room available */
239 av_assert1(s->frames_count < 2);
240
241 ret = ff_inlink_consume_frame(inlink, &frame);
242 /* Caller must have run ff_inlink_check_available_frame first */
243 av_assert1(ret);
244 if (ret < 0)
245 return ret;
246
247 /* Convert frame pts to output timebase.
248 * The dance with offsets is required to match the rounding behaviour of the
249 * previous version of the fps filter when using the start_time option. */
250 in_pts = s->last_in_pts = frame->pts;
251 frame->pts = s->out_pts_off + av_rescale_q_rnd(in_pts - s->in_pts_off,
252 inlink->time_base, outlink->time_base,
253 s->rounding | AV_ROUND_PASS_MINMAX);
254
255 av_log(ctx, AV_LOG_DEBUG, "Read frame with in pts %"PRId64", out pts %"PRId64"\n",
256 in_pts, frame->pts);
257
258 ff_ccfifo_extract(&s->cc_fifo, frame);
259 s->frames[s->frames_count++] = frame;
260 s->frames_in++;
261
262 return 1;
263}
264
265/* Write a frame to the output */
266static int write_frame(AVFilterContext *ctx, FPSContext *s, AVFilterLink *outlink, int *again)
267{
268 AVFrame *frame;
269 int eof_before_or_at_next;
270 int first_output_due;
271
272 av_assert1(s->frames_count == 2 || (s->status && s->frames_count == 1));
273
274 /* We haven't yet determined the pts of the first frame */
275 if (s->next_pts == AV_NOPTS_VALUE) {
276 if (s->frames[0]->pts != AV_NOPTS_VALUE) {
277 s->next_pts = s->frames[0]->pts;
278 av_log(ctx, AV_LOG_VERBOSE, "Set first pts to %"PRId64"\n", s->next_pts);
279 } else {
280 av_log(ctx, AV_LOG_WARNING, "Discarding initial frame(s) with no "
281 "timestamp.\n");
284 *again = 1;
285 return 0;
286 }
287 }
288
289 eof_before_or_at_next = s->status && s->status_pts <= s->next_pts;
290 first_output_due = !s->frames_out && !s->cur_frame_out &&
291 !s->last_frame_trimmed &&
292 s->frames[0]->pts == s->next_pts &&
293 s->status_pts == s->next_pts;
294
295 /* There are two conditions where we want to drop a frame:
296 * - If we have two buffered frames and the second frame is acceptable
297 * as the next output frame, then drop the first buffered frame.
298 * - If we have status (EOF) set, drop frames when we hit the
299 * status timestamp, unless no frame has been output yet and the
300 * buffered frame is due at the next output timestamp. */
301 if ((s->frames_count == 2 && s->frames[1]->pts <= s->next_pts) ||
302 (eof_before_or_at_next && !first_output_due)) {
303
306 *again = 1;
307 return 0;
308
309 /* Output a copy of the first buffered frame */
310 } else {
311 frame = av_frame_clone(s->frames[0]);
312 if (!frame)
313 return AVERROR(ENOMEM);
314 // Make sure Closed Captions will not be duplicated
315 ff_ccfifo_inject(&s->cc_fifo, frame);
316 frame->pts = s->next_pts++;
317 frame->duration = 1;
318
319 av_log(ctx, AV_LOG_DEBUG, "Writing frame with pts %"PRId64" to pts %"PRId64"\n",
320 s->frames[0]->pts, frame->pts);
321 s->cur_frame_out++;
322 *again = 1;
323 return ff_filter_frame(outlink, frame);
324 }
325}
326
327/* Convert status_pts to outlink timebase */
328static void update_eof_pts(AVFilterContext *ctx, FPSContext *s, AVFilterLink *inlink, AVFilterLink *outlink, int64_t status_pts)
329{
330 int eof_rounding = (s->eof_action == EOF_ACTION_PASS) ? AV_ROUND_UP : s->rounding;
331
332 /* Check trimming before rounding can collapse a frame before start_time
333 * and the end of its interval onto the first output timestamp. A frame
334 * starting at start_time is still eligible even with zero duration. */
335 s->last_frame_trimmed = s->start_time != DBL_MAX &&
336 s->start_time != AV_NOPTS_VALUE &&
337 s->last_in_pts < s->in_pts_off &&
338 status_pts <= s->in_pts_off;
339 s->status_pts = av_rescale_q_rnd(status_pts, inlink->time_base, outlink->time_base,
340 eof_rounding | AV_ROUND_PASS_MINMAX);
341
342 av_log(ctx, AV_LOG_DEBUG, "EOF is at pts %"PRId64"\n", s->status_pts);
343}
344
346{
347 FPSContext *s = ctx->priv;
348 AVFilterLink *inlink = ctx->inputs[0];
349 AVFilterLink *outlink = ctx->outputs[0];
350
351 int ret;
352 int again = 0;
353 int64_t status_pts;
354
355 FF_FILTER_FORWARD_STATUS_BACK(outlink, inlink);
356
357 /* No buffered status: normal operation */
358 if (!s->status) {
359
360 /* Read available input frames if we have room */
361 while (s->frames_count < 2 && ff_inlink_check_available_frame(inlink)) {
362 ret = read_frame(ctx, s, inlink, outlink);
363 if (ret < 0)
364 return ret;
365 }
366
367 /* We do not yet have enough frames to produce output */
368 if (s->frames_count < 2) {
369 /* Check if we've hit EOF (or otherwise that an error status is set) */
370 ret = ff_inlink_acknowledge_status(inlink, &s->status, &status_pts);
371 if (ret > 0)
372 update_eof_pts(ctx, s, inlink, outlink, status_pts);
373
374 if (!ret) {
375 /* If someone wants us to output, we'd better ask for more input */
376 FF_FILTER_FORWARD_WANTED(outlink, inlink);
377 return 0;
378 }
379 }
380 }
381
382 /* Buffered frames are available, so generate an output frame */
383 if (s->frames_count > 0) {
384 ret = write_frame(ctx, s, outlink, &again);
385 /* Couldn't generate a frame, so schedule us to perform another step */
386 if (again && ff_inoutlink_check_flow(inlink, outlink))
388 return ret;
389 }
390
391 /* No frames left, so forward the status */
392 if (s->status && s->frames_count == 0) {
393 ff_outlink_set_status(outlink, s->status, s->next_pts);
394 return 0;
395 }
396
397 return FFERROR_NOT_READY;
398}
399
401 {
402 .name = "default",
403 .type = AVMEDIA_TYPE_VIDEO,
404 .config_props = config_props,
405 },
406};
407
409 .p.name = "fps",
410 .p.description = NULL_IF_CONFIG_SMALL("Force constant framerate."),
411 .p.priv_class = &fps_class,
413 .init = init,
414 .uninit = uninit,
415 .priv_size = sizeof(FPSContext),
419};
const FFFilter ff_vf_fps
Definition vf_fps.c:408
static AVFormatContext * ctx
simple assert() macros that are a bit more flexible than ISO C assert().
#define av_assert1(cond)
assert() equivalent, that does not lie in speed critical code.
Definition avassert.h:58
#define V
Definition avdct.c:32
int ff_inoutlink_check_flow(AVFilterLink *inlink, AVFilterLink *outlink)
Check for flow control between input and output.
Definition avfilter.c:1659
int ff_inlink_acknowledge_status(AVFilterLink *link, int *rstatus, int64_t *rpts)
Test and acknowledge the change of status on the link.
Definition avfilter.c:1472
int ff_inlink_check_available_frame(AVFilterLink *link)
Test if a frame is available on the link.
Definition avfilter.c:1494
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
Definition avfilter.c:1073
void ff_filter_set_ready(AVFilterContext *filter, unsigned priority)
Mark a filter ready and schedule it for activation.
Definition avfilter.c:229
int ff_inlink_consume_frame(AVFilterLink *link, AVFrame **rframe)
Take a frame from the link's FIFO and update the link's stats.
Definition avfilter.c:1525
Main libavfilter public API header.
@ VARS_NB
Definition boxblur.c:43
#define s(width, name)
Definition cbs_vp9.c:198
CC FIFO Buffer.
#define NULL
Definition coverity.c:32
long long int64_t
Definition coverity.c:34
static AVFrame * frame
#define F(x)
int(* init)(AVBSFContext *ctx)
Definition dts2pts.c:608
int av_expr_parse_and_eval(double *d, const char *s, const char *const *const_names, const double *const_values, const char *const *func1_names, double(*const *funcs1)(void *, double), const char *const *func2_names, double(*const *funcs2)(void *, double, double), void *opaque, int log_offset, void *log_ctx)
Parse and evaluate an expression.
Definition eval.c:839
simple arithmetic expression evaluator
static int64_t start_time
Definition ffplay.c:398
@ AV_OPT_TYPE_CONST
Special option type for declaring named constants.
Definition opt.h:298
@ AV_OPT_TYPE_INT
Underlying C type is int.
Definition opt.h:258
@ AV_OPT_TYPE_DOUBLE
Underlying C type is double.
Definition opt.h:266
@ AV_OPT_TYPE_STRING
Underlying C type is a uint8_t* that is either NULL or points to a C string allocated with the av_mal...
Definition opt.h:275
#define AVFILTER_FLAG_METADATA_ONLY
The filter is a "metadata" filter - it does not modify the frame data in any way.
Definition avfilter.h:188
#define AVERROR(e)
Definition error.h:45
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
Definition frame.c:64
AVFrame * av_frame_clone(const AVFrame *src)
Create a new frame that references the same data as src.
Definition frame.c:483
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
Definition log.h:231
#define AV_LOG_WARNING
Something somehow does not look correct.
Definition log.h:216
#define AV_LOG_VERBOSE
Detailed information.
Definition log.h:226
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition log.h:210
AVRational av_d2q(double d, int max)
Convert a double precision floating point number to a rational.
Definition rational.c:110
static double av_q2d(AVRational a)
Convert an AVRational to a double.
Definition rational.h:104
static av_always_inline AVRational av_inv_q(AVRational q)
Invert a rational.
Definition rational.h:159
int64_t av_rescale_q_rnd(int64_t a, AVRational bq, AVRational cq, enum AVRounding rnd)
Rescale a 64-bit integer by 2 rational numbers with specified rounding.
@ AV_ROUND_INF
Round away from zero.
@ AV_ROUND_ZERO
Round toward zero.
@ AV_ROUND_DOWN
Round toward -infinity.
@ AV_ROUND_PASS_MINMAX
Flag telling rescaling functions to pass INT64_MIN/MAX through unchanged, avoiding special cases for ...
@ AV_ROUND_UP
Round toward +infinity.
@ AV_ROUND_NEAR_INF
Round to nearest and halfway cases away from zero.
@ AVMEDIA_TYPE_VIDEO
Definition avutil.h:200
#define AV_NOPTS_VALUE
Undefined timestamp value.
Definition avutil.h:247
#define AV_TIME_BASE
Internal time base represented as integer.
Definition avutil.h:253
#define AV_TIME_BASE_Q
Internal time base represented as fractional value.
Definition avutil.h:263
static av_cold void uninit(AVBitStreamFilterContext *ctx)
static int activate(AVBitStreamFilterContext *ctx)
int ff_ccfifo_inject(CCFifo *ccf, AVFrame *frame)
Insert CC data from the FIFO into an AVFrame (as side data)
Definition ccfifo.c:133
int ff_ccfifo_init(CCFifo *ccf, AVRational framerate, void *log_ctx)
Initialize a CCFifo.
Definition ccfifo.c:53
void ff_ccfifo_uninit(CCFifo *ccf)
Free all memory allocated in a CCFifo and clear the context.
Definition ccfifo.c:46
int ff_ccfifo_extract(CCFifo *ccf, AVFrame *frame)
Extract CC data from an AVFrame.
Definition ccfifo.c:183
#define FILTER_INPUTS(array)
Definition filters.h:264
#define FILTER_OUTPUTS(array)
Definition filters.h:265
#define FF_FILTER_FORWARD_WANTED(outlink, inlink)
Forward the frame_wanted_out flag from an output link to an input link.
Definition filters.h:694
static void ff_outlink_set_status(AVFilterLink *link, int status, int64_t pts)
Set the status field of a link from the source filter.
Definition filters.h:629
#define FFERROR_NOT_READY
Filters implementation helper functions and internal structures.
Definition filters.h:34
#define FF_FILTER_FORWARD_STATUS_BACK(outlink, inlink)
Forward the status on an output link to an input link.
Definition filters.h:639
static FilterLink * ff_filter_link(AVFilterLink *link)
Definition filters.h:199
#define AVFILTER_DEFINE_CLASS(fname)
Definition filters.h:478
#define av_cold
Definition attributes.h:117
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition internal.h:97
var_name
Definition noise.c:46
static const char *const var_names[]
Definition noise.c:30
AVOptions.
EOFAction
Definition packetsync.h:29
@ EOF_ACTION_PASS
Definition packetsync.h:31
static int config_props(AVBitStreamFilterLink *link)
Definition source.c:181
Describe the class of an AVClass context structure.
Definition log.h:76
An instance of a filter.
Definition avfilter.h:279
A filter pad used for either input or output.
Definition filters.h:40
This structure describes decoded (raw) audio or video data.
Definition frame.h:479
AVOption.
Definition opt.h:428
int num
Numerator.
Definition rational.h:59
int den
Denominator.
Definition rational.h:60
int frames_in
number of frames on input
Definition vf_fps.c:97
int last_frame_trimmed
last frame ends at or before start_time
Definition vf_fps.c:87
int dup
number of frames duplicated
Definition vf_fps.c:99
int rounding
AVRounding method for timestamps.
Definition vf_fps.c:76
int status
buffered input status
Definition vf_fps.c:84
int64_t last_in_pts
last frame timestamp in input timebase
Definition vf_fps.c:86
int eof_action
action performed for last frame in FIFO
Definition vf_fps.c:77
CCFifo cc_fifo
closed captions
Definition vf_fps.c:91
int frames_out
number of frames on output
Definition vf_fps.c:98
int64_t status_pts
buffered input status timestamp
Definition vf_fps.c:85
int64_t in_pts_off
input frame pts offset for start_time handling
Definition vf_fps.c:80
int cur_frame_out
number of times current frame has been output
Definition vf_fps.c:96
char * framerate
expression that defines the target framerate
Definition vf_fps.c:75
double start_time
pts, in seconds, of the expected first frame
Definition vf_fps.c:73
int64_t next_pts
pts of the next frame to output
Definition vf_fps.c:93
int64_t out_pts_off
output frame pts offset for start_time handling
Definition vf_fps.c:81
int frames_count
number of buffered frames
Definition vf_fps.c:90
int drop
number of framed dropped
Definition vf_fps.c:100
AVFrame * frames[2]
buffered frames
Definition vf_fps.c:89
#define av_log(a,...)
float framerate
Definition av1_levels.c:29
@ VAR_FPS_NTSC_FILM
Definition vf_fps.c:61
@ VAR_FPS_NTSC
Definition vf_fps.c:58
@ VAR_SOURCE_FPS
Definition vf_fps.c:57
@ VAR_FPS_FILM
Definition vf_fps.c:60
@ VAR_FPS_PAL
Definition vf_fps.c:59
static int config_props(AVFilterLink *outlink)
Definition vf_fps.c:178
static void update_eof_pts(AVFilterContext *ctx, FPSContext *s, AVFilterLink *inlink, AVFilterLink *outlink, int64_t status_pts)
Definition vf_fps.c:328
static const AVFilterPad avfilter_vf_fps_outputs[]
Definition vf_fps.c:400
static AVFrame * shift_frame(AVFilterContext *ctx, FPSContext *s)
Definition vf_fps.c:134
static const double ntsc_fps
Definition vf_fps.c:65
static const double pal_fps
Definition vf_fps.c:66
static int write_frame(AVFilterContext *ctx, FPSContext *s, AVFilterLink *outlink, int *again)
Definition vf_fps.c:266
static const double film_fps
Definition vf_fps.c:67
@ EOF_ACTION_NB
Definition vf_fps.c:44
@ EOF_ACTION_ROUND
Definition vf_fps.c:42
static int activate(AVFilterContext *ctx)
Definition vf_fps.c:345
static const double ntsc_film_fps
Definition vf_fps.c:68
static av_cold void uninit(AVFilterContext *ctx)
Definition vf_fps.c:162
static int read_frame(AVFilterContext *ctx, FPSContext *s, AVFilterLink *inlink, AVFilterLink *outlink)
Definition vf_fps.c:232
#define OFFSET(x)
Definition vf_fps.c:103
static const AVOption fps_options[]
Definition vf_fps.c:106
const AVFilterPad ff_video_default_filterpad[1]
An AVFilterPad array whose only entry has name "default" and is of type AVMEDIA_TYPE_VIDEO.
Definition video.c:37