About this project

pyJianYingDraft is a lightweight, flexible, and easy-to-use Python tool for generating and exporting JianYing drafts, with the goal of building fully automated video editing/mashup pipelines. The project is installed via pip (Python 3.8 or 3.11 recommended), and the current version 0.3.0 has undergone large-scale updates. Its CapCut version is developed in a separate repository. Core capabilities Video and images: Supports local video/image materials and time control, overall adjustments (rotation, flip, scaling, opacity, translation), keyframes, masks, chroma keying, background fill, and blend modes (10 types including multiply, screen, overlay, etc.). Audio: Supports local audio materials and time control, fade in/out and volume, scene sounds, and timbre effects; the sound-to-song effect does not work under JianYing 5.9 but works under 10.8. Text and subtitles: Supports text styles, fonts, keyframes, animations, stroke/background/shadow, bubble and fancy text effects, automatic line wrapping, and can import SRT subtitle files, with support for time offset and style reference. Effects, filters, and transitions: Provides video segment animations, segment effects, segment filters, as well as independent effect tracks and filter tracks; effect types are named with enum classes and include parameter comments, and can be fuzzy-matched using from_name. Track management: Provides two sets of interfaces, append_track/append_tracks and insert_track/insert_tracks, and allows controlling hierarchy via over_track, under_track, or at_index. Template mode: Can load existing JianYing drafts as templates, supporting replacing materials by name, replacing materials by segment (can reselect material ranges and stretch/shrink segments), replacing text content, importing audio/video/text tracks from templates, and extracting material metadata such as stickers/bubbles/fancy text. The draft_content.json of newer JianYing versions is often not plaintext JSON, and an additional reader must be connected via fallback_loader. Batch export: Controls JianYing to export drafts via JianyingController, and resolution and frame rate can be adjusted. This feature depends on uiautomation, supports Windows only, and is only applicable to JianYing 6 and below (JianYing 7+ hides the relevant controls). Time handling: Internally uses microseconds as the unit, while also supporting string forms (such as "1.5s", "1h3m12s"), and provides convenience functions such as tim, trange, and trange_seconds. Cross-platform compatibility: Windows supports draft generation, template mode, and automatic export (subject to JianYing version limitations); Linux/MacOS supports draft generation and template mode, but not automatic export, and the generated drafts still need to be exported under the Windows version of JianYing. Notes: When JianYing opens a draft, it will try to automatically download uncached animations/effects/transitions, which may time out and show a loading failure; uncached fonts require opening the draft a second time; automatic export will bring the JianYing window to the foreground and control cursor clicks, so it is recommended to run it when idle, and it is necessary to confirm that you have export permission.