Skip to content

feat(contrib): add script-to-short talking-character Shorts pipeline - #1814

Open
simply-Rahul8 wants to merge 1 commit into
harry0703:mainfrom
simply-Rahul8:feat/contrib-script-to-short
Open

simply-Rahul8 wants to merge 1 commit into
harry0703:mainfrom
simply-Rahul8:feat/contrib-script-to-short

Conversation

@simply-Rahul8

Copy link
Copy Markdown

Summary

Adds contrib/script-to-short/: a self-contained, optional pipeline that takes a rough script to a finished vertical Short performed by a recurring 2D character, and publishes it. It was split out of #1806 (the music-ducking change) at the maintainer's request, so installation, assets and publishing can be reviewed on their own. This PR does not touch the application: no changes to app/, pyproject.toml, uv.lock or the Dockerfile. The only shared-file change is one .dockerignore line, plus one test.

The pipeline's open-source home is simply-Rahul8/MTP-clone-YT-Automation-pipeline. This PR was built from that repository, including its latest changes (optional Chatterbox voice, Instagram video_url route).

MoneyPrinterTurbo assembles stock footage. This pipeline does something different: one recurring character performs your script, with lip-sync, directed camera work, captions and a designed sound mix. It lives under contrib/ so it stays out of the way.

Stages and what each actually is

Stage Where What it is
Script writing skills/script-to-short/SKILL.md Instructions for an AI agent (Claude Code): expand a rough draft into a ~185-word script with an 8-word hook, a twist every 10-15 s and a looping ending. The code part is render.py --dry, which measures the spoken length against a 56-60 s target. Writing the script needs an agent; a plain script cannot do it.
Directing skills/anime-talking-short/SKILL.md, render.py A screenplay tag format (shots, voice mood, sound cues, emphasis) with directing rules. render.py parses and validates it.
Character and assets build_poses.py, my/ An importer: keys out the green background, finds the mouth on each pose from a calibrated character sheet, scores the match, and draws talking mouth shapes at each pose's scale. There is no image-generation code: users make their own art in an image generator of their choice and follow the prompt rules in the skill.
Rendering render.py, sound.py Voice, Rhubarb lip-sync, camera moves, word-by-word captions, synthesized SFX, music that ducks under speech, 1080x1920 30 fps H.264, -14 LUFS. CPU only.
Voice (optional) setup_chatterbox.py, chatterbox_voice.py, cb_synth.py Default is the free edge-tts voice. Optionally, the open-source (MIT) Chatterbox model clones one voice and makes the moods itself. Off unless the user runs setup_chatterbox.py.
Metadata and publishing skills/youtube-upload, skills/instagram-upload Title, description, tags and caption rules in the skill; small uploaders (YouTube Data API v3 with OAuth, Instagram API with Unified Login).

