Create a useVideo addon that returns a video object that can be filtered, cropped, edited, etc.
It should extend Ctx canvas module, adding the extra methods needed for video editing:
split audio and video into separate channels/streams
can control both at same time (for playback etc)
can control each on its own (for filters, etc)
control the audio channel/stream using useAudio
filters:
cropping, zooming, panning, stretching, etc
colours/hues/sepia/etc
chromakey ("green screen", remove a colour)
overlays:
timestamps, titles, branded lower thirds, etc
can change all settings, even during playback
save the edited video to video file or video element
Keep it small & simple:
whole useVideo addon to be less then 15kb minified & gzipped
work in browser and NodeJS (with node-canvas)
no ffmpeg, only use the regular HTML5 Canvas API
very similar API and usage with useAudio addon
no other dependencies
Example:
const myVideo = useVideo({
src: 'path/to/file.mp4', // could also be a stream, File blob, <video> Element, webcam device, etc
name: 'myVideo',
container: canvasElem, // if not given, create an off-screen canvas to use instead
startOffset: 0,
endOffset: 0,
filters: {
// ...filters and their settings here
},
});
myVideo.play();
myVideo.settings({
// ...change any settings defined above
});
myVideo.toElement(videoElem => { ... })
myVideo.saveAs('filename.mp4'); // raises the browsers "save file" dialog
Notes:
Using WebM and HEVC video formats, you can have native transparent HTML5 video in all browsers as of late 2020.
Create a
useVideo
addon that returns a video object that can be filtered, cropped, edited, etc.It should extend
Ctx
canvas module, adding the extra methods needed for video editing:useAudio
Keep it small & simple:
useVideo
addon to be less then 15kb minified & gzippeduseAudio
addonExample:
Notes:
Further reading:
Other projects: