Need private packages and team management tools?Check out npm Teams »

This package has been deprecated

Author message:

This package is a part of **node-video-lib** package now

node-video-common

0.0.3 • Public • Published

node-video-common

Build Status npm Code Climate GitHub license

Node.js common video classes

Installation

npm install node-video-common

Classes

Sample

A general video sample class

const Sample = require('node-video-common').Sample;

Properties:

  • buffer <Buffer> - Sample content
  • timestamp <Integer> - Sample timestamp
  • timescale <Integer> - Sample timescale
  • size <Integer> - Sample size
  • offset <Integer> - Sample offset in the file

Methods:

  • relativeTimestamp() - Sample timestamp in seconds
    • Return: <Number>

Audio sample

An audio sample class. Extends the general sample class

const AudioSample = require('node-video-common').AudioSample;

Video sample

A video sample class. Extends the general sample class

const VideoSample = require('node-video-common').VideoSample;

Properties:

  • compositionOffset <Integer> - Composition offset
  • keyframe <Boolean> - Keyframe flag

Track

A general track class

const Track = require('node-video-common').Track;

Properties:

  • duration <Integer> - Track duration
  • timescale <Integer> - Track timescale
  • extraData <Buffer> - Codec information content
  • samples <Array> - List of track samples

Methods:

  • relativeDuration() - Track duration in seconds
    • Return: <Number>
  • addSample(sample) - Add a sample to the samples list
    • sample <Sample> - Sample
  • createSample() - Create a new sample
    • Return: <Sample>

Audio track

An audio track class. Extends the general track class

const AudioTrack = require('node-video-common').AudioTrack;

Properties:

  • channels <Integer> - Number of audio channels
  • sampleRate <Integer> - Audio sample rate
  • sampleSize <Integer> - Audio sample size

Methods:

  • createSample() - Create a new audio sample
    • Return: <AudioSample>

Video track

A video track class. Extends the general track class

const AudioTrack = require('node-video-common').AudioTrack;

Properties:

  • width <Integer> - Video width
  • height <Integer> - Video height

Methods:

  • createSample() - Create a new video sample
    • Return: <VideoSample>

Fragment

A movie fragment class

const Fragment = require('node-video-common').Fragment;

Properties:

  • file <Integer> - File descriptor
  • timestamp <Integer> - Fragment timestamp
  • duration <Integer> - Fragment duration
  • timescale <Integer> - Fragment timescale
  • videoExtraData <Buffer> - Video codec information content
  • audioExtraData <Buffer> - Audio codec information content
  • samples <Array> - List of fragment samples

Methods:

  • relativeTimestamp() - Fragment timestamp in seconds
    • Return: <Number>
  • relativeDuration() - Fragment duration in seconds
    • Return: <Number>
  • addSample(sample) - Add a sample to the samples list
    • sample <Sample> - Sample
  • readSamples() - Read samples content

Movie

A movie class

const Movie = require('node-video-common').Movie;

Properties:

  • file <Integer> - File descriptor
  • duration <Integer> - Fragment duration
  • timescale <Integer> - Fragment timescale
  • tracks <Array> - List of movie tracks

Methods:

  • relativeDuration() - Movie duration in seconds
    • Return: <Number>
  • addTrack(track) - Add a track to the tracks list
    • track <Track> - Track
  • videoTrack() - Get the first video track
    • Return: <VideoTrack>
  • audioTrack() - Get the first audio track
    • Return: <AudioTrack>
  • samples() - Get a list of movie samples ordered by relative timestamp
    • Return: <Array>
  • fragments(fragmentDuration) - Split the movie to a list of fragments with an appropriate duration
    • fragmentDuration <Integer> - Fragment duration
    • Return: <Array>

Keywords

Install

npm i node-video-common

DownloadsWeekly Downloads

7

Version

0.0.3

License

MIT

Last publish

Collaborators

  • avatar