[FFmpeg-devel] [Proposal] drawvg filter
Michael Niedermayer
michael at niedermayer.cc
Wed Aug 20 23:58:26 EEST 2025
Hi Ayose
On Mon, Aug 18, 2025 at 07:22:56AM +0100, Ayose via ffmpeg-devel wrote:
> This is a proposal to add a new filter to FFmpeg: drawvg, to draw
> vector graphics on top of a video, using libcairo.
>
> This is my first contribution to FFmpeg, so I don't know if this is
> the right channel to make the proposal.
>
> I was thinking on how to write it, and I thought that a FAQ-like
> summary may be the easiest way to describe it. Apologies if this is
> more confusing than helpful.
>
>
> == What is drawvg ==
>
> drawvg is a filter to render vector graphics on top of video frames.
>
> The render is done by executing a script written in its own language,
> called VGS (Vector Graphics Script). The script consists of a series
> of commands to describe 2D graphics, which are rasterized using the
> libcairo library.
>
> VGS is not intended to be used as a general-purpose language. Since
> its scope is limited, it prioritizes being concise and easy to use.
> The syntax is heavily inspired by languages like [1]Magick Vector
> Graphics, or [2]SVG's <path>.
>
> [1] https://imagemagick.org/script/magick-vector-graphics.php
> [2] https://developer.mozilla.org/en-US/docs/Web/SVG/Reference/Element/path
>
> Some features of the syntax (like using whitespaces to separate
> arguments) are also present in languages like TCL or shell scripts.
> Many command names are taken from PostScript.
>
> Scripts can use FFmpeg expressions to describe graphics dynamically,
> so they can compute coordinates based on frame dimensions, frame
> metadata, generate random values, read pixel colors, etc.
>
> For example, to draw a blue circle in the middle of a frame:
>
> circle (w / 2) (h / 2) 100
> setcolor blue
> fill
>
> Then:
>
> $ ffplay -i example.webm -vf 'drawvg=file=blue-circle.vgs'
>
> There is a [3]website with some examples on how to integrate drawvg
> with other FFmpeg filters, and also a [4]playground to experiment with
> the capabilities of the language.
>
> [3] https://ayosec.github.io/ffmpeg-drawvg/
> [4] https://ayosec.github.io/ffmpeg-drawvg/playground/
i like the filter, i think its useful and cool
thx
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
The bravest are surely those who have the clearest vision
of what is before them, glory and danger alike, and yet
notwithstanding go out to meet it. -- Thucydides
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20250820/ade089a7/attachment.sig>
More information about the ffmpeg-devel
mailing list