Feature description
buildVideoFilter in src/lib/ffmpeg.ts is the most critical function in the entire application. Every export runs through it — it builds the complete FFmpeg filter chain combining trim, rotate, speed, framing, stabilization, and color adjustments. Despite this, the function is currently private (not exported) and has zero test coverage.
The existing test infrastructure (Vitest) is already set up and working — buildAudioFilter already has a solid test suite in src/lib/tests/ffmpeg.test.ts. buildVideoFilter should have the same treatment.
Problem this solves
Without tests on buildVideoFilter:
- A wrong filter order silently produces broken or corrupted video output with no warning
- Edge case combinations (e.g. trim + speed + rotate all at once) are completely unverified
- Any future changes to the filter chain have no safety net — regressions go undetected
- FFmpeg filter order matters significantly — wrong order produces different and incorrect results
Proposed solution
- Export
buildVideoFilter from src/lib/ffmpeg.ts by adding the export keyword
- Create
src/lib/tests/videoFilter.test.ts with test cases covering:
- Trim only (trimStart > 0, trimEnd set, both)
- Each rotation value (90, 180, 270, 0)
- Speed changes (slow, fast, normal)
- Framing modes (fit vs crop)
- Brightness, contrast, saturation adjustments
- Stabilization flag
- Combinations of multiple settings together
- Edge cases (speed=1 should not add setpts filter, rotation=0 should add no filter)
Alternatives considered
Integration testing via full export — not practical since FFmpeg WASM cannot run in a Node/Vitest environment. Unit testing the filter string output directly is the correct approach, same as how buildAudioFilter is already tested.
Additional context
buildAudioFilter is already exported and has 7 well-written tests in src/lib/tests/ffmpeg.test.ts — this issue follows the exact same pattern for the video side. The test infrastructure requires no setup changes.
Feature description
buildVideoFilterinsrc/lib/ffmpeg.tsis the most critical function in the entire application. Every export runs through it — it builds the complete FFmpeg filter chain combining trim, rotate, speed, framing, stabilization, and color adjustments. Despite this, the function is currently private (not exported) and has zero test coverage.The existing test infrastructure (Vitest) is already set up and working —
buildAudioFilteralready has a solid test suite insrc/lib/tests/ffmpeg.test.ts.buildVideoFiltershould have the same treatment.Problem this solves
Without tests on
buildVideoFilter:Proposed solution
buildVideoFilterfromsrc/lib/ffmpeg.tsby adding theexportkeywordsrc/lib/tests/videoFilter.test.tswith test cases covering:Alternatives considered
Integration testing via full export — not practical since FFmpeg WASM cannot run in a Node/Vitest environment. Unit testing the filter string output directly is the correct approach, same as how
buildAudioFilteris already tested.Additional context
buildAudioFilteris already exported and has 7 well-written tests insrc/lib/tests/ffmpeg.test.ts— this issue follows the exact same pattern for the video side. The test infrastructure requires no setup changes.