What is deliberately not included

  • Any character art, reference sheets, generated media or videos. The folder ships only my/sheet.example.json and a README on making a character.
  • Accounts, tokens, channel or account names. config.json, my/*, tokens and media are git-ignored by the folder's own .gitignore.
  • The Rhubarb binary and fonts: Rhubarb is downloaded at install time from its pinned v1.14.0 release and verified against SHA-256 values in install.py (taken from a direct HTTPS download of the official assets, so this pins the release against later tampering; it is not a publisher signature). Fonts are looked up on the system.
  • Any change to application code or dependencies.

Independence

Own .venv, requirements.txt and config.json; imports nothing from app/. Its dependencies (edge-tts, Pillow, numpy, imageio-ffmpeg, the Google client libraries) are installed into that venv by install.py, not into this project's. contrib/ is outside CI's compileall/ruff/coverage scopes (it passes ruff check anyway); the only CI-collected addition is test/test_script_to_short_selftest.py, which runs the pipeline's two self-tests (parser, shot planner, viseme rules, SFX synthesis; numpy and Pillow only).

Things to look at closely

  • Chatterbox setup (optional). setup_chatterbox.py creates a separate environment in ~/tts-lab (or $TTS_LAB) and installs chatterbox-tts, soundfile and setuptools<81 from PyPI without pinned versions or hashes. The first render downloads about 3 GB of model weights from Hugging Face. Nothing runs unless the user chooses to run it. If you'd rather not carry that, it can be dropped without affecting the rest.
  • Instagram video_url route. upload_url.py hands Meta a public URL to download. The skill's recipe uses a temporary Cloudflare quick tunnel serving one randomly named copy, and tells the agent to ask the user before opening any tunnel, every time, and to tear it down immediately. The default upload.py route uploads straight to Meta with no third party.
  • Publishing safety defaults. auto_publish is false in config.example.json, and the skills tell the agent to show the title, description and slot and ask before any upload. The YouTube uploader requires --channel and stops if the login is for a different channel; the Instagram uploader requires --account and stops if the token has no access to it. OAuth / dashboard tokens only, never passwords, stored under ~/.youtube-upload/ and ~/.instagram-upload/ outside the repo (the YouTube token file is mode 0600). Nothing deletes videos.
  • Voice cloning. The README says to clone only a voice you have the right to use. The default reference clip is generated from a stock edge-tts voice.

Known limits (please read)

  • Developed and tested on Windows only. The code has macOS and Linux paths (font lookup, Rhubarb download, venv layout) that have not been exercised.
  • The Instagram uploader has had far less real-world use than the YouTube one.
  • edge-tts is an unofficial Microsoft endpoint with no service guarantee.
  • Rendering takes about 5-6 minutes per minute of video on a laptop CPU (plus about 13 minutes per minute of speech with Chatterbox). Poses are still images with swapped mouths (no blinking).

Verification

  • ruff check app cli.py main.py webui test docs/skill contrib and compileall: pass.
  • test/test_script_to_short_selftest.py: 2 passed locally on Windows. In feat(audio): duck background music under narration #1806's CI the same test passed on Python 3.11, 3.13 and Windows. I did not re-run CI for this branch yet when opening the PR.
  • Earlier, on the first version of this folder: a real end-to-end render (edge-tts voice, Rhubarb lip-sync, 3 shots, boxed active-word caption and a giant emphasis word, 97 frames) and a real pose build on an existing character sheet.
  • Not re-run on this final version: a full render, the uploaders against live YouTube/Instagram, macOS/Linux, install.py and setup_chatterbox.py end to end.
  • The maintainer's own check on feat(audio): duck background music under narration #1806: the self-tests pass and a valid 1080x1920 render was produced from a synthetic character with fixture timings. Live edge-tts, Rhubarb and OAuth publishing were not exercised there either.

For the maintainer

If you would rather not carry this folder in the main repository, I can move it to a separate repository you link to. I have not started any other upstream changes.


🤖 Generated with Claude Code

Add contrib/script-to-short/, a self-contained pipeline (own venv,
requirements and config; imports nothing from app/) that turns a rough
script into a vertical Short performed by a recurring 2D character and
publishes it to YouTube and, optionally, Instagram. It is built as Claude
Code skills:

- script-to-short: script development, directing, metadata, publishing
- anime-talking-short: render.py (voice, Rhubarb lip-sync, camera,
  captions, sound mix, encode), sound.py, build_poses.py (character
  import and mouth calibration)
- youtube-upload / instagram-upload: OAuth or dashboard tokens only,
  mandatory channel or account check, no delete operations

No character art, accounts, tokens or generated media are included, and
there is no image-generation code: users make their own art. The Rhubarb
download is pinned by SHA-256. publishing is off by default
(auto_publish=false).

Optional extras: a Chatterbox voice engine (setup_chatterbox.py, isolated
env, off unless set up; edge-tts stays the default) and an Instagram
video_url route for Reels the direct upload refuses (asks the user before
opening any public URL).

Also exclude contrib/ from the Docker image and add a CI test that runs the
pipeline's two self-tests (parser, shot planner, viseme rules, SFX
synthesis), which need only numpy and Pillow.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant