Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
cf28490e
Commit
cf28490e
authored
Oct 10, 2015
by
Alex Agranovsky
Committed by
Nicolas George
Oct 12, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avfilter/drawtext: allow to format pts with strftime
Signed-off-by:
Alex Agranovsky
<
alex@sighthound.com
>
parent
1f3a29e9
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
2 deletions
+18
-2
filters.texi
doc/filters.texi
+7
-1
vf_drawtext.c
libavfilter/vf_drawtext.c
+11
-1
No files found.
doc/filters.texi
View file @
cf28490e
...
...
@@ -5398,14 +5398,20 @@ A 1 character description of the current picture type.
@item pts
The timestamp of the current frame.
It can take up to t
wo
arguments.
It can take up to t
hree
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.
@code{gmtime} stands for the timestamp of the frame formatted as UTC time;
@code{localtime} stands for the timestamp of the frame formatted as
local time zone time.
The second argument is an offset added to the timestamp.
If the format is set to @code{localtime} or @code{gmtime},
a third argument may be supplied: a strftime() format string.
By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
@end table
@subsection Examples
...
...
libavfilter/vf_drawtext.c
View file @
cf28490e
...
...
@@ -824,6 +824,16 @@ static int func_pts(AVFilterContext *ctx, AVBPrint *bp,
(
int
)(
ms
/
1000
)
%
60
,
(
int
)
ms
%
1000
);
}
}
else
if
(
!
strcmp
(
fmt
,
"localtime"
)
||
!
strcmp
(
fmt
,
"gmtime"
))
{
struct
tm
tm
;
time_t
ms
=
(
time_t
)
pts
;
const
char
*
timefmt
=
argc
>=
3
?
argv
[
2
]
:
"%Y-%m-%d %H:%M:%S"
;
if
(
!
strcmp
(
fmt
,
"localtime"
))
localtime_r
(
&
ms
,
&
tm
);
else
gmtime_r
(
&
ms
,
&
tm
);
av_bprint_strftime
(
bp
,
timefmt
,
&
tm
);
}
else
{
av_log
(
ctx
,
AV_LOG_ERROR
,
"Invalid format '%s'
\n
"
,
fmt
);
return
AVERROR
(
EINVAL
);
...
...
@@ -958,7 +968,7 @@ static const struct drawtext_function {
{
"expr_int_format"
,
2
,
3
,
0
,
func_eval_expr_int_format
},
{
"eif"
,
2
,
3
,
0
,
func_eval_expr_int_format
},
{
"pict_type"
,
0
,
0
,
0
,
func_pict_type
},
{
"pts"
,
0
,
2
,
0
,
func_pts
},
{
"pts"
,
0
,
3
,
0
,
func_pts
},
{
"gmtime"
,
0
,
1
,
'G'
,
func_strftime
},
{
"localtime"
,
0
,
1
,
'L'
,
func_strftime
},
{
"frame_num"
,
0
,
0
,
0
,
func_frame_num
},
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment