GitHub

Video composition

Create a Composition

The Composition API is Editframe's core and most powerful offering. You can think of a composition as the blueprint of a video, consisting of an unlimited number of layers. Each element in your eventual video is represented by an individual layer in the composition. The order in which layers are added to the composition is the order in which they will be stacked in the video.

Here's an example composition creation using all arguments and options:

const composition = await editframe.videos.new(
  // options
  {
    // any solid hexadecimal, rgb, or named color
    backgroundColor: "#c400ac",


    dimensions: {
      // Height in pixels
      height: 1080,


      // Width in pixels
      width: 1920,
    },


    // Duration of final output video in seconds
    duration: 60,


    // Arbitrary metadata for your convenience
    metadata: {
      myId: "1",
    },
  },
  
  // videoFile
  "https://editframe.com/video-composition/create-composition/puppy-beach.mp4"
);

editframe.videos.new() arguments

options

The options argument is optional. All properties in options are optional.

ArgumentTypeDefaultDescription
backgroundColorstring'#000000'Any solid hexadecimal, rgb, or named color.
dimensionsobjectRequired unless instantiating a composition via a videoFile, which will calculate dimensions automatically.
dimensions.heightnumberVideo height in pixels
dimensions.widthnumberVideo width in pixels
durationnumberVideo duration in seconds. Required unless initializing a composition with a videoFile or using composition.addSequence, which will calculate the composition's duration automatically. If provided anyways, the final video will be trimmed to the specified duration
metadataobjectArbitrary metadata for your convenience. Store whatever you want. Editframe doesn't use this data.

videoFile

If you have an existing video file that you would like to use to automatically set the dimensions and duration attributes for your composition, you can provide it as the second argument. The videoFile must be a CompositionFile.

Previous
Create a video