Skip to content

Convert to video formats

You can directly convert captured SVG animations to common video formats such as GIF and MP4 when outputting them.

Specify the desired extension with the -o option (or use --format). If ffmpeg is installed on the system, encoding runs automatically.

Terminal
console2svg capture -v -o demo.gif -- cmatrix -ab

cmatrix -ab

Terminal
console2svg capture -v -o demo.mp4 -- cmatrix -ab
Terminal
console2svg capture -v -o demo.webm -- cmatrix -ab

Animated SVGs cannot be converted directly to various video formats as-is. Therefore, conversion roughly follows the steps below.

  1. Extract the generated animation as one SVG per frame with save-frames.

  2. If direct conversion from svg is possible (when librsvg is enabled), simply concatenate all SVGs and pass them to ffmpeg.

  3. If direct conversion from svg is not possible, first convert them to PNG images with resvg, then pass them to ffmpeg.

This makes conversion to video formats possible in many different environments.