FFmpeg now support librsvg support for SVG rasterization.
I have tried the following command:
ffmpeg -i test.svg test.png
But I get the
Your ffmpeg needs to be compiled with --enable-librsvg
. If you're compiling ffmpeg then you need to install whatever package provides the librsvg header files. For example, in Arch Linux it is librsvg, and in Ubuntu it is librsvg2-dev.
Usage is similar to using raster images as inputs with the image demuxer. For example, a series of images named vector-001.svg
, vector-002.svg
, vector-003.svg
, etc:
ffmpeg -i vector-%03d.svg -vf format=yuv420p output.mp4
ffmpeg -i input.svg output.png
ffmpeg -width 600 -i input.svg output.png
-keep_ar true
is the default, so it will automatically calculate height in this example to preserve the aspect ratio.
The decoder librsvg has a few input options:
$ ffmpeg -h decoder=librsvg
[…]
-width <int> .D.V...... Custom width to render to (0 for default) (from 0 to INT_MAX) (default 0)
-height <int> .D.V...... Custom height to render to (0 for default) (from 0 to INT_MAX) (default 0)
-keep_ar <boolean> .D.V...... Keep aspect ratio with custom width/height (default true)