pyJianYingDraft: generating JianYing drafts from Python, and the version boundary where it stops working
A lightweight, flexible and easy-to-use Python tool for generating and exporting Jianying (CapCut's Chinese counterpart) draft files, for building fully automated video editing/remixing pipelines. A CapCut version is being developed at https://github.com/GuanYixuan/pyCapCut.
At a glance
- What is it?
- This library writes JianYing draft files so a pipeline can assemble video without a human in the editor. The interesting part is the support table: automatic export dies at version 7, and template loading needs a fallback_loader. Here is what each of those means in practice.
- Who is it for?
- Use it when the edit is scripted and the final export can happen on a Windows machine, which is the shape its export path actually supports. Before you build a pipeline on it, pin a JianYing version you have tested, check whether your templates are plaintext readable on that version, and keep the Windows export step in your plan rather than assuming the library finishes the job.
- Can I use it commercially?
- Yes. Apache-2.0 is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
- Is it still maintained?
- Yes. The repository last received commits 32 days ago.
- What is it written in?
- Mainly Python, according to GitHub's language statistics.
Answers come from the project's GitHub data, last synced on November 15, 2026, and from our analysis. They are not legal advice.
Star history
- GuanYixuan/pyJianYingDraft4,906 ★ · +485
| Repository | 2026-09-23 | 2026-11-15 |
|---|---|---|
| GuanYixuan/pyJianYingDraft | 4.4k | 4.9k |
485 Stars in the last 53 days, measured from the daily GitHub snapshot. Compare with other projects
Editorial analysis
Automatic export needs JianYing 6 or older
Three rows in the batch export table share one condition: controlling which draft JianYing opens, exporting a draft to a chosen location, and adjusting export resolution and frame rate. All three are marked as working on 5.9 and on 6.8, which the table labels as JianYing 6 and below. All three are marked as not working on 10.8, which the table labels as JianYing 7 and above. The note above the table gives the reason: automatic export depends on visible controls in the older JianYing, and newer versions no longer satisfy that premise. That is a UI dependency, not a file format dependency, and it explains why the dependency list includes uiautomation, a Windows-only automation library pinned at version 2 or above. The consequence for a pipeline is blunt: if your target machines run JianYing 7 or later, generation still works but the export leg has to happen somewhere else.
Linux and macOS can build drafts but not finish them
The cross platform section splits the feature set by operating system. On Windows, everything is supported, including draft generation, template mode and automatic export, though individual features may still be limited by the JianYing version itself. On Linux and macOS, draft generation and template mode are supported and automatic export is not. The second half of that sentence is the one to plan around: drafts generated on Linux or macOS still have to be exported in the Windows version of JianYing. So a Linux build host is fine as a component of a pipeline, and it is not a replacement for a Windows workstation at the last step. The setup metadata mirrors this, since install_requires carries the uiautomation pin behind sys_platform == 'win32' so that Linux and macOS installs do not attempt to install a Windows automation library.
pip install skips the demo you need to run first
The library installs from PyPI:
pip install pyJianYingDraftThe documentation notes that the installed package does not include the demo, and it recommends the Python version used during development, 3.8 or 3.11, which matches python_requires being set to >=3.8. The classifier set is short: Python 3, Beta development status, and the Multimedia Video topic. Runtime dependencies are three: pymediainfo, imageio and uiautomation, the last one restricted to Windows installs. Package data carries assets/*.json inside the pyJianYingDraft package directory, so those files ship with the wheel rather than living in the repository alone. The example script demo.py stays in the repository root and is the fastest sanity check: it creates a draft named demo with audio and video files and one line of text, plus audio fade in, a video entrance animation, a transition and a text bubble, and you find it by opening JianYing and looking for the new draft, refreshing the list by entering and leaving another draft or restarting the editor if it does not appear.
draft_content.json is no longer readable plaintext
Template mode is the feature that keeps complex elements such as text effects and compound segments intact, by loading an existing draft as a template and either importing from it or replacing parts of it. The catch on newer JianYing is stated in a warning above the template table: draft_content.json in the new version is often not a directly readable plaintext JSON file. Because of that, loading a template there usually needs an extra reader passed through DraftFolder(..., fallback_loader=...). The constructor accepts one:
draft_folder = draft.DraftFolder(
"<剪映草稿文件夹>",
fallback_loader=my_local_loader,
)Every template capability inherits that dependency. Loading draft_content.json, replacing media by name, replacing text content, importing whole tracks from a template, and extracting stickers, bubbles or decorative text metadata are all marked as depending on the template being readable. Plaintext templates work by default, and the documentation invites feedback when template content goes missing, which is the right posture for a reader path that depends on formats the editor may change.
Imported template tracks refuse new segments
To preserve the messy parts of a template, imported tracks are deliberately kept separate from tracks the library creates itself. The documented consequence is a hard restriction: apart from the replacement functions, you cannot add segments, transitions, fades or effects to an imported track. What you can still do is create brand new tracks and populate them the way you would outside template mode, so template content arrives intact and new work happens beside it. Only audio, video and text tracks can be imported this way today, and the scope is expected to widen. There is also a known bug worth planning around: replacing a segment that has a combined entrance and exit animation does not refresh the animation timing automatically, so an animated segment that changes length can play with stale timing. The three replacement entry points are replace_material_by_name, which swaps the media file itself and therefore affects every segment referencing it, replace_material_by_seg for one specific segment, and replace_text for a text segment's content while keeping its formatting.
Replacing a segment's material changes its length
Replace by segment is the one that touches timing. It swaps the media file behind a single segment, lets you pick a new source range, and stretches or shrinks the segment to fit the new duration. Segments have no names, so you locate them by index, on a track you select by type and index or by name:
from pyJianYingDraft import trange_seconds, ShrinkMode, ExtendMode
audio_track = script.get_imported_track(
draft.TrackType.audio,
index=0
)When handle_shrink and handle_extend are left unset, the defaults are asymmetric: if the new media is shorter, the segment end moves earlier so the segment matches the new length; if it is longer, the material range is trimmed and the segment keeps its original length. The full set of behaviours lives in the ShrinkMode and ExtendMode enumerations. Replace by name behaves the opposite way and is called out as especially suitable for images, since no time range changes and almost no compatibility problems follow. For elements that have no name at all, such as stickers and decorative text, inspect_material reads the resource_id values out of a template so you can add matching assets.
Uncached effects show up as a load failure when you open
A warning above the effects, filters and transitions table describes behaviour that belongs to the editor rather than to the library: when JianYing opens a draft it tries to download any animation, effect or transition that is not cached yet, and that download can time out, which shows up as a load failure message. The note says this happens more often on 5.9. Fonts have a related quirk in both columns: a font that is not cached requires opening the draft a second time before it renders. Both are conditions you hit after generation succeeds, so a pipeline that verifies its output only by checking that the draft file was written will not catch either one. The repository layout gives you the rest of the picture: pyJianYingDraft/ holds the package, demo.py the example, tools/ helper scripts, tests/ and pytest.ini the test setup, plus .flake8, MANIFEST.in, readme_assets/ and pypi_readme.md. Releases have been steady, with 0.2.7 on 2026-06-25, 0.3.0 on 2026-07-08 and 0.3.1 on 2026-10-14.
Editorial conclusion
Use it when the edit is scripted and the final export can happen on a Windows machine, which is the shape its export path actually supports. Before you build a pipeline on it, pin a JianYing version you have tested, check whether your templates are plaintext readable on that version, and keep the Windows export step in your plan rather than assuming the library finishes the job.
Frequently asked questions
Does pyJianYingDraft still support automatic export on the newest JianYing?
No. Controlling which draft opens, exporting a draft to a chosen location and adjusting export resolution and frame rate all work on JianYing 5.9 and on 6.8, which is version 6 and below, and are marked as not working on 10.8, which is version 7 and above, because the newer editor no longer exposes the visible controls that automatic export relies on.
Which Python version should I use with pyJianYingDraft?
The documentation recommends 3.8 or 3.11, the versions used during development, and setup.py sets python_requires to >=3.8. Installing from PyPI does not include the demo, so run demo.py from the repository to see a working draft.
How do I load a template draft with pyJianYingDraft on the new JianYing?
Pass an extra reader when you build the DraftFolder, using DraftFolder(..., fallback_loader=...). The reason is that draft_content.json in the new version is often not readable plaintext JSON, so template loading, media replacement, text replacement, track import and metadata extraction all depend on that loader being present.
Can I add new segments to tracks imported from a pyJianYingDraft template?
No, not on the imported tracks themselves. Apart from the replacement functions, imported tracks do not accept segments, transitions, fades or effects. You can create new tracks and fill them as usual, and only audio, video and text tracks can be imported from a template at present.
Official sources
Add this badge to your README
If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.
[](https://hysenlabs.com/projects/guanyixuan-pyjianyingdraft)Star history chart for your README
[](https://hysenlabs.com/projects/guanyixuan-pyjianyingdraft)Was this useful?