Skip to content

@remotion/timeline-utils: Add film strip codec tests#7383

Merged
JonnyBurger merged 1 commit into
mainfrom
cursor/timeline-filmstrip-codec-tests-642e
May 14, 2026
Merged

@remotion/timeline-utils: Add film strip codec tests#7383
JonnyBurger merged 1 commit into
mainfrom
cursor/timeline-filmstrip-codec-tests-642e

Conversation

@JonnyBurger
Copy link
Copy Markdown
Member

Summary

  • Adds server-side timeline film strip coverage for extractFrames using the same slot generation helpers used by Studio.
  • Switches the waveform integration fixture from WAV to MP4 so the test exercises codec-backed audio decoding.

Validation

  • bun test src in packages/timeline-utils
  • bun run formatting in packages/timeline-utils
  • bun run lint in packages/timeline-utils
  • bun run build at repo root
  • bun run stylecheck at repo root was attempted and reached the known @remotion/lambda-go Go 1.22.2 vs Go >= 1.23.0 environment failure after timeline-utils formatting/lint passed.
Open in Web Open in Cursor 

Co-authored-by: Jonny Burger <hi@jonny.io>
@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented May 14, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
bugs Ready Ready Preview, Comment May 14, 2026 10:50am
remotion Ready Ready Preview, Comment May 14, 2026 10:50am

Request Review

@JonnyBurger JonnyBurger marked this pull request as ready for review May 14, 2026 10:56
@JonnyBurger JonnyBurger merged commit 2fb90f0 into main May 14, 2026
18 checks passed
@JonnyBurger JonnyBurger deleted the cursor/timeline-filmstrip-codec-tests-642e branch May 14, 2026 11:01
Copy link
Copy Markdown
Contributor

@pullfrog pullfrog Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adds a focused integration test for extractFrames that wires the Studio's slot-generation helpers (ensureSlots, WEBCODECS_TIMESCALE) to the server-side extraction path, and switches the waveform fixture to MP4 so the path exercises a real codec decode. Two minor observations inline — none block merge.

TL;DR — Adds the first extractFrames test against a real MP4 fixture, asserting that decoded sample timestamps line up with the timeline film strip's slot timestamps within 50 ms, and swaps the waveform integration fixture from WAV to MP4 to cover codec-backed audio decoding.

Key changes

  • Server-side film strip coverage for extractFrames — wires ensureSlots + WEBCODECS_TIMESCALE from render-frame-strip into the test so the same slot math the Studio uses is exercised end-to-end against https://remotion.media/video.mp4.
  • Switch waveform fixture from WAV to MP4load-waveform-peaks-server.test.ts now decodes an MP4 audio track instead of a WAV file, exercising the codec-backed audio path.

Summary | 2 files | 1 commit | base: maincursor/timeline-filmstrip-codec-tests-642e


Film strip slot/sample alignment

Before: No test exercised extractFrames against a real MP4 with the Studio's film-strip slot math.
After: A single integration test populates filledSlots via ensureSlots, returns those slot timestamps from timestampsInSeconds, and verifies every decoded VideoSample matches its slot within 50 ms.

The pairing relies on map insertion order: filledSlots.keys() is read once inside timestampsInSeconds and once after the iterator completes, with the test asserting extractedSamples.length === filledSlots.size and then indexing both arrays in lockstep. That's correct given JS Map iteration order, but if extractFrames ever skips a null sample (it does via continue), the length assertion catches it before the pairing loop runs — good.

extract-frames-server.test.ts


Waveform fixture moved to MP4

Before: loadWaveformPeaks tests decoded dialogue.wav.
After: Both tests decode the MP4 audio track from video.mp4.

This is a fixture swap, not an addition — WAV-format decode is no longer exercised by any test in this package. Worth confirming WAV is covered elsewhere (or that dropping it here is intentional given MP4 better represents production usage).

load-waveform-peaks-server.test.ts

Pullfrog  | Fix all ➔Fix 👍s ➔View workflow run | Using Claude Opus𝕏

timestampsInSeconds: ({track, container, durationInSeconds}) => {
expect(track).toEqual({width: 1920, height: 1080});
expect(container).toBe('MP4');
expect(durationInSeconds).toBe(10);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

toBe(10) is exact float equality on the fixture's duration. If https://remotion.media/video.mp4 is ever re-encoded and lands at 9.97 s or 10.04 s, this fails. toBeCloseTo(10, 1) would survive minor re-encodes while still catching real drift.

import {loadWaveformPeaks} from '../audio-waveform/load-waveform-peaks';

const SAMPLE_AUDIO_URL = 'https://remotion.media/dialogue.wav';
const SAMPLE_MEDIA_URL = 'https://remotion.media/video.mp4';
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This drops the only WAV-format coverage for loadWaveformPeaks in this package — the test name now says "MP4 audio track" rather than a generic "remote audio". If WAV decode is still a supported input path, consider keeping the original test and adding the MP4 case alongside it rather than replacing it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants