bbc/html5-video-compositor

Name: html5-video-compositor

Owner: BBC

Description: This is the BBC Research & Development UX Team's experimental shader based video composition engine for the browser. For new projects please consider using or new VideoContext library https://github.com/bbc/videocontext .

Created: 2015-06-24 12:49:42.0

Updated: 2018-05-21 13:55:38.0

Pushed: 2016-10-24 15:44:48.0

Homepage:

Size: 4143

Language: JavaScript

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

HTML5-Video-Compositor

Note: For new projects please consider using the VideoContext, a new and improved library from BBC R&D which overcomes some of the limitations of the html5-video-compositor.

A shader based video composition engine for the browser.

CTYPE html>
l>
d></head>
y>
<script type="text/javascript" src="videocompositor.js"></script>
<script type="text/javascript">
    window.onload = function () {
        var canvas = document.getElementById('player-canvas');
        var videoCompositor = new VideoCompositor(canvas);

        videoCompositor.playlist = {
            "tracks":[
                [{type:"video", sourceStart:0, start:0, duration:5, src:"video1.mp4", id:"1"},                      {type:"video", sourceStart:0, start:7.5, duration:5, src:"video2.mp4", id:"3"}],
                [                                      {type:"image", start:2.5, duration:5, src:"image.png", id:"2"}]
            ]
        };

        videoCompositor.play();
    };
</script>
<canvas id="player-canvas"></canvas>
dy>
ml>
Introduction

This is an experimental video composition engine which can play edit decision lists in the browser. Content can be dynamically appended to the EDL as it's playing to create interactive and responsive content.

In video editing terms an EDL defines the points at which to cut and assemble video sources. VideoCompositor uses a simple JSON based EDL to describe how to cut and assemble HTML5 video sources, images, and WebGL contexts, it also provides a framework for performing shader based compositing operations (i.e cross-fades, green-screen).

Limitations
Video Encoding

You will probably only see acceptable video performance if you encode videos with some kind of “fast decode” option. Using the avconv tool this can be done with the following command.

nv -i input.mp4 -tune fastdecode -strict experimental output.mp4
Documentation

The tutorial.md file in the tutorial directory of the project gives a walk-through of using the library to sequence clips and perform simple effects.

API documentation is available in the /doc directory of the project.

Notes about usage, behaviors, and other miscellaneous information is available on the Wiki.

Build

This project uses npm to manage dependencies. To build the compositor, in the root of the project run:

install

Once this has completed you can build the source files by running (this will build a commonjs2 and a vanilla js file):

run build

To auto-recompile the project on source change run (this will only rebuild the vanilla js file):

run dev

This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.