Ffmpeg support for svg rasterization

后端 未结 1 1516
鱼传尺愫
鱼传尺愫 2021-01-25 18:17

FFmpeg now support librsvg support for SVG rasterization.

I have tried the following command:

ffmpeg -i test.svg test.png

But I get the

相关标签:
1条回答
  • 2021-01-25 18:48

    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.

    Series of images

    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
    

    Single image

    ffmpeg -i input.svg output.png
    

    With custom size:

    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.

    Decoder specific options

    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)
    
    0 讨论(0)
提交回复
热议问题