shotstack / node-demos

Shotstack Node demos - Edit videos in the cloud with Node and the Shotstack Video Editing API
http://shotstack.io
21 stars 15 forks source link
api edit-videos node nodejs video video-editing video-processing

Shotstack Node Examples

Examples

Video examples

Image examples

Smart clip examples

Template examples

Polling example

Probe example

Storage and hosting examples

Generative AI examples

Ingest and transformation examples

Installation

Install the required dependencies including the Shotstack Node SDK

npm install

Set your API key

The demos use the staging endpoint by default so use your provided staging key:

export SHOTSTACK_KEY=your_key_here

Windows users (Command Prompt):

set SHOTSTACK_KEY=your_key_here

You can get an API key via the Shotstack web site.

Run an example

The examples directory includes a number of examples demonstrating the capabilities of the Shotstack API.

Video editing (Edit API)

To run a rendering/editing example run the examples at the root of the examples folder.

To run the images video example:

node examples/images.js

To check the status of a render, run the status.js example with the render ID:

node examples/status.js 8b844085-779c-4c3a-b52f-d79deca2a960

Storing and hosting assets (Serve API)

To look up assets hosted by Shotstack run the examples in the examples/serve-api directory.

Find assets by render ID:

node examples/serve-api/renderId.js 8b844085-779c-4c3a-b52f-d79deca2a960

or

Find an asset by asset ID:

node examples/serve-api/assetId.js 3f446298-779c-8c8c-f253-900c1627b776

Generating assets using AI (Create API)

To create assets using Generative AI providers run the examples in the examples/create-api directory.

To generate an image using the Shotstack text-to-image provider:

node examples/create-api/text-to-image.js

To check the status of a create task, run the status.js example with the asset ID:

node examples/create-api/status.js 01gx3-2827k-dxmpz-x5n32-chw4oq

Ingesting and transforming/transcoding assets (Ingest API)

To ingest and transform/transcode assets run the examples in the examples/ingest-api directory.

To resize a video from 1080p to 720p resolution:

node examples/ingest-api/resize-video.js

To check the status of an ingest task, run the status.js example with the ingest ID:

node examples/ingest-api/status.js zzy7wxvy-1h1e-vt4j-kn0y-3qn7kj1hocpw