The render-verification gate that catches broken videos before they go live
Everybody thinks the scary part is the AI making the music. It isn't. The scary part is the moment after rendering. You have a video file that looks fine on your desktop. But the file is a lie waiting to happen. Corrupted frames hide in plain sight. Audio drifts out of sync without telling anyone. So we built a gate. That gate treats every rendered MP4 like a suspect.
The gate takes in three things. The raw MP4 from the renderer. The metadata from earlier stages. That metadata includes the expected duration, the audio source file, and the image used for the visual. And a set of pass-fail thresholds. These thresholds are the same for every release. Nothing else is allowed in. This keeps the gate deterministic. The same input always produces the same verdict.
First, it runs ffprobe on the file. It checks the video codec is H.264. The audio codec is AAC. It checks the resolution is 1920x1080. It checks the frame rate is 30 fps. It checks the duration is within 500 milliseconds of the expected duration. If any of those numbers are off, the file is rejected. This catches the lazy mistakes. The renderer forgot to re-encode an audio stream. The video track has a variable frame rate. Those things happen. The checks are resource-cheap. They finish in under a second.
Then it decodes actual frames. It pulls a frame every two seconds. It checks for black frames, for all-white frames, for blocked noise. It checks for freezing by comparing consecutive frames. It also decodes the audio track and compares it to the source WAV file. It computes the correlation. It checks for silence gaps where the original has sound. The audio check is not just about presence. It verifies the actual waveform. A rendered video can have an audio track that is silent by accident.
The sync check is the clever part. It finds the first loud transient in the audio track. Then it finds the first moment the visual changes significantly. The renderer is supposed to start the visual exactly on that beat. The gate measures the offset. If the offset is more than one frame, it fails. This catches the off-by-one mistakes. A single frame is 33 milliseconds. Human eyes may not catch that. YouTube does not care.
When every test passes, the gate writes a report. The report includes measured values, the checksums of the input files, and a timestamp. The report is stored next to the video. That report is what proves the file is clean. The next stage, the YouTube pre-publish check, reads that report before it touches the API. Without that report, the pipeline stops. It is the handoff ticket. No report, no upload.
When something fails, the gate sends a message back to the render step. The render step gets the exact test that failed and a snippet of the output. It re-renders with a slightly different code path. If it fails twice, the release is stopped and a human gets a notification. That rarely happens, but it is the safety net. The notification includes the full report. The human can see exactly what went wrong. That is enough to fix the underlying issue.
The gate runs once per video. The gate is strict on purpose. YouTube will process a corrupted file, upload it, and then fail after the fact. The video gets removed, and the channel gets a strike. Our gate exists to make sure that never happens from our side. It takes a bit of compute, but it saves the channel. You don't get a second chance with a strike.