Supports loading unencrypted draft files, replacing audio and video clips, modifying text content, and importing audio/video/text tracks from template drafts to other drafts. You can batch export drafts, adjust export resolution and frame rate, add local video/image assets, set audio fade effects, and apply various effects and filters.
1. Purpose and background of the project
- In the video production process, a lot of material splicing, text/subtitles, transitions, animations, filters, special effects, etc. are often processed, which is very cumbersome if done manually.
- This project aims to allow users to control “clipping drafts” (i.e., engineering files/draft files of clipping projects) with scripts, so as to automatically generate, edit, combine, and export videos.
- In other words, it is a tool that “automates the editing at the file level” rather than processing at the video pixel level (unlike FFmpeg, which directly manipulates encoding, frames, etc.).
2. Main functions/features
Based on the list of features in the README, here’s a summary of what it supports (or partially supports):
| Functional categories | What can be done / what can be supported | Limitations / Points to note |
|---|---|---|
| Template mode | Load an existing unencrypted draft_content.json as a template, replace the footage, modify the text content, import the template track into another draft | Clipping 6+ version encrypts draft_content.json, and currently only supports the template function of Clipping 5.9 and below |
| Bulk export | Control clipping, open the specified draft + export to the specified path + adjust the resolution/frame rate, etc | Relies on GUI automation tools under Windows such as uiautomation and only supports export capabilities in clipping 6 and below |
| Add clips, clips, effects, filters, transitions, animations, text, subtitles, masks, etc | You can add video/image/audio/text clips to drafts through scripts, set their duration, playback speed, audio fade, keyframes, rotation/zoom/transparency/filters/effects, etc | On the track where the template is imported, it is currently not possible to continue adding new clips/effects (i.e. there are modification restrictions on the track imported by the template) |
| Rail operation | You can create multiple tracks (video tracks, audio tracks, effects tracks, filter tracks, etc.) and control the track order | When operating multi-tracks, pay attention to the order of tracks of the same type and specify the track name or index when adding fragments |
| Keyframe manipulation | Support adding keyframes to attributes such as transparency, position, zoom, rotation, volume, etc | Currently, keyframing filter/effect parameters (i.e. the change curve of parameters in special effects) is not supported. |
| Subtitles / Text | You can create text snippets, control their style (font, color, size, alignment, etc.), wrap words, import SRT subtitles | Imported subtitles are only supported in SRT format; Note that if the caption clip is too short, the animation may not perform well |
| Mask | Support adding linear masks, circular masks, feathering, rounded corners, rotation, and other settings to video clips | The parameters should conform to the mask mechanism inside the clipping |
In addition, it also provides some convenient methods, such as the time format can be entered in the form of strings “1.5s” and “1h3m12s” without calculating microseconds each time.
3. Usage environment and restrictions
Although this project is rich in features, there are many limitations and notes in terms of version/platform/permissions:
- Clip version compatibility
- The template function relies on decryption
draft_content.json, and the 6+ version of Jianying encrypts this file, so the template-related functions currently do not support draft 6+ version. - The export function is not available when the clipping 7+ version controls are hidden, and currently only supports clipping 6 and below.
- The template function relies on decryption
- OS compatibility
- Supports draft generation, template mode, and automatic export on Windows (relies on GUI automation)
- On Linux/macOS , only draft generation and template mode are supported, and auto-export is not supported (due to related to clipping GUI control operations)
- While it is possible to generate a draft, the final export still needs to be performed on the Windows clipping client.
- Permissions / Export Restrictions
- The export function requires the user to have the export permission for the clipping (you cannot use the function that requires VIP to export, otherwise there may be problems/dead loops).
- The export operation is simulated by controlling the clipping window, mouse clicks, etc.; This approach has vulnerabilities (blocked windows, loss of focus, unexpected operation interference, etc.)
- Limited modifiability of template import tracks
- Although it is possible to import the track of the template into the target draft, it is currently not possible to add new effects/transitions/animations, etc. to the clip on the imported track, and can only read/keep the existing content.
4. Usage examples / Quick start process
An example is provided demo.py in the README to demonstrate how:
- Specify the draft folder path for the clip (usually “Jianying Pro Drafts”)
- Run the script to generate a new draft
- Open it in the clipping client to see the corresponding clips, text, animations, etc
The basic steps are roughly as follows:
import pyJianYingDraft as draft
draft_folder = draft.DraftFolder("<你的草稿文件夹路径>")
script = draft_folder.duplicate_as_template("模板草稿", "新草稿")
# 在 script(即新草稿)上做操作,比如添加视频 / 音频 / 文字片段、特效、转场、关键帧等
script.save()
Then (on Windows) you can use with:
from pyJianYingDraft import JianyingController, ExportResolution, ExportFramerate
ctrl = draft.JianyingController()
ctrl.export_draft("要导出的草稿名称", "<导出路径>",
resolution=ExportResolution.RES_1080P,
framerate=ExportFramerate.FR_24)
to control the clip to export the draft as a video file (such as mp4).
5. Application scenarios & advantages of the project
This library is suitable for use in the following scenarios:
- Batch/automated video generation
For example, if you have a large number of videos with similar structures (template + content replacement), you can use scripts to do it in batches. - Procedural/scripted video stitching
For example, in the background service, videos are generated based on data/templates, instead of manually doing them one by one in the clipping. - Mix/composite video pipeline
You can use it as part of the entire video processing pipeline (material selection and structure script control in the early stage, and then cut and export) - Further processing / customization of clipping project files
If you need to understand the internal structure/format of the cut draft, you can use this library to read, write, and modify internal elements (clips, tracks, effects, etc.)
The advantages over manual operation are:
- Automate repetitive tasks and reduce manual errors
- Maintain structural consistency and standardization
- Easy integration with other systems/scripts/databases
However, be aware of the version/platform compatibility limitations mentioned above.
Github:https://github.com/GuanYixuan/pyJianYingDraft
Tubing: