Skip to content

feat: export scenes, prefer video upscales, and frame voice wav files - #36

Closed
google-labs-stitch[bot] wants to merge 1 commit into
mainfrom
stitch/scene-export-upscales-wav-framing-jm1-3cb9044f-f36e-4a7c-a4e5-e7b75b1a3d42
Closed

google-labs-stitch[bot] wants to merge 1 commit into
mainfrom
stitch/scene-export-upscales-wav-framing-jm1-3cb9044f-f36e-4a7c-a4e5-e7b75b1a3d42

Conversation

@google-labs-stitch

Copy link
Copy Markdown
Contributor

Summary

  • Scene 1-clip shortcut & batchexecute scene export (GjQLTd + IxdSwd):
    • Reads scene clips through sceneContents (ts/scene_tiles.ts) so build 20261120.00_p0 Uc clip lists (Ji / Ci / nc) populate primary_media_id directly for 1-clip untrimmed scenes and resolve URLs via as29s.
    • Adds ts/scene_export.ts (window.__flowMcp.exportScene) and DownloadSource::ExportScene (src/download.rs) to start GjQLTd with Closure JSPB Duration clip specs, poll IxdSwd until state 3, stage MP4 bytes in a Blob URL, and index scene downloads as video/mp4.
  • Video upscale (4K / 1080p) selection & variant ID matching:
    • Adds ts/media_variants.ts so readStoreTiles and pickTileUrl select the highest-resolution ready variant (4K > 1080p > 720p) from tile.yn and report matching dimensions (such as 3840x2160 for 16:9 4K).
    • Indexes tile.yn, history, and look variant IDs on FlowAsset so match_asset and resolve_asset match any variant ID and pin target.primary_media_id when a specific variant ID is requested.
  • Custom voices (cj / lr) & host-side 24 kHz WAV framing:
    • Indexes custom voices from PROJECT_TILES cj and workflow titles from lr in readProjectStore, maps workflow voice references on look-less characters to their audio mediaId, and downloads look-less character voices as audio.
    • Flags case 11 PCM audio in ts/resolve_video_url.ts and adds src/pcm_wav.rs to prepend a 44-byte RIFF WAVE header (24000 Hz, 16-bit signed little-endian mono PCM) to raw audio bytes before validate_downloaded_file.
  • Signed URL expiry, cache TTL, bypass_cache retry, & media extension allowlist:
    • Validates X-Goog-Date + X-Goog-Expires and V2 Expires deadlines plus a 10-minute mediaInfoCache TTL, skips wasted Chrome retries on expired/403 signed URLs, and retries ResolveMediaId once with bypass_cache = true.
    • Enforces a media file extension allowlist in natural_asset_filename so opaque FIFE paths such as /rd-gg/AF1QipM.2a save as <asset_id>.wav.
  • Documentation:
    • Updates flow_assets and flow_download tool descriptions in src/mcp.rs and localized reference guides (docs/en/tools-reference.md, docs/zh-CN/tools-reference.md, docs/ja/tools-reference.md).

Verification

  • cargo xtask ci — passed (tsc --noEmit, cargo fmt --check, cargo clippy --all-targets -- -D warnings, cargo doc --no-deps, cargo deny check, header/line-limit/doc-fence gates).
  • RUSTFLAGS="-D warnings" cargo build --release --locked --bin flow-mcp — passed with zero warnings.
  • cargo xtask collect-licenses — clean.
  • Out-of-tree end-to-end verification (MCP JSON-RPC stdio + headless Chrome CDP + mock batchexecute + SQLite flow-mcp.db): 12/12 checks passed.

E2E Verification Summary


Automated PR initiated by user @byteland-app via Stitch Loop.

- Resolve 1-clip untrimmed scenes directly and export other scenes
- Prefer ready 4K and 1080p video variants and match all variant IDs
- Index custom project voices and frame 24 kHz PCM bytes into WAV files
- Skip expired signed URLs and retry media lookups without the cache
- Update MCP tool descriptions and English, Chinese, and Japanese docs

Copy link
Copy Markdown
Contributor

ts/resolve_video_url.ts marks every case-11 URL as PCM. src/pcm_wav.rs then treats MP3 frames without an ID3 tag and AAC frames as raw audio and can wrap them in a WAV header. Require a positive PCM indication and preserve compressed formats recognized by src/media_files.rs. Closing this overlapping export branch. The export and audio checks can continue in #44 with separate review for each feature.

@byteland-app
byteland-app deleted the stitch/scene-export-upscales-wav-framing-jm1-3cb9044f-f36e-4a7c-a4e5-e7b75b1a3d42 branch November 25, 2026 07:47
@google-labs-stitch

Copy link
Copy Markdown
Contributor Author

Addressed in b3fd58e on stitch/scene-export-upscales-wav-framing-jm1-3cb9044f-f36e-4a7c-a4e5-e7b75b1a3d42 (leaving #36 closed so review can continue in #44):

  • Positive PCM indication (ts/resolve_video_url.ts, src/download.rs): resolveVideoUrl no longer sets pcm_audio for every as29s case-11 URL. It sets pcm_audio: true only when wire metadata, URL parameters or extensions (audio/pcm, audio/l16, LINEAR16, .pcm), non-preset BatchGenerateAudio synthesis fields, or a registered custom VOICE / character voiceMediaId in the bound store positively indicate raw PCM audio and no compressed format is present. src/download.rs also checks is_pcm_content_type so explicit Content-Type: audio/pcm responses frame cleanly without marking generic case-11 assets as PCM.
  • Shared compressed format preservation (src/media_files.rs, src/pcm_wav.rs): Factored sniff_media_magic / is_recognized_media_magic, mime_essence, and has_non_wav_disposition_extension in src/media_files.rs and used them directly in frame_raw_pcm_file (src/pcm_wav.rs). MP3 frames without an ID3 tag, ADTS/ADIF AAC frames, all other containers recognized by src/media_files.rs, non-PCM Content-Type headers, and non-WAV Content-Disposition filenames remain untouched without a WAV header.

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