This Node.js application captures SVG animations and converts them to MP4 and GIF videos using a headless browser.
- Node.js
- FFmpeg (must be installed on your system)
-
Install FFmpeg:
# For macOS using Homebrew brew install ffmpeg -
Install Node.js dependencies:
npm install
Run the application by providing the path to your SVG file:
node index.js \
--svg path/to/your/animation.svg \
--scale 3 \
--repeat 2 \
--fps 30The application supports both local files and URLs:
- Local file:
node index.js --svg ./animations/my-animation.svg - URL:
node index.js --svg https://example.com/animation.svg
The output will be saved as {filename}_{timestamp}.mp4 and {filename}_{timestamp}.gif in the current directory.
- Capture duration: Length of the capture in milliseconds (default: 5000ms)
- Viewport size: fixed to the size of the SVG file
- FPS: Currently set to 30 frames per second