Skip to main content

How it’s built

StreamRoll chains two Runway API calls: one to generate a title card, one to animate it into video. The whole thing is about 20 lines of TypeScript. Here’s exactly how it works so you can build something similar.

  1. Install the SDK

    Official SDKs for Node.js, Python and more. Read the SDK docs or the SDK on GitHub.

    bash
    npm install @runwayml/sdk
  2. Generate the title card

    gen4_image turns a text prompt into a sharp 1920×1080 title card. Cost: 8 credits.

    typescript
    import RunwayML from "@runwayml/sdk";
    
    const runway = new RunwayML({ apiKey: process.env.RUNWAYML_API_SECRET });
    
    // Step 1: Generate a 1080p logo image
    const imageTask = await runway.textToImage
      .create({
        model: "gen4_image",
        promptText: `Streaming service logo for "JOEFLIX",
          cinematic style, deep navy and gold, film grain,
          professional logo design, centered composition`,
        ratio: "1920:1080",
      })
      .waitForTaskOutput();
    
    const logoUrl = imageTask.output[0];
    // → https://runway-cdn.com/...
  3. Animate it into video

    Feed the image URL straight into gen4_turbo image-to-video. The two calls chain together: the output of step 1 is the input to step 2. Cost: 25 credits for 5 seconds.

    typescript
    // Step 2: Animate the logo into a 5-second intro
    const videoTask = await runway.imageToVideo
      .create({
        model: "gen4_turbo",
        promptImage: logoUrl,
        promptText: `The JOEFLIX logo animates with a slow cinematic
          push-in, golden particles drift upward, subtle lens
          flare blooms, atmospheric fog`,
        ratio: "1280:720",
        duration: 5,
      })
      .waitForTaskOutput();
    
    const videoUrl = videoTask.output[0];
    // → download and drop into Plex as a pre-roll ✓

    The video is silent, so add music

    Runway generates video only. For a full cinematic intro, generate royalty-free music with Udio or Suno, then merge it in with ffmpeg:

    bash
    ffmpeg -i intro.mp4 -i music.mp3 -shortest -c:v copy -map 0:v -map 1:a output.mp4
  4. Add it to your media server

    Download the .mp4 and add it to Plex, Jellyfin or Emby as a pre-roll. Here’s where to find the setting.

    Plex

    Settings → Extras → Cinema Trailers → enable “Cinema Trailers” pre-roll, then place the .mp4 in your designated Extras folder.

    Plex guide to Cinema Trailers and Extras

    Jellyfin

    Jellyfin has no built-in pre-roll setting. Install an intros plugin from Dashboard → Plugins → Catalog, then point it at your .mp4 in the plugin’s settings. It plays before every movie.

    Jellyfin plugin docs

    Emby

    Server Settings → Cinema Mode → Pre-Roll Videos → add the .mp4 file path. Toggle Cinema Mode on for playback sessions.

    Emby pre-roll community thread

    Pro tip: generate 3–5 variants in different styles and point your server at the whole folder. Plex, Emby and the Jellyfin intro plugins can rotate them at random, so you get a different intro every session.

Get a Runway API key

Browse the full API referenceJoin Runway’s developer Discord

Built by Joe Karlsson, a developer advocate building tools that make APIs click. Find Joe on X, GitHub and LinkedIn.