README
- visual compositing through Canvas API
- audio mixing through WebAudio API
- encoding and streaming through FFmpeg
- client implemented in ReactJS
- server implemented in ExpressJS
Availability
Movie Masher is offered through a variety of popular platforms. The entire repository can of course be cloned or forked from Github. The core library can be installed through NPM, as can the client and server add-ons. The image in DockerHub combines these into a fully functional application for running locally. And the image in AWS Marketplace does the same within their hosted environment.
Installation
The following shell command installs the server, client, and core libraries to your NPM project,
saving them to the dependencies
array in your package.json file.
npm install @moviemasher/client-react @moviemasher/server-express --save
Alternatively, if you're wanting to build your own client and server you can just install and build off the core @moviemasher/moviemasher.js library instead.
Learn more about how the codebase is structured in the Architecture Guide.
Client Example
From our HTML file we link to both the compiled JavaScript and CSS files. To support the widest variety of workflows and tooling, the Cascading Style Sheets required to layout the client user interface are kept separate from JavaScript code:
Since most of the interface elements scroll and stretch both horizontally and
vertically, we are rendering into a node that is styled to fill the whole window. We also
apply the moviemasher
class to the node, so the additional styles in the CSS file are engaged.
We also use this opportunity to set the dimensions of the video preview in the editor through CSS variables - to their default values, in this case. There are a few ways to override these dimensions, but doing so in the CSS is best practice.
Learn more about coloring and sizing the user interface using CSS in the Style Guide.
In this example we're using the DefaultMasherProps function to populate the Masher component with preconfigured children. Alternatively, child components like Player, Browser, Timeline, and Inspector can be selectively provided, and manually configured with a selection of available child controls.
We are also setting the preview dimensions here, to their defaults for demonstration purposes. As mentioned above, overriding the defaults from JavaScript is sub-optimal - a visible resizing will occur as the CSS variables are updated - but helpful if supplying custom CSS is impractical.
Learn more about building a fully customized video editing client in the Layout Guide.
Server Example
In this example we're using the DefaultHostOptions function to create the Host constructor arguments from a JSON file with the following structure:
We are setting the preview dimensions to their default for demonstration purposes. The server will pass these to the client and the client will apply them, but only after the CSS is applied so a resize will be visible if they differ. Preview dimensions should be overridden either in the client, or better still, in the CSS. If the defaults are overidden there they should be here too, since the client does NOT pass them to the server. The rendering server uses them to optimally size previews of uploaded video and images.
We are also setting the output dimensions here, which are used as default values for both the rendering and streaming servers. Please note: they should always be an even multiple of the preview dimensions - in this case it's a multiple of four. Using different aspect ratios is actually supported, but then the preview in the client will not match the output of these servers.
Learn more about building your own customized server in the Integration Guide.
Docker Usage
A fully functional demo of the system including server rendering can easily be launched within Docker using the following command:
docker run -d -p '8570:8570' --name moviemasher moviemasher/moviemasher.js:5.0.6
Then navigate to http://localhost:8570 in your browser, supplying any username/password combination when prompted. When you're done exploring the demo it can be terminated and cleaned up with:
docker kill moviemasher
docker rm moviemasher
The dev/image/docker-compose.yml file provides some other options to explore and is used by the docker-up
and docker-down
npm scripts.
Development
The following Git command will copy the entire Git project to your local machine, complete with examples, tests, and documentation:
git clone https://github.com/moviemasher/moviemasher.js.git
The following NPM commands can be executed to install all needed dependencies, build JavaScript from the TypeScript codebase, and launch a local development server:
npm install
npm run build
npm start
You can then load Movie Masher by navigating your web browser to http://localhost:8570 and supplying any username/password combination when prompted. When you're done exploring, execute the follow command to stop the server and clean up:
npm install
npm run build
npm run stop
Feedback
If any problems arise while utilizing the Movie Masher repository, a GitHub Issue Ticket should be filed. Further support is occassionally offered to particular projects on an hourly consulting basis.
Pull requests for fixes, features, and refactorings are always appreciated, as are documentation updates. Creative help with graphics, video and the web site is also needed. Please send an email to discuss ways to contribute to the project.