svgpython-imaging-librarypycairoffmpeg-pythoncircos

Converting sequence of SVG images (which contain Emojis) to a MPEG video


I googled and even asked chatGPT but I'm unable to find a solution and hope to get some guidance here.

First I've to mention that I'm not a programmer but rather a beginner.

Following a short description of what I'm trying to achive and what I've done so far.

  1. I gather data and create a circular visualization using Circos which produces SVG and PNG images.

    (unfortunately the PNG doesn't give me the option of searching for text an make replaecments), nevertheless I can use them to sucessfuly produce a MPEG movie using FFmpeg. Therefore I need to use the SVG output to apply the desired changes.

  2. So I tried to use CairoSVG to render the SVG file to a PNG image but it does not render emojis by default because the are not part of the SVG specification and CairoSVG only supports features defined in the SVG specification. The Emojis are stored as Unicode characters and are not natively supported in SVG

  3. Next I tried to use PIL (Python Imaging Library) as it provides support for Unicode characters, including emojis, when converting images to and from various formats. Unfortunately PIL does not have native support for converting SVG files to PNG and it seems that PIL is primarily designed for creating and manipulating images in a variety of formats, but does not have built-in support for reading or converting SVG files.

So now my questions are:

  1. Would FFmpeg give me the desired results, if I compile it using the --enable- librsvg option so it can convert a sequence of SVG images to a video but i'm not sure if it supports emojis rendered correctly and want to spare me the hassle as I'm pretty sure to struggle compiling it on my Mac running Ventura?

  2. Are the maybe other ways or posibilities to solve that problem?

Many thanks in advance for your help or any hint :-)

Have all a nice weekend and take care

Regards, Deekee

NB: an example of the circular visualization can be found here animated graph and the static version annotated graph


Solution

  • Problem solved, I used the html2image Python module which converts the SVG (including embedded Emoji's) nicely to a PNG image an then use those images to create a MPG4 video using FFmpeg.