# Finish: process video + Gemini music Trigger: the painting is accepted. Keep the PNG + scene JSON in every case. ## 1. Process video (required, every artwork) `const v=await emakiStudio.exportVideo()` (or `emakiStudio.execute({op:"video"})`) records the ACCEPTED painting: - 0.5 s of the finished painting (no caption), so thumbnails and the first frame show the result; - then the brush-by-brush process from blank paper, each layer's `intent` as the caption (write intents in the owner's language, about two short lines); - then the finished painting with a closing caption. It downloads `emaki-process.mp4` (WebM if the browser cannot record MP4) and returns `{state:"done", file, mimeType, bytes, duration, width, height, cover, srt}`. `subtitles:true` also downloads `emaki-process.srt` (captions are already burned into the video). `secondsPerLayer` is 1-10 (default 4); the whole process is at most 160 s. The studio first repaints the accepted painting frame by frame (on v5 this takes about as long as painting it from blank paper, often minutes; `observe().video.progress` runs to 0.5), then records in real time (about layers x 4 s + 2.5 s). The frames play on the visible paper meanwhile. Keep the tab visible: a hidden tab stops the recording. For tools with short timeouts: `emakiStudio.execute({op:"video",wait:false})`, then poll `emakiStudio.observe({includeImage:false}).video` until `state` is `done` or `failed` (read `error`). The studio is busy while recording; preview/accept wait. Deliver the downloaded file to the owner. If your tool cannot collect downloads, say so plainly; do not claim a video was delivered. ## 2. Ask about music (required, every artwork) In the completion reply, in the owner's language, ask whether to make matching background music with Gemini and add it to the video. Example: "Would you like me to make matching background music with Gemini and add it to this video? I'll confirm the method and any cost before starting." / 「この絵に合うBGMをGeminiで作って、動画に付けますか? 利用手段と料金は実行前に確認します。」 - Ask for every artwork, test paintings included. Ask even if you cannot or may not generate music yourself. - Do not make music until the owner explicitly says yes in the conversation. Silence is not consent. - The silent video is delivered first, without waiting for the answer. ## 3. After a yes 1. Use the Gemini website through its browser UI in the owner's signed-in account, within their existing subscription only. No Gemini API or API key, paid credits, upgrade or other music provider. Check that the UI offers music under the current plan and quota, and what data leaves the browser. If it is unavailable, out of quota or asks for payment, stop and explain; offer a prompt the owner can run, or use their own audio. Never claim generation succeeded when it did not. 2. Ask for instrumental music matching the subject and mood, at least as long as `v.duration`. Keep the prompt, model/provider name and usage terms for the note. 3. Combine locally, keeping the silent video. For MP4: `ffmpeg -i emaki-process.mp4 -stream_loop -1 -i music.mp3 -map 0:v -map 1:a -c:v copy -c:a aac -af "afade=t=out:st=:d=1.5" -shortest emaki-process-bgm.mp4` For WebM input, write `.webm` with `-c:a libopus`. Do not change the video speed or the music pitch. 4. Play the result: check audio, timing, the first frame (finished painting) and the last frame, then deliver it. Never upload, share or publish externally unless the owner separately asks. Emaki records the silent video itself; it has no built-in Gemini integration.