Skip to content

feat(caption): add --cloud option for CapCut Cloud ASR transcription - #157

Merged
renezander030 merged 2 commits into
renezander030:masterfrom
datnt-97:feat/caption-cloud-asr
Oct 21, 2026
Merged

renezander030 merged 2 commits into
renezander030:masterfrom
datnt-97:feat/caption-cloud-asr

Conversation

@datnt-97

Copy link
Copy Markdown
Contributor

Summary

This PR adds an opt-in --cloud flag to capcut caption, allowing users to transcribe audio directly via CapCut's official cloud ASR service without requiring a local Whisper installation (such as openai-whisper or whisper-cli).

Key Highlights

  • Zero Runtime Dependencies: The Cloud ASR client (src/capcut-cloud-asr.ts) uses Node 18+ standard built-ins (fetch, node:crypto, node:fs). It includes a pure TypeScript implementation of AWS Signature Version 4 (signAwsV4) and lookup-table CRC32 calculation.
  • Word-Level Precision: Extracts word-level timings with microsecond precision, fully compatible with all existing caption styling features: --karaoke, --word-reveal, --script alignment, and --highlight-words.
  • Non-Breaking & Opt-In: Local Whisper remains the default offline engine. --cloud only runs when explicitly requested.
  • Validation & Safety: Flags conflicting options (--cloud with --words or --whisper-*) and handles timeout/retry gracefully.

Test Coverage

  • Unit tests for CRC32 calculation and AWS SigV4 canonical ASCII sorting.
  • CLI argument validation and conflict tests.
  • Live integration smoke test with sample audio proving draft tracks and word segments creation.
  • Pre-commit gate passed (1,216 tests passed, 0 failed, Biome clean).

@renezander030

Copy link
Copy Markdown
Owner

Thanks a lot for this, @datnt-97! Captions without a local Whisper install is a great idea, and the zero-dependency SigV4 signer fits the project nicely. I'm reviewing it now and will get back to you shortly.

… to ByteDance

- The cloud task was always created for 200 s, whatever the audio's length.
  It now covers the real length, read with ffprobe (the draft's material
  duration for --from-segment), and refuses before any upload when the
  length cannot be read.
- --cloud is labelled experimental and unofficial in the help, the command
  spec, the API reference, the changelog and the module header: it calls
  CapCut's private endpoints, not a published API.
- Every --cloud run names the uploaded file on stderr, and the README's
  "no upload" promise (EN and zh-CN) names the one opt-in exception.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@renezander030
renezander030 merged commit 753e353 into renezander030:master Oct 21, 2026
13 checks passed
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.

2 participants