gridvid
Gridvid is a Rust wrapper library for rendering MP4 videos from 2D vectors using a minimal interface.
The outer vector translates to the X-axis and the inner vectors translate to the Y-axis.
Basic Usage
use Encoder;
// Create a 2D Vec of any element type, bool in this example
let mut grid: = vec!;
// fn to map grid element reference to RGB tuple `(u8, u8, u8)`
let convert = ;
// Initialize video encoder
let mut video = new.build?;
// Update the grid as desired, adding a new frame for each grid state
for i in 0..grid.len
// Write encoded video to output file
video.close?;
This example renders and exports the following:
Options Summary
use ;
let mut video = new
.fps // Set video frame rate to 20 fps
// Video Frame Scaling options
.scale // Upscale by a factor of 16
.scale // Scale to 720x480, keeping aspect ratio
.scale // Stretch to 720x480, ignoring aspect ratio
// Gridline options
.gridlines // Set gridline color to white
.gridlines // Hide gridlines
.build?;
Encoder Defaults:
- Video frame rate is 4 fps
- Black gridlines:
Gridlines(0,0,0) - Video is scaled to 720x720:
MaxSize(720, 720)
Documentation
Gallery
Sample output from examples/game_of_life.rs
License
Licensed under the MIT license as of version 0.2.0.