// struct Frame
let frame = createFrame();
// struct Context
let encoder = createEncoder();
// struct Context
let packet = encoder.encode(frame);
dcv-color-primitives
Frame
strategy 1
strategy 2 (seems better)
let data = canvas.data_i444();
// Frame::new(width: usize, height: usize, chroma_sampling: ChromaSampling)
let mut f: Frame<u8> = Frame::new(450, 450, ChromaSampling::Cs444);
// Plane.copy_from_raw_u8(&mut self, source: &[u8], source_stride: usize, source_bytewidth: usize)
f.planes[0].copy_from_raw_u8(data[0].as_slice(), 450, 1);
f.planes[1].copy_from_raw_u8(data[1].as_slice(), 450 / 2, 1);
f.planes[2].copy_from_raw_u8(data[2].as_slice(), 450 / 2, 1);
panics with:
panicked at 'assertion failed: cfg.xorigin as isize + rect.x + rect.width as isize <= cfg.stride as isize', /home/urhengulas/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libstd/macros.rs:13:23
(from https://github.com/xiph/rav1e/blob/master/src/tiling/plane_region.rs#L153)
rav1e::tiling::plane_region::Rect
next tries
This library abstracts the complex command-line usage of ffmpeg into a fluent, easy to use node.js module.