Build Video Applications with Ruby

The Shotstack Ruby SDK brings elegant video editing capabilities to your Ruby applications and Rails projects. Built with Ruby conventions in mind, the SDK makes video processing feel natural and intuitive for Ruby developers.

This open-source Ruby gem connects directly to Shotstack's managed video editing API, removing the complexity of video processing infrastructure while providing access to professional-grade editing features.

Leverage all of Shotstack's video editing capabilities including trimming, concatenation, transitions, filters, effects, and multimedia asset merging—all with clean, idiomatic Ruby code.

Getting Started

Installation

The Shotstack Ruby video editing SDK is available as a gem via RubyGems or can be downloaded directly from GitHub.

gem install shotstack

Usage

1. Require the library

Require the Shotstack SDK and necessary classes.

require 'shotstack'
2. Configure the API client

Set the base URL and API key for your environment.

Shotstack.configure do |config|
  config.host = 'https://api.shotstack.io/stage'
  config.api_key['DeveloperKey'] = 'YOUR_API_KEY'
end
3. Create a video asset

Define the video asset with source and trimming parameters.

video_asset = Shotstack::VideoAsset.new(
  src: 'https://shotstack-assets.s3.amazonaws.com/footage/skater.mp4',
  trim: 3
)
4. Build the edit structure

Create clips, tracks, timeline and output settings.

clip = Shotstack::Clip.new(
  asset: video_asset,
  start: 0,
  length: 8
)

track = Shotstack::Track.new(clips: [clip])
timeline = Shotstack::Timeline.new(tracks: [track])

output = Shotstack::Output.new(
  format: 'mp4',
  resolution: 'sd'
)

edit = Shotstack::Edit.new(
  timeline: timeline,
  output: output
)
5. Submit the edit

Send the edit to the API for rendering.

api_instance = Shotstack::EditApi.new

begin
  response = api_instance.post_render(edit)
  render_id = response.response.id
  puts "Render ID: #{render_id}"
rescue Shotstack::ApiError => e
  puts "Exception: #{e}"
end

Output

The Ruby code above constructs a JSON edit specification, submits it to the Shotstack API, and produces the trimmed video output.

EXPLORE

Check our Ruby video editing examples and demos on GitHub

DISCOVER

See what the Shotstack API and Ruby can do

More to do