Master Commercial Concat Engine

Overview

The Master Concat Engine is Paylayer's server-side FFmpeg video processing pipeline. It solves the industry-wide challenge of stream fragmentation when stitching AI videos generated from separate models (e.g. Google Veo 3.1 B-roll intro scenes + ElevenLabs vocal avatar speeches).

Technical Pipeline & Stream Normalization

  • Endpoint: `POST /api/studio-ai/concat-videos`
  • Stream Normalization: Normalizes mismatched frame rates, sample rates (44.1kHz vs 48kHz), and resolution dimensions across input MP4 streams.
  • Null Audio Stream Injection: Automatically injects synthetic stereo silence (`anullsrc`) into silent B-roll videos prior to concatenation to prevent FFmpeg sync crashes or black screen bugs.
  • Complex Filter Concat: Executes FFmpeg `concat=n=2:v=1:a=1` filter to stitch 5-second cinematic intro scenes with 8-second avatar presentations into a seamless 13-second Master Commercial MP4.
  • Asset Storage: Uploads the unified MP4 to UploadThing edge storage and indexes the media entry in Prisma DB `MediaGeneration`.