AppStars

A video render service in 2015

In 2015 we built a video-meme maker whose server spliced sound effects, freeze frames and captions into video with ffmpeg. The render service design still shapes our AI video work.

In 2015 we built Veme, a web app for making video memes. You picked a clip, dropped timed sound effects over it from a library of about 6,400 short sounds, added a caption, and pressed save. A few seconds later you had a new video to share, comment on and vote for.

The browser could preview that. It couldn't produce it. Browsers in 2015 had no dependable way to re-encode video, so the real work had to happen on a server, and that server had to treat video as something you edit precisely, frame by frame and sample by sample.

The problem

A sound effect laid over a clip sounds simple until you list the cases:

  • The effect starts at 3.2 seconds and has to land on that moment, not near it.
  • The person wants the video to freeze while the effect plays ("dramatic pause"), so everything after it moves later.
  • The effect runs past the end of the clip, so the audio has to get longer than the video.
  • There can be several effects, some pausing and some not, and each pause shifts the start of every later one.
  • Captions appear top and bottom for a set window, in the classic meme style.

None of this is exotic, but all of it has to be exact. A timing that drifts by a few hundred milliseconds ruins the joke.

Architecture

We split the product into two services with a documented contract between them:

  • VN.Web, a Node and Express app with EJS views, MongoDB through Mongoose, and Passport for local, Facebook, Google and Twitter sign-in. It held users, videos, memes, comments, votes and the sound library.
  • VN.Mixer, a small PHP service whose only job was to drive ffmpeg. It received a JSON description of the meme, fetched the audio, rebuilt the video and made a thumbnail.
  • Rendered files went to Azure blob storage.
browser --POST /save--> VN.Web (Node/Express, MongoDB)
                           |  JSON: video, sounds[], captions
                           v
                        VN.Mixer (PHP + ffmpeg)
                           |  split, splice, freeze, caption
                           v
                        Azure blob storage --> share page

The mixer API was written down in a plain text file in the repository, with a sample template and a sample meme in and out. That file mattered more than it looks. It meant the CPU-heavy work lived in its own process, which could be scaled, restarted or rewritten without touching the web app. The repository's docker-compose file runs web, mixer and MongoDB side by side, with the mixer in its own container.

The engineering

Audio timeline surgery

ffmpeg will happily mix two audio tracks, but mixing isn't what a meme wants. It wants the effect inserted: the original audio up to the start time, then the effect, then the rest. So for each sound the mixer split the original audio track at the start time, then joined three pieces with the concat filter and re-encoded to 44.1 kHz stereo PCM. Working in uncompressed PCM until the very end meant every split was sample-accurate and nothing was re-compressed twice.

Freeze frames and a running offset

The "pause video" option was the clever part. When a sound paused the video, the mixer grabbed one still frame at the start time, looped it for the length of the sound to make a short clip, and spliced that clip into the video at the same point. Abridged from mix.php:

if($all_audios[$j]["pauseVideo"]){
    $pauseOffset = sum_time($pauseOffset, sub_time($endTime,$startTime));
    // concat splits back to original audio
    ffmpeg_execute_cmd("-y -i ".$splitFileStart." -i ".$all_audios[$j]["audioUrl"]." -i ".$splitFileEnd." -filter_complex \"[0:0] [1:0] [2:0] concat=n=3:v=0:a=1[out]\" -map \"[out]\" -vn -acodec pcm_s16le -ar 44100 -ac 2 ".$originalAudioFilename);
    // insert still frame in video
    $img=$tmpFolder.uniqid().".jpg";
    ffmpeg_execute_cmd("-y -ss ".$startTime." -i ".$originalVideoFilename." -qscale 0 -vframes 1 ".$img);
    $videoLoop=$tmpFolder.uniqid().".wmv";
    ffmpeg_execute_cmd("-y -loop 1 -i ".$img."  -r 25 -t  ".sub_time($endTime, $startTime)." -qscale 0 ".$videoLoop);

The variable that makes it work is $pauseOffset. Every pause pushes the rest of the timeline later, so every later effect's start and end time is computed as its own time plus the pauses before it. Without that running offset, the second effect in a meme would land early by exactly the length of the first pause.

Two passes over the timeline

The mixer walked the sounds twice. The first pass only measured. It worked out how long the final audio would be, padding the original track with generated silence (aevalsrc=0) for each pause and for any effect that ran past the end of the clip. The second pass did the splicing against a track that was already long enough. Separating "how long will this be" from "cut it here" kept the splice logic simple, because it never had to grow the track halfway through an edit.

Captions with time windows

Captions used ffmpeg's drawbox and drawtext filters with enable='between(t,start,end)', a translucent black band and white Impact text, top and bottom. That's the whole meme format expressed as two filter expressions, rendered in the same pass as the rest of the video.

What we'd do differently

Looking back with today's habits, the command lines were built by joining strings. That works, but caption text a person types ends up inside a shell command and an ffmpeg filter expression. Today we pass arguments as arrays and escape filter text properly, so user input can never change the command. The intermediate WMV files were also a sign of the codecs we trusted at the time. We'd keep everything in one modern intermediate format now.

The product side had more care than many side projects of the era: HTTPS redirects and compression in the web app, and terms, privacy, cookie and DMCA pages. When people can upload and share video, takedown and moderation are part of the product, not an afterthought.

Where AI fits

There was none, and that's worth saying plainly. Veme's "intelligence" was deterministic timeline arithmetic. But the shape of it is exactly the shape of the AI video work we do now.

In 2026 we built an image-to-video pipeline where a generative model makes each scene and ffmpeg joins them. On the Knowby platform, the self-hosted pipeline that turns a video into a step-by-step guide uses ffmpeg's scene filter to find the cuts before any model looks at a frame. In both cases the model is the new part. The render service around it, with a clear contract, its own process, temporary files cleaned up and exact timing, is the part we'd already learned. The image-to-video pipeline post picks that thread up.

What it taught us

  • Put the heavy work behind a contract. A written JSON API between the web app and the renderer let each side change on its own. It's the same reason we put AI inference behind a service boundary today.
  • Measure first, then cut. The two-pass timeline is a small idea that removes a whole class of off-by-a-pause bugs.
  • Test the model, not just the screen. The web app had 30 mocha tests across seven files covering models and the API, run from a grunt task. Not many, but they covered the data the renderer depended on.
  • Treat media as data. Timings, offsets and sample rates are numbers you can reason about and test, not something you tweak until it sounds right.

Why it still matters

Most interesting products eventually need a heavy job done off the request path: a render, a transcode, a report or a model run. The way to do that hasn't changed much since 2015. Give the job its own service, describe it with a contract, make every step exact, and clean up after it. If you have a platform that needs that kind of back end, our web and SaaS platforms work is where we start.

Bring us the hard problem.

A 45-minute discovery call with the engineer who'll build it.