2025-07-11 18:02:44 +08:00
# CapCutAPI
2025-07-12 09:47:42 +08:00
Open source CapCut API tool.
2025-07-11 18:02:44 +08:00
2025-07-30 18:52:42 +08:00
Try It: https://www.capcutapi.top
2025-07-30 18:51:17 +08:00
2025-07-12 09:49:46 +08:00
[中文说明 ](https://github.com/sun-guannan/CapCutAPI/blob/main/README-zh.md )
2025-07-31 09:19:57 +08:00
## Gallery
**Connect AI generated via CapCutAPI**
[](https://www.youtube.com/watch?v=IF1RDFGOtEU)
[](https://www.youtube.com/watch?v=rGNLE_slAJ8)
2025-07-12 09:47:42 +08:00
## Project Features
2025-07-11 18:02:44 +08:00
2025-07-12 09:47:42 +08:00
This project is a Python-based CapCut processing tool that offers the following core functionalities:
2025-07-11 18:02:44 +08:00
2025-07-12 09:47:42 +08:00
### Core Features
2025-07-11 18:02:44 +08:00
2025-07-12 09:47:42 +08:00
- **Draft File Management**: Create, read, modify, and save CapCut draft files
- **Material Processing**: Support adding and editing various materials such as videos, audios, images, texts, stickers, etc.
- **Effect Application**: Support adding multiple effects like transitions, filters, masks, animations, etc.
- **API Service**: Provide HTTP API interfaces to support remote calls and automated processing
- **AI Integration**: Integrate multiple AI services to support intelligent generation of subtitles, texts, and images
2025-07-11 18:02:44 +08:00
2025-07-12 09:47:42 +08:00
### Main API Interfaces
2025-07-11 18:02:44 +08:00
2025-07-12 09:47:42 +08:00
- `/create_draft` : Create a draft
- `/add_video` : Add video material to the draft
- `/add_audio` : Add audio material to the draft
- `/add_image` : Add image material to the draft
- `/add_text` : Add text material to the draft
- `/add_subtitle` : Add subtitles to the draft
- `/add_effect` : Add effects to materials
- `/add_sticker` : Add stickers to the draft
- `/save_draft` : Save the draft file
2025-07-11 18:02:44 +08:00
2025-07-12 09:47:42 +08:00
## Configuration Instructions
2025-07-11 18:02:44 +08:00
2025-07-12 09:47:42 +08:00
### Configuration File
2025-07-11 18:02:44 +08:00
2025-07-12 09:47:42 +08:00
The project supports custom settings through a configuration file. To use the configuration file:
2025-07-11 18:02:44 +08:00
2025-07-12 09:47:42 +08:00
1. Copy `config.json.example` to `config.json`
2. Modify the configuration items as needed
2025-07-11 18:02:44 +08:00
```bash
cp config.json.example config.json
```
2025-07-12 09:47:42 +08:00
### Environment Configuration
2025-07-11 18:02:44 +08:00
2025-07-12 09:52:23 +08:00
#### ffmpeg
This project depends on ffmpeg. You need to ensure that ffmpeg is installed on your system and added to the system's environment variables.
2025-07-12 09:47:42 +08:00
#### Python Environment
2025-07-11 18:02:44 +08:00
2025-07-12 09:47:42 +08:00
This project requires Python version 3.8.20. Please ensure that the correct version of Python is installed on your system.
2025-07-11 18:02:44 +08:00
2025-07-12 09:47:42 +08:00
#### Install Dependencies
2025-07-11 18:02:44 +08:00
2025-07-12 09:47:42 +08:00
Install the required dependency packages for the project:
2025-07-11 18:02:44 +08:00
```bash
pip install -r requirements.txt
```
2025-07-12 09:47:42 +08:00
### Run the Server
2025-07-11 18:02:44 +08:00
2025-07-12 09:47:42 +08:00
After completing the configuration and environment setup, execute the following command to start the server:
2025-07-11 18:02:44 +08:00
```bash
python capcut_server.py
```
2025-07-12 09:47:42 +08:00
Once the server is started, you can access the related functions through the API interfaces.
2025-07-11 18:02:44 +08:00
2025-07-12 09:47:42 +08:00
## Usage Examples
2025-07-11 18:02:44 +08:00
2025-07-12 09:47:42 +08:00
### Adding a Video
2025-07-11 18:02:44 +08:00
```python
import requests
2025-07-19 17:25:12 +08:00
response = requests.post("http://localhost:9001/add_video", json={
2025-07-11 18:02:44 +08:00
"video_url": "http://example.com/video.mp4",
"start": 0,
"end": 10,
"width": 1080,
"height": 1920
})
print(response.json())
```
2025-07-12 09:47:42 +08:00
### Adding Text
2025-07-11 18:02:44 +08:00
```python
import requests
2025-07-19 17:25:12 +08:00
response = requests.post("http://localhost:9001/add_text", json={
2025-07-12 09:47:42 +08:00
"text": "Hello, World!",
2025-07-11 18:02:44 +08:00
"start": 0,
"end": 3,
2025-07-20 14:35:06 +08:00
"font": "ZY_Courage",
2025-07-11 18:02:44 +08:00
"font_color": "#FF0000 ",
"font_size": 30.0
})
print(response.json())
```
2025-07-12 09:52:23 +08:00
### Saving a Draft
```python
import requests
2025-07-19 17:25:12 +08:00
response = requests.post("http://localhost:9001/save_draft", json={
2025-07-12 09:52:23 +08:00
"draft_id": "123456",
"draft_folder": "your capcut draft folder"
})
print(response.json())
```
2025-07-19 17:38:55 +08:00
You can also use the ```rest_client_test.http` `` file of the REST Client for HTTP testing. Just need to install the corresponding IDE plugin
2025-07-12 09:52:23 +08:00
### Copying the Draft to CapCut Draft Path
Calling `save_draft` will generate a folder starting with `dfd_` in the current directory of the server. Copy this folder to the CapCut draft directory, and you will be able to see the generated draft.
### More Examples
Please refer to the `example.py` file in the project, which contains more usage examples such as adding audio and effects.
2025-07-12 09:47:42 +08:00
## Project Features
2025-07-11 18:02:44 +08:00
2025-07-12 09:47:42 +08:00
- **Cross-platform Support**: Supports both CapCut China version and CapCut International version
- **Automated Processing**: Supports batch processing and automated workflows
- **Rich APIs**: Provides comprehensive API interfaces for easy integration into other systems
- **Flexible Configuration**: Achieve flexible function customization through configuration files
2025-07-30 18:51:17 +08:00
- **AI Enhancement**: Integrate multiple AI services to improve video production efficiency