Author builds two Gemini scripts: logos in frames get caught, face drift doesn't
An author who makes ad videos built two Gemini API scripts for a first-pass review. One checks speech against the script; the other compares frames to a reference of the character and looks for stray logos. On ten test cases, the model named both brands verbatim and raised no false alarms, but it missed subtle face drift. So the scripts work as a sieve for logos and lines, and a human still watches every client video.
AI-processed from Habr AI; edited by Hamidun News
When you make ads and short videos with recurring characters, most of the time goes not into generation but into review. The video model drops a word from a line, paints a real brand on a washing machine, changes the heroine's eye color. A human eye catches all of this, but slowly, and by the twentieth take attention fades. The author of a Habr post built two small scripts on the Gemini API that do the first pass in place of a human, and honestly measured where they work.
How the two scripts work
The first script handles speech. A short clip goes to Gemini whole, inline, as base64, without uploading through the Files API. The limit applies to the entire request, and base64 inflates a file by roughly a third, so the author keeps the file itself within 15 MB.
His ten-second 720p clips weighed between 4 and 12 MB. In the request, the model is asked to transcribe every line verbatim, give the timing and the speaker, and say whether the lip movement matches. It then compares the result against the script, passed as an ordered list: for each line the answer is "exact", "changed" or "missing", plus a list of extra speech.
The cost of such a request is about a thousand input tokens and three hundred output tokens.
The second script checks the face. Feeding it the whole video is awkward: the model views it as a scene, while what's needed is a comparison against a reference. So one ffmpeg command pulls six evenly spaced frames from the clip and stitches them into a 3×2 sheet.
The sheet and the character's reference images go into a single request. Order matters: references first, then the frame under test, then the text. The answer is requested strictly as JSON with closed value lists: face is "same", "drifted", "different" or "no_reference"; hands are "ok", "broken" or "not_visible"; plus a list of readable words and logos.
This way the decision is made by code, not by a person: a non-empty list of text and logos sends the frame back for a fix, "drifted" or "different" sends it to manual review, and everything else moves on.
What the measurements showed
The author ran the scripts on ten cases from his own projects where the defect had already been found by eye: eight files and two transcriptions. He used the gemini-flash-latest model, one request per case, and the answers matched on a repeat run.
The check works best on text and logos. The model named both real brands verbatim: on the washing machine and on the camera. On the same frames after the fix, the list came back empty, with no false positives. This is exactly the kind of defect that is easiest to miss by eye, since a logo in the background is small.
Faces fared worse. The model noticed obvious drift in clothing and features in a scene with two characters. But in an "image from image" chain of edits, where the crop showed faded freckles, smoother skin and darker eyes, it answered "same". And for Seedance characters built from a single text description that turned out to be different people, it said only "drifted", though "different" would have been the right call. The model's threshold for "this is a different person" is higher than the author's.
The transcription found all four lines (18 words) in both clips and flagged extra chuckles. One discrepancy remained disputed: in the author's notes the first line read "Этот" (this, masculine), while the model hears "Это" (this, neuter). Over ten seconds it is hard to say who is right, so the author re-listens to important lines himself.
Limitations and practical takeaway
The sample is small, and the author says outright that the conclusions should be read with that in mind. There was no frame with broken hands in the tests, so nothing can be said about accuracy on hands. A full inline request is limited to roughly 20 MB; longer videos will have to be uploaded through the Files API or cut. The checking model is itself generative, answers can change from run to run, and for disputed frames it is worth asking twice. The exact limit should be checked against current documentation, as it has been changed before.
For teams running many generations, the setup is reasonable. The pipeline can be wired in like this: after an image, a check against the reference; after a clip with speech, a comparison with the script; after a clip with the character, a six-frame sheet and a face check. Any "changed", "missing" or "drifted" goes to a human. The main gain is in how the work is organized: the script looks at every frame with equal attention, while a human starts missing small things by the twentieth take.
But the role of such a check is narrow: it is a sieve, not a guarantee. It filters out logos and lines reliably; on faces it gives a "something is off" signal, but not an "everything is fine" one. Anything that goes to the client should still be viewed at full size next to the reference.
- Nov 24, 2026DIY Retail Catalog Search Now Puts the Right Product First 85% of the Time, Up From 78%
- Nov 24, 2026Google gives AI Mode in Search access to Wallet so it can help you spend less
- Nov 24, 2026Claude is mass-banning paid users: 189 of 297 surveyed lost their accounts
- Nov 24, 2026Three Types of AI Bots in Your Logs: Block the Wrong One and Your Site Disappears from ChatGPT and Claude Answers
Key Questions Answered
How the two scripts work?
The first script handles speech. A short clip goes to Gemini whole, inline, as base64, without uploading through the Files API. The limit applies to the entire request, and base64 inflates a file by roughly a third, so the author keeps the file itself within 15 MB. His ten-second 720p clips weighed between 4 and 12 MB. In the request, the model is asked to transcribe every line verbatim, give the timing and the speaker, and say whether the lip movement matches.
What the measurements showed?
The author ran the scripts on ten cases from his own projects where the defect had already been found by eye: eight files and two transcriptions. He used the gemini-flash-latest model, one request per case, and the answers matched on a repeat run. The check works best on text and logos. The model named both real brands verbatim: on the washing machine and on the camera. On the same frames after the fix, the list came back empty, with no false positives.
What are the key details on Limitations and practical takeaway?
The sample is small, and the author says outright that the conclusions should be read with that in mind. There was no frame with broken hands in the tests, so nothing can be said about accuracy on hands. A full inline request is limited to roughly 20 MB; longer videos will have to be uploaded through the Files API or cut. The checking model is itself generative, answers can change from run to run, and for disputed frames it is worth asking twice.
Test Frontier LLMs & Autonomous Agents in One Workspace
Run Claude Opus 5.5, GPT-6, Gemini 3.1, and DeepSeek side-by-side in Nomad AI (nomadnet.ai) — unified model routing, deep research, and multimodal workflows under one subscription.
The AI world, distilled — once a week
Seven stories that actually mattered, hand-picked. No noise, no reposts, no press releases.
Done! Check your inbox for a confirmation.