[FFmpeg-devel] [PATCH] avfilter: add "raw" modifier to print pts
Chema Gonzalez
chema at google.com
Wed Sep 2 22:40:01 CEST 2015
From: Chema Gonzalez <chema at google.com>
Example:
$ ffplay -vf "drawtext=fontfile=/usr/share/fonts/truetype/ubuntu-font-family/UbuntuMono-R.ttf:text='%{pict_type}
%{pts\:hms} %{pts\:raw} %{eif\:n\:u}':
fontcolor=white at 0.8:fontsize=40:x=7:y=680:box=1:boxcolor=black at 0.8,showinfo"
file.ts
Signed-off-by: Chema Gonzalez <chema at google.com>
---
doc/filters.texi | 3 ++-
libavfilter/vf_drawtext.c | 2 ++
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/doc/filters.texi b/doc/filters.texi
index 3e7d2a2..085de87 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -4930,7 +4930,8 @@ It can take up to two arguments.
The first argument is the format of the timestamp; it defaults to @code{flt}
for seconds as a decimal number with microsecond accuracy; @code{hms} stands
-for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
+for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy;
+ at code{raw} stands for the raw pts value.
The second argument is an offset added to the timestamp.
diff --git a/libavfilter/vf_drawtext.c b/libavfilter/vf_drawtext.c
index 16e3383..cf6a313 100644
--- a/libavfilter/vf_drawtext.c
+++ b/libavfilter/vf_drawtext.c
@@ -808,6 +808,8 @@ static int func_pts(AVFilterContext *ctx, AVBPrint *bp,
}
if (!strcmp(fmt, "flt")) {
av_bprintf(bp, "%.6f", s->var_values[VAR_T]);
+ } else if (!strcmp(fmt, "raw")) {
+ av_bprintf(bp, "%ld", (long int) (s->var_values[VAR_T] * 90000));
} else if (!strcmp(fmt, "hms")) {
if (isnan(pts)) {
av_bprintf(bp, " ??:??:??.???");
--
2.5.0.457.gab17608
More information about the ffmpeg-devel
mailing list