2025-08-13 18:49:37 -07:00
2025-08-10 16:35:53 +08:00
# Connect AI generates via CapCutAPI [Try it online](https://www.capcutapi.top)
2025-07-11 18:02:44 +08:00
2025-08-10 16:35:53 +08:00
## Project Overview
2025-08-10 16:39:17 +08:00
**CapCutAPI** is a powerful editing API that empowers you to take full control of your AI-generated assets, including images, audio, video, and text. It provides the precision needed to refine and customize raw AI output, such as adjusting video speed or mirroring an image. This capability effectively solves the lack of control often found in AI video generation, allowing you to easily transform your creative ideas into polished videos.
All these features are designed to mirror the functionalities of the CapCut software, ensuring a familiar and efficient editing experience in the cloud.
2025-08-01 16:13:21 +08:00
2025-08-10 16:41:07 +08:00
Enjoy It! 😀😀😀
2025-08-01 16:13:21 +08:00
2025-08-10 16:47:57 +08:00
[中文说明 ](README-zh.md )
2025-08-10 16:41:07 +08:00
### Advantages
2025-08-01 16:13:21 +08:00
2025-08-10 16:42:08 +08:00
1. **API-Powered Editing: ** Access all CapCut/Jianying editing features, including multi-track editing and keyframe animation, through a powerful API.
2025-08-01 16:13:21 +08:00
2025-08-10 16:42:08 +08:00
2. **Real-Time Cloud Preview: ** Instantly preview your edits on a webpage without downloads, dramatically improving your workflow.
2025-08-01 16:13:21 +08:00
2025-08-10 16:42:08 +08:00
3. **Flexible Local Editing: ** Export projects as drafts to import into CapCut or Jianying for further refinement.
2025-08-01 16:13:21 +08:00
2025-08-10 16:42:08 +08:00
4. **Automated Cloud Generation: ** Use the API to render and generate final videos directly in the cloud.
2025-08-01 16:05:15 +08:00
2025-08-10 16:35:53 +08:00
## Demos
2025-07-31 09:19:57 +08:00
2025-08-10 16:44:14 +08:00
<div align="center">
2025-07-11 18:02:44 +08:00
2025-08-10 16:35:53 +08:00
**MCP, create your own editing Agent**
2025-07-11 18:02:44 +08:00
2025-08-10 16:44:14 +08:00
[](https://www.youtube.com/watch?v=fBqy6WFC78E)
2025-07-11 18:02:44 +08:00
2025-08-10 16:44:14 +08:00
**Combine AI-generated images and videos using CapCutAPI**
2025-07-11 18:02:44 +08:00
2025-08-17 15:42:51 +08:00
[More ](pattern )
2025-08-10 16:44:14 +08:00
[](https://www.youtube.com/watch?v=1zmQWt13Dx0)
2025-07-11 18:02:44 +08:00
2025-08-10 16:44:14 +08:00
[](https://www.youtube.com/watch?v=IF1RDFGOtEU)
2025-07-11 18:02:44 +08:00
2025-08-10 16:44:14 +08:00
[](https://www.youtube.com/watch?v=rGNLE_slAJ8)
2025-07-11 18:02:44 +08:00
2025-08-17 15:42:51 +08:00
2025-08-10 16:44:14 +08:00
</div>
2025-07-11 18:02:44 +08:00
2025-08-10 16:35:53 +08:00
## Key Features
2025-07-11 18:02:44 +08:00
2025-08-10 16:35:53 +08:00
| Feature Module | API | MCP Protocol | Description |
|---------|----------|----------|------|
| **Draft Management ** | ✅ | ✅ | Create and save Jianying/CapCut draft files |
| **Video Processing ** | ✅ | ✅ | Import, clip, transition, and apply effects to multiple video formats |
| **Audio Editing ** | ✅ | ✅ | Audio tracks, volume control, sound effects processing |
| **Image Processing ** | ✅ | ✅ | Image import, animation, masks, filters |
| **Text Editing ** | ✅ | ✅ | Multi-style text, shadows, backgrounds, animations |
| **Subtitle System ** | ✅ | ✅ | SRT subtitle import, style settings, time synchronization |
| **Effects Engine ** | ✅ | ✅ | Visual effects, filters, transition animations |
| **Sticker System ** | ✅ | ✅ | Sticker assets, position control, animation effects |
| **Keyframes ** | ✅ | ✅ | Property animation, timeline control, easing functions |
| **Media Analysis ** | ✅ | ✅ | Get video duration, detect format |
2025-08-01 16:30:17 +08:00
2025-08-10 16:35:53 +08:00
## Quick Start
2025-08-01 16:30:17 +08:00
2025-08-10 16:35:53 +08:00
### 1\. System Requirements
2025-08-01 16:30:17 +08:00
2025-08-10 16:35:53 +08:00
- Python 3.10+
- Jianying or CapCut International version
- FFmpeg
2025-08-01 16:30:17 +08:00
2025-08-10 16:35:53 +08:00
### 2\. Installation and Deployment
2025-07-11 18:02:44 +08:00
```bash
2025-08-01 16:30:17 +08:00
# 1. Clone the project
git clone https://github.com/sun-guannan/CapCutAPI.git
cd CapCutAPI
2025-08-10 16:35:53 +08:00
# 2. Create a virtual environment (recommended)
2025-08-01 16:30:17 +08:00
python -m venv venv-capcut
source venv-capcut/bin/activate # Linux/macOS
# or venv-capcut\Scripts\activate # Windows
# 3. Install dependencies
pip install -r requirements.txt # HTTP API basic dependencies
pip install -r requirements-mcp.txt # MCP protocol support (optional)
2025-08-10 16:35:53 +08:00
# 4. Configuration file
2025-07-11 18:02:44 +08:00
cp config.json.example config.json
2025-08-01 16:30:17 +08:00
# Edit config.json as needed
2025-07-11 18:02:44 +08:00
```
2025-08-10 16:35:53 +08:00
### 3\. Start the service
2025-07-12 09:52:23 +08:00
2025-08-01 16:30:17 +08:00
```bash
2025-08-10 16:35:53 +08:00
python capcut_server.py # Start the HTTP API server, default port: 9001
2025-07-11 18:02:44 +08:00
2025-08-10 16:35:53 +08:00
python mcp_server.py # Start the MCP protocol service, supports stdio communication
2025-07-11 18:02:44 +08:00
```
2025-08-10 16:35:53 +08:00
## MCP Integration Guide
2025-07-11 18:02:44 +08:00
2025-08-10 16:50:36 +08:00
[MCP 中文文档 ](https://www.google.com/search?q=./MCP_%E6%96%87%E6%A1%A3_%E4%B8%AD%E6%96%87.md ) • [MCP English Guide ](https://www.google.com/search?q=./MCP_Documentation_English.md )
2025-08-01 16:30:17 +08:00
2025-08-10 16:35:53 +08:00
### 1\. Client Configuration
2025-08-01 16:30:17 +08:00
2025-08-10 16:35:53 +08:00
Create or update the `mcp_config.json` configuration file:
2025-08-01 16:30:17 +08:00
```json
{
"mcpServers": {
"capcut-api": {
"command": "python3",
"args": ["mcp_server.py"],
"cwd": "/path/to/CapCutAPI",
"env": {
"PYTHONPATH": "/path/to/CapCutAPI",
"DEBUG": "0"
}
}
}
}
```
2025-08-10 16:35:53 +08:00
### 2\. Connection Test
2025-07-11 18:02:44 +08:00
```bash
2025-08-01 16:30:17 +08:00
# Test MCP connection
python test_mcp_client.py
2025-08-01 16:26:41 +08:00
2025-08-01 16:30:17 +08:00
# Expected output
✅ MCP server started successfully
2025-08-10 16:35:53 +08:00
✅ Got 11 available tools
2025-08-01 16:30:17 +08:00
✅ Draft creation test passed
2025-07-11 18:02:44 +08:00
```
2025-08-10 16:35:53 +08:00
## Usage Examples
2025-08-01 16:30:17 +08:00
2025-08-10 16:35:53 +08:00
### 1\. API Example
2025-08-01 16:30:17 +08:00
2025-08-10 16:35:53 +08:00
Add video material
2025-07-11 18:02:44 +08:00
```python
import requests
2025-08-01 16:30:17 +08:00
# Add background video
2025-07-19 17:25:12 +08:00
response = requests.post("http://localhost:9001/add_video", json={
2025-08-01 16:30:17 +08:00
"video_url": "https://example.com/background.mp4",
2025-07-11 18:02:44 +08:00
"start": 0,
2025-08-10 16:35:53 +08:00
"end": 10
2025-08-01 16:30:17 +08:00
"volume": 0.8,
"transition": "fade_in"
2025-07-11 18:02:44 +08:00
})
2025-08-01 16:30:17 +08:00
print(f"Video addition result: {response.json()}")
2025-07-11 18:02:44 +08:00
```
2025-08-10 16:35:53 +08:00
Create stylized text
2025-07-11 18:02:44 +08:00
```python
import requests
2025-08-01 16:30:17 +08:00
# Add title text
2025-07-19 17:25:12 +08:00
response = requests.post("http://localhost:9001/add_text", json={
2025-08-10 16:35:53 +08:00
"text": "Welcome to CapCutAPI",
2025-07-11 18:02:44 +08:00
"start": 0,
2025-08-01 16:30:17 +08:00
"end": 5,
2025-08-12 16:56:15 +08:00
"font": "Source Han Sans",read
2025-08-01 16:30:17 +08:00
"font_color": "#FFD700 ",
"font_size": 48,
"shadow_enabled": True,
"background_color": "#000000 "
2025-07-11 18:02:44 +08:00
})
2025-08-01 16:30:17 +08:00
print(f"Text addition result: {response.json()}")
2025-07-11 18:02:44 +08:00
```
2025-08-10 16:35:53 +08:00
More examples can be found in the `example.py` file.
2025-08-01 16:30:17 +08:00
2025-08-10 16:35:53 +08:00
### 2\. MCP Protocol Example
2025-08-01 16:30:17 +08:00
2025-08-10 16:35:53 +08:00
Complete workflow
2025-07-12 09:52:23 +08:00
```python
2025-08-10 16:35:53 +08:00
# 1. Create a new project
2025-08-01 16:30:17 +08:00
draft = mcp_client.call_tool("create_draft", {
"width": 1080,
"height": 1920
})
draft_id = draft["result"]["draft_id"]
# 2. Add background video
mcp_client.call_tool("add_video", {
"video_url": "https://example.com/bg.mp4",
"draft_id": draft_id,
"start": 0,
"end": 10,
"volume": 0.6
})
# 3. Add title text
mcp_client.call_tool("add_text", {
"text": "AI-Driven Video Production",
"draft_id": draft_id,
"start": 1,
"end": 6,
"font_size": 56,
"shadow_enabled": True,
"background_color": "#1E1E1E "
})
# 4. Add keyframe animation
mcp_client.call_tool("add_video_keyframe", {
"draft_id": draft_id,
"track_name": "main",
"property_types": ["scale_x", "scale_y", "alpha"],
"times": [0, 2, 4],
"values": ["1.0", "1.2", "0.8"]
})
2025-07-12 09:52:23 +08:00
2025-08-10 16:35:53 +08:00
# 5. Save the project
2025-08-01 16:30:17 +08:00
result = mcp_client.call_tool("save_draft", {
"draft_id": draft_id
2025-07-12 09:52:23 +08:00
})
2025-08-10 16:35:53 +08:00
2025-08-01 16:30:17 +08:00
print(f"Project saved: {result['result']['draft_url']}")
```
2025-08-10 16:35:53 +08:00
Advanced text effects
2025-08-01 16:30:17 +08:00
2025-08-10 16:35:53 +08:00
```python
# Multi-style colored text
mcp_client.call_tool("add_text", {
"text": "Colored text effect demonstration",
"draft_id": draft_id,
"start": 2,
"end": 8,
"font_size": 42,
"shadow_enabled": True,
"shadow_color": "#FFFFFF ",
"background_alpha": 0.8,
"background_round_radius": 20,
"text_styles": [
{"start": 0, "end": 2, "font_color": "#FF6B6B "},
{"start": 2, "end": 4, "font_color": "#4ECDC4 "},
{"start": 4, "end": 6, "font_color": "#45B7D1 "}
]
})
2025-07-12 09:52:23 +08:00
```
2025-08-10 16:35:53 +08:00
### 3\. Downloading Drafts
2025-08-01 16:30:17 +08:00
2025-08-10 16:35:53 +08:00
Calling `save_draft` will generate a folder starting with `dfd_` in the current directory of `capcut_server.py` . Copy this to the CapCut/Jianying drafts directory to see the generated draft in the application.
2025-08-01 16:26:41 +08:00
2025-08-12 16:56:15 +08:00
## Pattern
You can find a lot of pattern in the `pattern` directory.
2025-08-10 16:35:53 +08:00
## Community & Support
2025-08-01 16:26:41 +08:00
2025-08-10 16:35:53 +08:00
We welcome contributions of all forms\! Our iteration rules are:
2025-08-01 16:26:41 +08:00
2025-08-10 16:35:53 +08:00
- No direct PRs to main
- PRs can be submitted to the dev branch
- Merges from dev to main and releases will happen every Monday
2025-08-04 12:55:54 +08:00
2025-08-10 16:56:02 +08:00
## Contact Us
### 🤝 Collaboration
2025-08-01 16:30:17 +08:00
2025-10-30 11:21:52 +08:00
- **Video Production**: Want to use this API for batch production of videos with AIGC?
2025-08-01 16:30:17 +08:00
2025-08-10 16:53:56 +08:00
- **Join us**: Our goal is to provide a stable and reliable video editing tool that integrates well with AI-generated images, videos, and audio. If you are interested, submit a PR and I'll see it. For more in-depth involvement, the code for the MCP Editing Agent, web-based editing client, and cloud rendering modules has not been open-sourced yet.
2025-08-01 16:30:17 +08:00
2025-10-30 11:19:29 +08:00
**Contact**: abelchrisnic@gmail .com
2025-07-12 09:52:23 +08:00
2025-08-10 16:35:53 +08:00
## 📈 Star History
2025-07-12 09:52:23 +08:00
2025-08-10 16:50:36 +08:00
<div align="center">
2025-07-12 09:52:23 +08:00
2025-08-10 16:51:59 +08:00
[](https://www.star-history.com/#sun -guannan/CapCutAPI&Date)





2025-07-12 09:52:23 +08:00
2025-08-17 16:14:21 +08:00
[](https://mseep.ai/app/69c38d28-a97c-4397-849d-c3e3d241b800)
2025-08-10 16:50:36 +08:00
</div>
2025-07-11 18:02:44 +08:00
2025-08-17 15:42:51 +08:00
*Made with ❤️ by the CapCutAPI Community*