Open source

Ruby video SDK

Easily build video experiences into your Ruby app with the FastPix Ruby video SDK.

Trusted by product teams shipping video at scale

AAO NXTAadhanKnovorocketlaneDLICOMPractice by Numberssuperbit

What you get

Everything your Ruby app needs for video

Upload it, encode it, stream it, and see how it is doing. That is the whole job, and it all comes from one package you install like any other.

Getting video in is the easy part. Use a file you already host, or send one straight from your app. Nothing to store in between.

Your video plays on the web, on phones, on tablets and on TVs, and you never build a separate player for any of them.

Everyone watching gets a version that suits their screen, their browser and how fast their connection happens to be that day.

You can see how your video is actually doing, because the numbers come with it instead of being sold to you separately.

Install

Ruby SDK installation

Add the gem to your Gemfile and bundle, or install it directly. Pin the version while the SDK is in beta. It needs Ruby 3.2 or newer. Everything the client can do is listed in the Ruby SDK docs.

Every endpoint underneath the SDK is listed in the API reference.

Shellruby · install
# Add to your Gemfile, or install it directly
gem 'fastpixapi'

# then
bundle install

Credentials

Your access tokens

FastPix gives you two values, not one key. Pass them to a Models::Components::Security when you build the client, usually in an initializer. They travel as HTTP Basic on every request. Keep them on your server. Get them from the access-token page in your dashboard.

Generate both on the access-token page in your dashboard. A free account issues a working pair straight away.

Rubyruby · app.rb
require 'fastpixapi'

# Authenticates every request that follows, over HTTP Basic
Models = ::FastpixClient::Models
s = ::FastpixClient::Fastpixapi.new(
  security: Models::Components::Security.new(
    username: 'your-access-token',
    password: 'your-secret-key'
  )
)

Open source

The Ruby SDK on GitHub

The code is public and Apache-2.0 licensed, so you can read exactly what it sends before you depend on it. Issues, pull requests and forks are welcome here and on every other package FastPix publishes.

On-demand video

Video upload and playback

Pass a request built from keyword arguments to create a media entry from a file you already host. It comes back encoded for every screen and connection, with an ID your player uses. Video on Demand covers the rest.

Rubys.input_video.create_media
# 1. Hand FastPix a video to fetch and encode
req = Models::Components::CreateMediaRequest.new(
  inputs: [
    Models::Components::PullVideoInput.new(
      type: 'video',
      url: 'https://static.fastpix.com/fp-sample-video.mp4',
    ),
  ],
)

res = s.input_video.create_media(request: req)

# 2. Issue the ID a player streams from
s.playback.create_media_playback_id(media_id: 'your-media-id', body:
  Models::Operations::CreateMediaPlaybackIdRequestBody.new(
    access_policy: Models::Components::AccessPolicy::PUBLIC,
  ))

Ask for more up front

Captions, chapters and In-Video AI metadata are requested while the video is added.

Public or signed

Decide per playback ID whether anyone can watch, or only a viewer holding your token.

Browser uploads

Pair with a client-side upload SDK for pause, resume and retry.

Encoding

Every video gets its own encode

Most platforms run every file through the same settings. FastPix looks at each video first and encodes it to suit, so the file comes out smaller and still looks the same.

A ladder shaped to the title

Rungs are chosen per video, not copied from a preset.

2160p
1080p
720p
480p

35% smaller, same picture

Measured against H.264, HEVC and AV1 at matched quality.

standard
fastpix
35% smaller

Video Data

Playback analytics, built in

You do not need another tool to see how your video is doing. Every play is recorded automatically in Video Data, and you read the numbers with the same client you used to upload.

Rubys.metrics.list_overall_values
# Averages the quality-of-experience score over the last 24 hours
res = s.metrics.list_overall_values(
  metric_id:   Models::Operations::MetricId::QUALITY_OF_EXPERIENCE_SCORE,
  timespan:    Models::Operations::Timespan::TWENTYFOUR_COLON_HOURS,
  filter_by:   'browser_name:Chrome',
  measurement: 'avg',
)

Ten fields are yours

Tag sessions with your own account or plan ID and slice by them later.

Constants, not strings

Metric and timespan are module constants rather than loose strings.

Into your warehouse

Views come back through the same client, so they land in BI.

Which QoE metrics actually deserve an alert is covered in this working reference.

How it works

What happens after you upload a video

You get a media ID back straight away, while the file is still being processed. FastPix encodes it, stores it and prepares it for delivery, then sends a webhook the moment it is ready to play.

Your Ruby apps.input_video.create_mediapull from a source URL you hostdirect uploadsigned URL, your code pushes itlive streamlive over RTMPS or SRTFastPix runs the pipelineEncodeper-title ladder, HLS and MP4Storerenditions, thumbnails, captionsDelivermulti-CDN, 300+ locationsAny player or deviceplaybackIdpublic, or signed for gated videoWeb, iOS, Android, Flutternative SDKs, or any HLS clientSmart TVSamsung Tizen and LG webOSvideo.media.ready webhookYour app learns the media is playable without polling for it.

Independent timings for encode and first frame are on the benchmark page, which also names the workloads where FastPix does not come first.

Live streaming from your Ruby app

Live uses the same client as on-demand. Ask for a stream key, point OBS, vMix, a phone or a hardware encoder at it, and FastPix takes care of the stream and the recording.

Questions developers ask

Ruby SDK questions, answered

  • How do I upload a video in Ruby?

    Two ways. Give s.input_video.create_media a URL of a file you already host, passed as keyword arguments, and FastPix fetches it. Or open a direct upload, which returns a signed URL your own code sends the file to. The first suits a backend job, the second a user-facing form. Both hand back a media ID.

  • Do I need FFmpeg to handle video in Ruby?

    No. Most Ruby answers point at streamio-ffmpeg and a Sidekiq worker, which means the binary and the queue are both now yours. FastPix encodes on its side, so your Ruby code only makes API calls. You never install FFmpeg, size a worker box, or maintain a rendition ladder for every device you care about.

  • How do I convert a video to HLS in Ruby?

    You do not convert it yourself. s.input_video.create_media creates the media entry, FastPix produces the HLS renditions, and s.playback.create_media_playback_id hands you the ID a player streams from. There is no ffmpeg command, no segmenting step and no manifest to write. Renditions are chosen per title rather than from a fixed preset, so a screen recording and an action scene do not get the same treatment.

  • Does the SDK work with Rails and Sidekiq?

    Yes. Build the client once in an initializer and reuse it across Rails controllers, Sidekiq workers and Sinatra routes. Because calls block on Faraday, put anything slow in a background job. Each method accepts timeout_ms so one slow call cannot hold a worker open.

Documentation

Docs, references and guides

This page shows you the idea. When you need the exact parameter, the response or the error code, the docs have it, with an example you can run beside every operation.

Ruby SDK reference

Every namespace and method, with a runnable snippet per operation.

Full API reference

Every endpoint and payload behind all seven server SDKs.

Webhook reference

Each event FastPix emits, with sample payloads and the signature scheme.

Five-minute quickstart

Sign up, hit the endpoint, get a playing video back.

Choosing an SDK

Seven server SDKs, plus the client-side player, uploader and data SDKs.

Changelog

Released versions, fixes and breaking changes across the platform.