跪拜 Guibai
← Back to the summary

Unlocking CapCut Pro Drafts on macOS: Call the App's Own Crypto Routines

How CapCut Pro Drafts Are Encrypted on Mac, and How I Unlocked Them Using the App's Own Code

This article is accompanied by the open-source project capcut-mcp (MIT). Full code is in the repo's mcp_server/jianying.py and jy_crypto_shim.cpp. Tested environment: macOS arm64, CapCut Pro 10.8.0 (2026-11).

Origin

I'm building a local AI editing pipeline: VLM understands video frame by frame → AI picks highlight segments → directly generate a CapCut Pro draft, so an AI agent can turn the "selection result" into an openable project file.

The last mile was stuck on CapCut drafts. Open the draft directory, all files end in .json, but the content is ciphertext:

draft_info.json        # timeline (source of truth; app rebuilds template.tmp from it on open)
draft_meta_info.json   # draft metadata (name/duration/created/modified time)
template-2.tmp         # timeline cache
Timelines/<uuid>/draft_info.json
Timelines/<uuid>/template-2.tmp

All 5 files are AES-GCM encrypted. The key is not in any config file—it's embedded in the app binary and never exported.

Previous Work (to be clear)

CapCut draft encryption isn't new; the Windows community has mature public work:

These two pieces establish the core conclusion—which I directly reuse:

The encryption entry in the app binary is a C++ class lvve::EncryptUtils, and its member functions can be called with this = NULL (the function body doesn't actually dereference this). This means you don't need to know the key, don't need to construct an object; just dlopen + dlsym and call directly—all encryption/decryption is done by the app's own code.

My work is to make this path work on macOS arm64 with CapCut Pro 10.8.0, and to make the full write path such that the written draft can be opened and saved by the app. Below only Mac details.

Step 1: Find the Home of the Key

In the app bundle:

/Applications/VideoFusion-macOS.app/Contents/Frameworks/libvideoeditor.dylib

170MB, arm64. Look for the target in the symbol table. Note that dlsym names must use the substitution form of Itanium C++ name mangling (the NSt3__1... abbreviated form, not the fully expanded form):

encrypt:
_ZN4lvve12EncryptUtils7encryptERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE
decrypt:
_ZN4lvve12EncryptUtils7decryptERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEES9_Rb
enable:
_ZN4lvve12EncryptUtils6enableEb

decrypt's signature (reconstructed from the symbol table):

std::string EncryptUtils::decrypt(const std::string& data,
                                  const std::string& param,
                                  bool& ok);

Step 2: Calling Convention (All Pitfalls)

  1. std::string return value → sret. Under the Itanium ABI, such a return value is passed via a hidden pointer in x0, so this is shifted to x1. If you assume "first argument is data", you get garbage.
  2. Must call enable before encryption: enable(NULL, true), otherwise the encrypted result cannot be decrypted.
  3. Pass "{}" as the param argument.
  4. 50-byte threshold: when plaintext is shorter than 50 bytes, decrypt throws std::out_of_range. I initially thought decryption was broken and chased it for a while, only to find the test string was too short. Real drafts are 500B+, so it doesn't affect actual use—but this pitfall will bite anyone who wants to write unit tests.

Step 3: Write a Shim, Don't Enter the Main Process

A ~100-line C++ CLI (jy_crypto_shim.cpp):

jy_crypto_shim encrypt <plain> <cipher>
jy_crypto_shim decrypt <cipher> <plain>

Internally: dlopen the dylib (via environment variable JY_DYLIB, or glob locate /Applications/*VideoFusion*.app) → call enable → call encrypt/decrypt → write to disk. Python calls it as a subprocess (120s timeout, DYLD_LIBRARY_PATH points to the dylib directory). The binary is compiled with clang++ on first use, cached in ~/.cache/video-analyzer-mcp/.

Why subprocess isolation: this dylib is 170MB, depends on a pile of stuff, and loading it into the Python main process is unpredictable; a separate process can die without crashing the main flow. aoguai used the same architecture on Windows; I copied it here.

Verification result: plaintext ≥50 bytes (ASCII and UTF-8) round-trips byte-for-byte.

Step 4: Write Drafts the App Accepts (Encryption Is Just the Ticket)

CapCut Pro (macOS) is a sandboxed app: it can only read the entire ~/Movies directory plus user-selected bookmarks. If a draft's referenced media is in /tmp, the app reports "media not supported" immediately.

Write strategy (each point verified by "app opens the draft"):

  1. Don't hand-craft the structure. Clone a real empty draft generated by the app (donor): keep the app's generated structure and attachments as-is, only replace the timeline content. Building fields from scratch will inevitably miss some hidden dependency.
  2. Re-encrypt all 5 files after replacement, and register the draft in root_meta_info.json's all_draft_store[] array.
  3. Move media into ~/Movies: if not there, automatically copy it to ~/Movies/JianYing-AI-素材/ (directory configurable).
  4. A pitfall that took me a long time to find: clip time ranges must be written as {start, duration} (in microseconds). Writing {start, end} makes the app silently fall back to each clip being 1 frame (33333µs @30fps) — you open the draft and see only a 1-second clip, with no error message.
  5. The app's watcher, on detecting a new draft, will rewrite the registry entry with its own draft_id, and re-encrypt the files on save—this is normal behavior, not your write being "broken". The timeline id stays unchanged, and content validation (tm_duration) matches the written value.

Risks and Boundaries

References