[FFmpeg-devel] [PATCH] allow vf_drawtext to draw framenumbers
Stefano Sabatini
stefano.sabatini-lala at poste.it
Sat Apr 9 02:31:49 CEST 2011
On date Saturday 2011-04-09 01:49:00 +0200, Jean First encoded:
> simplified the patch and added some documentation.
> ---
> doc/filters.texi | 14 ++++++++
> libavfilter/vf_drawtext.c | 74 +++++++++++++++++++++++++++++++++++++++++++--
> 2 files changed, 85 insertions(+), 3 deletions(-)
>
> diff --git a/doc/filters.texi b/doc/filters.texi
> index 5d63b5b..208170d 100644
> --- a/doc/filters.texi
> +++ b/doc/filters.texi
> @@ -378,6 +378,12 @@ This parameter is mandatory.
> @item text
> The text string to be drawn. The text must be a sequence of UTF-8
> encoded characters.
> +
> +Some special characters are defined:
> +#f Unpadded frame number, starting with 1
> +#F Four-digit padded frame number, starting with 0001
> +The # (hash / number sign) character needs to be escaped with a double ##.
> +
I thought many times about a similar feature, but I couldn't never
find a satisfying syntax for expressing the parameters. The most
requested feature is printing the frame PTS (togheter with other frame
information, e.g. frame number, pos, field order, maybe in the future
frame type and metadata).
In this case as you note '#' is problematic because it is a special
character in most shells.
Some ideas I considered:
* implement a special mode, in this mode you interpret %X codes in a
special way, in a similar way to that of strftime(). The problem is
that it would be incompatible with strftime()-sequences.
* implement a dynamic environment accessible through the text
specification, for example:
"month:${month} n:${frame_number:%04d}"
Overkill?
The problem with the #f/#F system is that it is quite limited and not
very extensible (for example what if you want to print 5 padded digits
for the frame number)?
--
FFmpeg = Faithless & Formidable Magic Problematic Emblematic Guru
More information about the ffmpeg-devel
mailing list