aip-reference-style
Edit in a reference video's style
A reference sets three things in the user's edit: the captions, the motion graphics (titles, text overlays, stickers, cards, animated graphics, and camera treatments such as punch-ins, shakes and flashes), and the transitions between beats. Everything else follows the AI Producer skill: its settings for a new project, its rough cut, its sound effects, its research and its delivery. Its aesthetic rules hold here as over every fine cut: the reference decides how things look, move and cut, and the rules decide what the edit shows, how much of it and whether it reads, with floors the reference keeps. You copy the reference's style, never its content.
Get the reference
- A video file the user gave you is the reference as it is. Images the user gave you are a reference of stills: put them in one new directory, in the order given.
- A link to a post on Instagram, TikTok or YouTube: get it as soon as you have it, while the user's footage is still being prepared, with
start_link_downloadand the link. AI Producer fetches the video and answers with itsdownload_url; when it answersstate: "downloading"instead, call it again with the same link afterpoll_after_seconds, which joins the same download rather than starting another. Downloaddownload_urlbeforedownload_expires_atinto a new directory outsiderender-engine/, saved under the answer'sfile_name, and from then on it is a video file the user gave you; a link that expired is fetched again with the same call. Never download the post any other way, such as with a downloader you find installed. - A preset: read it with
get_reference_presetand itspreset_id. A preset the user names or describes is matched by its name and look inlist_reference_presets, which is also what you show, by name and look, a user who asks which presets there are. Download the answer'sfolder.download_urlbeforedownload_expires_at, check the file's sha256 and size against the answer, and unpack it into a new directory outsiderender-engine/. That directory is what reference_frames.py writes for the preset's video, with itscaption-kit/already made when the preset shows captions and its style pack when it was built with one, so you do not run the script for it, and a preset has no video to download or open. A link that expired is fetched again with the same call. When the call answers that no presets are published, or that the preset is unknown or withdrawn, tell the user in one sentence and ask for a reference video, a link or images instead. - A directory that holds
reference-index.jsonis a reference already read: a preset's unpacked folder, or the folder of a reference an earlier edit read. Use it as it is, as a preset's folder, without running the script on it. - A request sent from the AI Producer web page carries its reference in
get_web_assignment's answer: apresetwith itspreset_idandcatalogue_version, both passed toget_reference_preset; alink, downloaded as above; or avideoorimages, each file with adownload_url. Download each file before its link expires, reading the assignment again for fresh links, and use them as a video file or a reference of stills. Start on the reference as soon as the assignment says it is ready, without waiting for the footage, as the AI Producer skill's section on a request from the web page says. - When
start_link_downloadcannot get the post, tell the user in one sentence what its code means and what to send instead:link_private, the post is private, so ask for the video file;link_region_blocked, the post is not available from AI Producer's servers, so ask for the file;link_age_restricted, the post is age-restricted, so ask for the file;link_unavailable, the post was removed or is not available, so ask for another link or the file;link_too_long, a reference may be at most the answer'smax_duration_secondslong, so tell the user that limit and ask for a shorter clip or the file;platform_busy, the platform is turning downloads away for now, so they can send the link again later or send the file;link_unsupported, only Instagram, TikTok and YouTube links work, so ask for one of those or the file;link_download_busy, they started too many link downloads, so say when they can try again fromretry_after_seconds, and that the file works now.link_download_unavailableis a passing problem on AI Producer's side, not the post's: call it once more with the same link, and only when that answers the same ask for the file.link_download_failed, and any other refusal or error, asks for the video file. - What reading the reference and matching its captions need on the machine, ffmpeg, python3 and uv, you set up yourself without asking the user: install what is missing. A missing tool is never a reason to stop or to edit without the reference.
Start preparing the user's own footage first, as the AI Producer skill says: its upload and preparation run while you get and read the reference. Open the project's progress page as soon as project_id returns, as the AI Producer skill's progress section for this host says, before the reference is read: the reading takes a while, and the user watches the project from the start.
Read the reference
When the reference's folder holds style/style.md, the reference is already read into a style pack: read style.md and the visuals and templates it names first, and make no caption kit for it. A whole pack (its first line Pack: whole) is the entire reading: open nothing else of the folder unless style.md leaves a question open, which one contact sheet, strip or keyframe then answers. An edit's pack (Pack: edit) holds every caption treatment but only the graphics one earlier edit used, so read the contact sheets and transition pages below as well, for the graphics and transitions it does not hold. Everything below about reading the stills is otherwise for a reference without a pack.