Now output pts have some sense.
Unified · Split
| @@ -12582,6 +12582,9 @@ single input image. · 12581 unmodified lines | ||
| 12582 | 12582 | |
| 12583 | 12583 | @item s |
| 12584 | 12584 | Set the output image size, default is 'hd720'. |
| 12585 | + | |
| 12586 | +@item fps | |
| 12587 | +Set the output frame rate, default is '25'. | |
| 12585 | 12588 | @end table |
| 12586 | 12589 | |
| 12587 | 12590 | Each expression can contain the following constants: |
| @@ -92,6 +92,7 @@ typedef struct ZPcontext { · 91 unmodified lines | ||
| 92 | 92 | int nb_frames; |
| 93 | 93 | int current_frame; |
| 94 | 94 | int finished; |
| 95 | + AVRational framerate; | |
| 95 | 96 | } ZPContext; |
| 96 | 97 | |
| 97 | 98 | #define OFFSET(x) offsetof(ZPContext, x) |
| @@ -103,6 +104,7 @@ static const AVOption zoompan_options[] = { · 5 unmodified lines | ||
| 103 | 104 | { "y", "set the y expression", OFFSET(y_expr_str), AV_OPT_TYPE_STRING, {.str="0"}, .flags = FLAGS }, |
| 104 | 105 | { "d", "set the duration expression", OFFSET(duration_expr_str), AV_OPT_TYPE_STRING, {.str="90"}, .flags = FLAGS }, |
| 105 | 106 | { "s", "set the output image size", OFFSET(w), AV_OPT_TYPE_IMAGE_SIZE, {.str="hd720"}, .flags = FLAGS }, |
| 107 | + { "fps", "set the output framerate", OFFSET(framerate), AV_OPT_TYPE_VIDEO_RATE, { .str = "25" }, .flags = FLAGS }, | |
| 106 | 108 | { NULL } |
| 107 | 109 | }; |
| 108 | 110 | |
| @@ -123,6 +125,8 @@ static int config_output(AVFilterLink *outlink) · 14 unmodified lines | ||
| 123 | 125 | |
| 124 | 126 | outlink->w = s->w; |
| 125 | 127 | outlink->h = s->h; |
| 128 | + outlink->time_base = av_inv_q(s->framerate); | |
| 129 | + outlink->frame_rate = s->framerate; | |
| 126 | 130 | s->desc = av_pix_fmt_desc_get(outlink->format); |
| 127 | 131 | |
| 128 | 132 | return 0; |
| @@ -133,8 +137,7 @@ static int output_single_frame(AVFilterContext *ctx, AVFrame *in, double *var_va · 4 unmodified lines | ||
| 133 | 137 | { |
| 134 | 138 | ZPContext *s = ctx->priv; |
| 135 | 139 | AVFilterLink *outlink = ctx->outputs[0]; |
| 136 | − int64_t pts = av_rescale_q(in->pts, ctx->inputs[0]->time_base, | |
| 137 | − outlink->time_base) + s->frame_count; | |
| 140 | + int64_t pts = s->frame_count; | |
| 138 | 141 | int k, x, y, w, h, ret = 0; |
| 139 | 142 | uint8_t *input[4]; |
| 140 | 143 | int px[4], py[4]; |