You give the subject and a video link. The agent rewrites the script in Portuguese, uses the real screens from the reference, records it with your avatar and your voice, and delivers it ready for Telegram or YouTube.

refazvideo is a step-by-step method, with ready-made tools, for an AI agent (Claude Code or Codex) to remake a video you liked as your own explainer video in Portuguese. It is for content creators who want to explain a new subject without filming themselves. You hand over the subject and the link; the agent downloads, transcribes, writes a new script, shows a preview, and only generates the avatar after your "go ahead". To use it you need the explicavideos engine, a HeyGen account with your avatar, and a machine with a GPU.
The new video has a rewritten script and your face. From the reference, only the screens that help understanding are kept.
The speech is generated in HeyGen with your avatar, through the studio (no API), and only after your approval, because it costs credits.
Slides, demos and tables become screenshots with highlights synced to the speech. Technical terms stay in English.
The speech does not mention who made the reference, and their webcam is erased from every screenshot. If you want, a written credit appears at the end.
Twelve steps described in AGENTS.md (in Portuguese). The agent stops twice for your approval: at the storyboard and before HeyGen.
The paths in the examples are from the INEMA machine (/home/nmaldaner/...); replace them with yours.
The engine that syncs avatar and speech (v1) and builds the visuals with HyperFrames (v2).
git clone https://github.com/inematds/explicavideos
Downloads the reference and transcribes it with local Whisper large-v3.
python3 baixar_v1.py --url "<URL>" --outdir src
An account with your own avatar, logged in to a browser profile. heygen-studio.mjs uses the studio, not the API.
# Xvfb :99 for the browser Xvfb :99 -screen 0 1920x1080x24
Python with Pillow to prepare the screenshots; Node for the HeyGen studio and sending through the bot.
pip install pillowThe v1 render's Whisper runs on the GPU. If it runs out of memory, just reset the block and try again.
nvidia-smiTelegram bot (openpcbotv3) to send the video and yt-pubx to publish on YouTube.
./yt-pubx canaisYou only need step 1 and the two approvals. The agent does the rest following AGENTS.md; the commands below are the ones it runs.
You can type it straight into the chat or fill in modelos/pedido.md (in Portuguese: subject, reference, who not to mention, credit, length, delivery).
cd refazvideo && claude "Make a new video. Subject: <topic>. Reference: <URL>. Do not mention: <author>. Delivery: bot v3."
The reference goes to ~/projetos/output/explica-<id>/. The contact sheets show one numbered frame every 6 s, so you can pick the useful screens.
python3 ~/projetos/inemavox/baixar_v1.py --url "<URL>" --outdir $OUT/src --quality 1080p python3 ~/projetos/inemavox/transcrever_v1.py --in $OUT/src/video.mp4 --outdir $OUT/src --whisper-model large-v3 ferramentas/extrair_frames.sh $OUT # โ frames/sheet*.jpg
The webcam moves around during the video: each screenshot gets its own box. The linha mode extends the screen background instead of leaving a smudge.
ffmpeg -ss 453 -i $OUT/src/video.mp4 -frames:v 1 $OUT/media/raw-453.png ferramentas/preparar_print.py raw-453.png s-453.png --cobrir 1516,52,377,362 # webcam in the top corner ferramentas/preparar_print.py raw-33.png p-33.png --crop 0,0,1250,1080 --pad # narrow slide โ 2052ร1080
The script (roteiro/pt.json) is rewritten, not translated sentence by sentence, at ~150 words per minute, and ends with "inema ponto club" (the spoken call to action). The storyboard shows scene, speech and screenshots for you to approve.
ferramentas/montar_storyboard.py $OUT mapa.json # โ preview/storyboard.html
Only after your "go ahead", recorded in v1/APROVADO_HEYGEN. One submission per block; HeyGen may sit at 0% for a long while and then finish in minutes.
DISPLAY=:99 node engine/heygen-studio.mjs --titulo EXPLICA-<ID>-PT-B01-v1 \ --fala-arquivo $OUT/v1/blocos/pt-b01.txt --template TEMPLATE-AVATAR16 ~/projetos/refazvideo/ferramentas/baixa_blocos.sh $OUT # waits up to 2 h per block
v1 syncs avatar and speech. v2 places the screenshots, highlights and animations at the exact moment of the speech; the validator blocks the errors that have broken videos before.
ferramentas/validar_visual.py $OUT/roteiro/pt.json $OUT/visual/pt-b*.json # โ OK python3 engine/v2/build_block.py 1 --strict engine/v2/run_lane.sh 1 2 && python3 engine/assemble_languages.py # โ v2/final/<id>-pt.mp4
Before delivering, a sheet of frames spread across the video: someone else's face, cut-off text, overlaps. Then Telegram (720p copy, up to 49 MB) and/or YouTube.
node ferramentas/enviar_bot_v3.mjs $OUT/v2/final/<id>-pt-720p.mp4 "caption" ~/projetos/yt-pubx/yt-pubx publicar $OUT/v2/final/<id>-pt.mp4 --canal lives1 --dry-run
A 9m38s reference in English โ a 5m42s explainer in Portuguese, 11 scenes, 2 avatar blocks. Everything that was run is in exemplos/decisions-jev/.


What already exists and what comes next.