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
41334fca
Commit
41334fca
authored
Apr 25, 2014
by
Nicolas George
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lavfi/drawtext: allow to format pts as HH:MM:SS.mmm.
parent
50ed6e3c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
3 deletions
+43
-3
filters.texi
doc/filters.texi
+8
-1
vf_drawtext.c
libavfilter/vf_drawtext.c
+35
-2
No files found.
doc/filters.texi
View file @
41334fca
...
...
@@ -3850,7 +3850,14 @@ The frame number, starting from 0.
A 1 character description of the current picture type.
@item pts
The timestamp of the current frame, in seconds, with microsecond accuracy.
The timestamp of the current frame.
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.
The second argument is an offset added to the timestamp.
@end table
...
...
libavfilter/vf_drawtext.c
View file @
41334fca
...
...
@@ -699,8 +699,41 @@ static int func_pts(AVFilterContext *ctx, AVBPrint *bp,
char
*
fct
,
unsigned
argc
,
char
**
argv
,
int
tag
)
{
DrawTextContext
*
s
=
ctx
->
priv
;
const
char
*
fmt
;
double
pts
=
s
->
var_values
[
VAR_T
];
int
ret
;
av_bprintf
(
bp
,
"%.6f"
,
s
->
var_values
[
VAR_T
]);
fmt
=
argc
>=
1
?
argv
[
0
]
:
"flt"
;
if
(
argc
>=
2
)
{
int64_t
delta
;
if
((
ret
=
av_parse_time
(
&
delta
,
argv
[
1
],
1
))
<
0
)
{
av_log
(
ctx
,
AV_LOG_ERROR
,
"Invalid delta '%s'
\n
"
,
argv
[
1
]);
return
ret
;
}
pts
+=
(
double
)
delta
/
AV_TIME_BASE
;
}
if
(
!
strcmp
(
fmt
,
"flt"
))
{
av_bprintf
(
bp
,
"%.6f"
,
s
->
var_values
[
VAR_T
]);
}
else
if
(
!
strcmp
(
fmt
,
"hms"
))
{
if
(
isnan
(
pts
))
{
av_bprintf
(
bp
,
" ??:??:??.???"
);
}
else
{
int64_t
ms
=
round
(
pts
*
1000
);
char
sign
=
' '
;
if
(
ms
<
0
)
{
sign
=
'-'
;
ms
=
-
ms
;
}
av_bprintf
(
bp
,
"%c%02d:%02d:%02d.%03d"
,
sign
,
(
int
)(
ms
/
(
60
*
60
*
1000
)),
(
int
)(
ms
/
(
60
*
1000
))
%
60
,
(
int
)(
ms
/
1000
)
%
60
,
(
int
)
ms
%
1000
);
}
}
else
{
av_log
(
ctx
,
AV_LOG_ERROR
,
"Invalid format '%s'
\n
"
,
fmt
);
return
AVERROR
(
EINVAL
);
}
return
0
;
}
...
...
@@ -776,7 +809,7 @@ static const struct drawtext_function {
{
"expr"
,
1
,
1
,
0
,
func_eval_expr
},
{
"e"
,
1
,
1
,
0
,
func_eval_expr
},
{
"pict_type"
,
0
,
0
,
0
,
func_pict_type
},
{
"pts"
,
0
,
0
,
0
,
func_pts
},
{
"pts"
,
0
,
2
,
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