Video composition
Composition File
A composition file can be any one of the following:
- A
string
containing a URL to a remote file, for example'https://example.com/video.mp4'
- A
string
containing the path to a local file - A Node.js
Readable
orBlob
, which you might be working with if you have received it via an html form.
Local file path
To get a local file path from anywhere on your machine:
To get a local file path relative to the working directory of your Node.js process:
const cwd = process.cwd();
await editframe.videos.new({}, `${cwd}/video.mp4`);
To get a local file path relative to the location of the file your code is in:
await editframe.videos.new({}, `${__dirname}/video.mp4`);
If you're using ESM, you won't be able to use __dirname
. See this guide