Socket
Socket
Sign inDemoInstall

vidar

Package Overview
Dependencies
1
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    vidar

An extendable video-editing framework for the browser and Node


Version published
Maintainers
1
Created

Changelog

Source

[0.8.0] - 2021-04-11

Added

  • Type declarations.
  • duration option for Movie#record, to only record a subsection of the movie.
  • 'movie.recordended' event. This does not affect the behavior of 'movie.ended'.
  • Grayscale effect.
  • etro.event.unsubscribe to remove event listeners.
  • Image and video layers' destX, destY, destWidth and destHeight.
    • Previously imageX, imageY, imageWidth, imageHeight, ...
    • Allows for rotating these layers without cropping out parts.

Changed

  • All constructor arguments are now supplied through an options object.
  • Now Movie#record also accepts its arguments through an options object.
  • Keyframes are now entered as new etro.KeyFrame([time1, val1, interp], [time2, val2])
  • Rename clip* to source* for image layers.
    • clipX is now sourceX, etc.
  • Rename image to source for image layers.
  • Rename source to audioNode and media to source for audio and video layers.
    • And mediaStartTime to sourceStartTime
  • For image and video layers, width now defaults to destWidth, which defaults to sourceWidth, which defaults to the width of the image or video.
  • The movie.audiodestinationupdate event is now published on the movie instead of each layer.
  • The movie's audioContext option is now actx (to match the property).

Deprecated

  • etro.mapPixels - use etro.effect.Shader instead, because it supports hardware-acceleration
  • audioContext option for Movie - use actx instead.

Removed

  • Video files for examples (can now be downloaded with npm run assets).

Fixed

  • Browsers that do not implement AudioContext are now supported.
  • Movie not rendering with no layers.
  • Issues with modifying Movie#layers and Movie#effects.
  • Layers no longer error on 'movie.seek' event.
  • Property filters' this is now set to the owner of the property.
  • Visual layers' width and height property filters now default to the movie's width and height.
  • Visual layers' border property not being processed correctly.
  • Effects' and layers' attach() and detach() methods not being called when replaced by another effect or layer.

Readme

Source

Vidar

Build Status

Version 0.8 is out! Check out this guide for migrating.

Vidar is a JavaScript framework for programmatically editing videos. Similar to GUI-based video-editing software, it lets you layer media and other content on a timeline. Audio, image, video and other tracks are supported, along with powerful video effectts for existing tracks. Being very flexible and extendable, you can choose to only use the core components or define your own.

Features

  • Composite video and audio layers
  • Use built-in hardware accelerated effects
  • Write your own effects in JavaScript and GLSL
  • Manipulate audio with the web audio API
  • Define layer and effect properties as keyframes and functions
  • Export to a blob or file

Installation

npm i vidar

Usage

You can use CommonJS syntax:

import vd from 'vidar'

Or include it as a global vd:

<script src="node_modules/vidar/dist/vidar-iife.js"></script>

Let's look at an example:

var movie = new vd.Movie({ canvas: outputCanvas })
var layer = new vd.layer.Video({ startTime: 0, source: videoElement })  // the layer starts at 0s
movie.addLayer(layer)
movie.record({ frameRate: 24 })  // or just `play` if you don't need to save it
    .then(blob => ...)

This renders videoElement to a blob at 24 fps. This blob can then be downloaded as a video file.

Effects can transform the output of a layer or movie:

var layer = new vd.layer.Video({ startTime: 0, source: videoElement })
    .addEffect(new vd.effect.Brightness({ brightness: +100) }))

Using in Node

To use Vidar in Node, use the wrapper:

npm i vidar-node
var vidarNode = require('vidar-node')

vidarNode(() => {
  // You can access inputs as html elements and pass them to Vidar as usual.
  var image = document.getElementById('input1') // <img> element

  // Use vidar normally ...

  movie
    .exportRaw()
    .then(window.done)
// Tell Vidar Node what inputs to load with { id: path }
}, { input1: 'image.png' }, 'output.mp4')

vidarNode() takes an optional Puppeteer page argument, so you can run multiple Vidar scripts on the same movie (useful for servers). See the docs.

Running the Examples

First, download the assets for the examples:

npm run assets

Then, start the development server (only used for convience while developing; you don't need a server to use Vidar):

npm start

Now you can open any example (such as http://127.0.0.1:8080/examples/introduction/hello-world1.html).

TypeScript

Vidar is written in TypeScript, so it should work out of the box with TypeScript projects. However, it is also compatible with projects that do not use TypeScript.

Further Reading

Contributing

See the contributing guide

License

Distributed under GNU General Public License v3. See LICENSE for more information.

Keywords

FAQs

Last updated on 12 Apr 2021

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc