Encode on the client
Rendering and encoding run in the user's browser with WebCodecs, so the server never renders video and export cost doesn't grow with users.
Case study · Open source
A browser-based studio for creating social-ready Quran recitation videos: pick a reciter and ayahs, style the frame, and export an MP4 encoded right in the browser.
01Problem
Creators who share Quran recitations on Instagram, TikTok, YouTube and WhatsApp Status need the right audio, synced ayah text, translations, the right aspect ratio and an MP4 those apps accept. Trteel turns that into a guided flow in the browser.
02My role
I built the app — UI, playback logic, rendering and the export pipeline — and maintain it; v0.2.0 (Oct 2026) was a hardening and cleanup release.
03How it works
The browser draws every frame on a canvas from the selected ayahs and settings, mixes the audio with optional effects, encodes H.264/AAC with WebCodecs and packs an MP4 with mp4-muxer. For the Instagram, TikTok and WhatsApp presets the file is re-encoded server-side with FFmpeg (H.264 Main 4.0, yuv420p, faststart) so those apps accept it; if that step fails, the browser keeps its own MP4.
04Key technical decisions
Rendering and encoding run in the user's browser with WebCodecs, so the server never renders video and export cost doesn't grow with users.
The server step exists only to make files that social apps accept, and it is optional: on failure or timeout the browser's MP4 is still delivered.
Story, Post, TikTok, YouTube and WhatsApp presets plus a Simple mode give a clean default path, with Advanced mode for full control.
05Hard parts solved
FFmpeg now runs through execFile with argument lists — no shell — and fps / bitrate are validated, returning 400 on bad values.
Download headers are built safely, so Arabic file names work and header injection is not possible.
Exports moved from H.264 level 3.0 to 4.0, which 1080p video needs.
An upgrade to Next.js 16.4.3 took npm audit from 7 findings to 0, and lint from 48 errors to 0.
06Outcome
Trteel is deployed on Vercel. v0.2.0 passes lint, type-check and production build in CI, and the export routes were tested with the real FFmpeg, including Arabic file names.
Measured on the 0.1.0 code and on the 0.2.0 release branch.
Source: git history of the main branch (Oct 31, 2026).
07Stack & links
© 2026 Abd Alftah Salem · Back to portfolio