[FFmpeg-trac] #7947(avfilter:new): Feature request: expose more frame properties as variables in drawtext filter
FFmpeg
trac at avcodec.org
Fri Jun 7 23:10:06 EEST 2019
#7947: Feature request: expose more frame properties as variables in drawtext
filter
-------------------------------------+-------------------------------------
Reporter: | Owner:
electron.rotoscope |
Type: enhancement | Status: new
Priority: normal | Component: avfilter
Version: unspecified | Resolution:
Keywords: drawtext | Blocked By:
Blocking: | Reproduced by developer: 0
Analyzed by developer: 0 |
-------------------------------------+-------------------------------------
Comment (by electron.rotoscope):
git checkout diff written by the amazing kepstin
{{{
From: Calvin Walton <calvin.walton at kepstin.ca>
Date: Fri, 7 Jun 2019 15:06:36 -0400
Subject: [PATCH] vf_drawtext: Add pkt_pos, pkt_duration, pkt_size as
variables
---
libavfilter/vf_drawtext.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/libavfilter/vf_drawtext.c b/libavfilter/vf_drawtext.c
index cca2cbcb88..beafe0ba81 100644
--- a/libavfilter/vf_drawtext.c
+++ b/libavfilter/vf_drawtext.c
@@ -88,6 +88,9 @@ static const char *const var_names[] = {
"x",
"y",
"pict_type",
+ "pkt_pos",
+ "pkt_duration",
+ "pkt_size",
NULL
};
@@ -125,6 +128,9 @@ enum var_name {
VAR_X,
VAR_Y,
VAR_PICT_TYPE,
+ VAR_PKT_POS,
+ VAR_PKT_DURATION,
+ VAR_PKT_SIZE,
VAR_VARS_NB
};
@@ -1487,6 +1493,9 @@ static int filter_frame(AVFilterLink *inlink,
AVFrame *frame)
NAN : frame->pts * av_q2d(inlink->time_base);
s->var_values[VAR_PICT_TYPE] = frame->pict_type;
+ s->var_values[VAR_PKT_POS] = frame->pkt_pos;
+ s->var_values[VAR_PKT_DURATION] = frame->pkt_duration *
av_q2d(inlink->time_base);
+ s->var_values[VAR_PKT_SIZE] = frame->pkt_size;
s->metadata = frame->metadata;
draw_text(ctx, frame, frame->width, frame->height);
}}}
--
Ticket URL: <https://trac.ffmpeg.org/ticket/7947#comment:1>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker
More information about the FFmpeg-trac
mailing list