Skip to content

ashreo/CapCutAPI

Β 
Β 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

50 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🎬 CapCutAPI - Open source CapCut API tool.

CapCutAPI Logo

GitHub Stars License Python Version MCP Support

πŸš€ Open source CapCut API tool with MCP (Model Context Protocol) support

🌐 Try Online β€’ πŸ“– δΈ­ζ–‡ζ–‡ζ‘£ β€’ πŸ”§ MCP Docs β€’ 🌍 MCP δΈ­ζ–‡ζŒ‡ε—


🎯 Project Overview

CapCutAPI is a powerful enterprise-grade video editing automation platform built with Python, providing complete CapCut video editing capabilities. Through dual interfaces of HTTP API and MCP protocol, it enables seamless integration with AI assistants and automation tools.

πŸ† Core Advantages

🎬 Professional Video Editing

  • Complete CapCut functionality support
  • Multi-track timeline editing
  • Advanced effects and transitions
  • Keyframe animation system

πŸ€– AI Smart Integration

  • Native MCP protocol support
  • Seamless AI assistant integration
  • Automated workflow processes
  • Batch processing capabilities

πŸ”Œ Dual API Interfaces

  • RESTful HTTP API
  • Model Context Protocol
  • Real-time processing response
  • Enterprise-grade stability

🌍 Cross-platform Compatibility

  • CapCut International support
  • JianYing China support
  • Windows/macOS compatible
  • Cloud deployment ready

πŸŽ₯ Product Showcase

🐎 AI Generated Video Cases

Horse Video

🎡 Music Video Production

Song Video

AI-driven video generation powered by CapCutAPI


πŸš€ Core Features

πŸ“‹ Feature Matrix

Feature Module HTTP API MCP Protocol Description
🎬 Draft Management βœ… βœ… Create, read, modify, save CapCut draft files
πŸŽ₯ Video Processing βœ… βœ… Multi-format video import, editing, transitions, effects
πŸ”Š Audio Editing βœ… βœ… Audio tracks, volume control, audio effects
πŸ–ΌοΈ Image Processing βœ… βœ… Image import, animations, masks, filters
πŸ“ Text Editing βœ… βœ… Multi-style text, shadows, backgrounds, animations
πŸ“„ Subtitle System βœ… βœ… SRT subtitle import, styling, time sync
✨ Effects Engine βœ… βœ… Visual effects, filters, transition animations
🎭 Sticker System βœ… βœ… Sticker assets, position control, animation effects
🎯 Keyframes βœ… βœ… Property animations, timeline control, easing functions
πŸ“Š Media Analysis βœ… βœ… Video duration detection, format analysis

πŸ› οΈ API Interface Overview

πŸ“‘ HTTP API Endpoints (9 endpoints)

🎬 Draft Management β”œβ”€β”€ POST /create_draft # Create new draft └── POST /save_draft # Save draft file

πŸŽ₯ Media Assets β”œβ”€β”€ POST /add_video # Add video material β”œβ”€β”€ POST /add_audio # Add audio material └── POST /add_image # Add image material

πŸ“ Text Content β”œβ”€β”€ POST /add_text # Add text elements └── POST /add_subtitle # Add subtitle files

✨ Effect Enhancement β”œβ”€β”€ POST /add_effect # Add visual effects └── POST /add_sticker # Add sticker elements

πŸ”§ MCP Tool Set (11 tools)

🎬 Project Management β”œβ”€β”€ create_draft # Create video project └── save_draft # Save project file

πŸŽ₯ Media Editing β”œβ”€β”€ add_video # Video track + transition effects β”œβ”€β”€ add_audio # Audio track + volume control └── add_image # Image assets + animation effects

πŸ“ Text System β”œβ”€β”€ add_text # Multi-style text + shadow background └── add_subtitle # SRT subtitles + styling

✨ Advanced Features β”œβ”€β”€ add_effect # Visual effects engine β”œβ”€β”€ add_sticker # Sticker animation system β”œβ”€β”€ add_video_keyframe # Keyframe animations └── get_video_duration # Media information retrieval


πŸ› οΈ Quick Start

πŸ“‹ System Requirements

🐍 Python Environment Python 3.8.20+ (Recommended 3.10+)
🎬 CapCut Application CapCut International or JianYing China
🎡 FFmpeg For media file processing and analysis
πŸ’Ύ Storage Space At least 2GB available space

⚑ One-Click Installation

# 1. Clone the project
git clone https://github.com/sun-guannan/CapCutAPI.git
cd CapCutAPI

# 2. Create virtual environment (recommended)
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)

# 4. Configuration
cp config.json.example config.json
# Edit config.json as needed

πŸš€ Start Services

🌐 HTTP API Server

python capcut_server.py

Default port: 9001

πŸ”§ MCP Protocol Server

python mcp_server.py

Supports stdio communication


πŸ”§ MCP Integration Guide

πŸ“± Client Configuration

Create or update mcp_config.json configuration file:

{
  "mcpServers": {
    "capcut-api": {
      "command": "python3",
      "args": ["mcp_server.py"],
      "cwd": "/path/to/CapCutAPI",
      "env": {
        "PYTHONPATH": "/path/to/CapCutAPI",
        "DEBUG": "0"
      }
    }
  }
}

πŸ§ͺ Connection Testing

# Test MCP connection
python test_mcp_client.py

# Expected output
βœ… MCP server started successfully
βœ… Retrieved 11 available tools
βœ… Draft creation test passed

🎯 MCP Featured Functions

Feature Description Example
🎨 Advanced Text Styling Multi-color, shadow, background effects shadow_enabled: true
🎬 Keyframe Animation Position, scale, opacity animations property_types: ["scale_x", "alpha"]
πŸ”Š Audio Precision Control Volume, speed, audio effects volume: 0.8, speed: 1.2
πŸ“± Multi-format Support Various video dimensions and formats width: 1080, height: 1920
⚑ Real-time Processing Instant draft updates and previews Millisecond response time

πŸ’‘ Usage Examples

🌐 HTTP API Examples

πŸ“Ή Adding Video Material
import requests

# Add background video
response = requests.post("http://localhost:9001/add_video", json={
    "video_url": "https://example.com/background.mp4",
    "start": 0,
    "end": 10,
    "width": 1080,
    "height": 1920,
    "volume": 0.8,
    "transition": "fade_in"
})

print(f"Video addition result: {response.json()}")
πŸ“ Creating Styled Text
import requests

# Add title text
response = requests.post("http://localhost:9001/add_text", json={
    "text": "🎬 Welcome to CapCutAPI",
    "start": 0,
    "end": 5,
    "font": "Arial",
    "font_color": "#FFD700",
    "font_size": 48,
    "shadow_enabled": True,
    "background_color": "#000000"
})

print(f"Text addition result: {response.json()}")

πŸ”§ MCP Protocol Examples

🎯 Complete Workflow
# 1. Create new project
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"]
})

# 5. Save project
result = mcp_client.call_tool("save_draft", {
    "draft_id": draft_id
})
print(f"Project saved: {result['result']['draft_url']}")

Testing with REST Client

You can use the rest_client_test.http file with REST Client IDE plugins for HTTP testing.

Draft Management

Calling save_draft generates a folder starting with dfd_ in the server's current directory. Copy this folder to your CapCut draft directory to access the generated draft in CapCut.


πŸ“š Documentation Center

πŸ“– Document Type 🌍 Language πŸ“„ Link πŸ“ Description
MCP Complete Guide πŸ‡ΊπŸ‡Έ English MCP Documentation Complete MCP server usage guide
MCP User Manual πŸ‡¨πŸ‡³ Chinese MCP δΈ­ζ–‡ζ–‡ζ‘£ Detailed Chinese usage instructions
API Reference πŸ‡ΊπŸ‡Έ English example.py Code examples and best practices
REST Testing 🌐 Universal rest_client_test.http HTTP interface test cases

🌟 Enterprise Features

πŸ”’ Security

  • πŸ›‘οΈ Input Validation: Strict parameter validation and type checking
  • πŸ” Error Handling: Comprehensive exception catching and error reporting
  • πŸ“Š Logging: Detailed operation logs and debug information
  • 🚫 Resource Limits: Memory and processing time limit protection

⚑ Performance Optimization

  • πŸš€ Async Processing: Non-blocking concurrent operation support
  • πŸ’Ύ Memory Management: Smart resource recycling and caching mechanisms
  • πŸ“ˆ Batch Processing: Efficient batch operation interfaces
  • ⏱️ Response Time: Millisecond-level API response speed

πŸ”§ Scalability

  • πŸ”Œ Plugin Architecture: Modular functionality extension support
  • 🌐 Multi-protocol: HTTP REST and MCP dual protocol support
  • ☁️ Cloud Deployment: Containerization and microservice architecture ready
  • πŸ“Š Monitoring Integration: Complete performance monitoring and metrics collection

🀝 Community & Support

πŸ’¬ Get Help

πŸ“ž Support Channel πŸ”— Link πŸ“ Description
πŸ› Bug Reports GitHub Issues Bug reports and feature requests
πŸ’‘ Feature Suggestions Discussions Community discussions and suggestions
πŸ“– Documentation Feedback Documentation Issues Documentation improvement suggestions
πŸ”§ Technical Support Stack Overflow Technical Q&A

🎯 Contributing Guide

We welcome all forms of contributions!

# 1. Fork the project
git clone https://github.com/your-username/CapCutAPI.git

# 2. Create feature branch
git checkout -b feature/amazing-feature

# 3. Commit changes
git commit -m 'Add amazing feature'

# 4. Push branch
git push origin feature/amazing-feature

# 5. Create Pull Request

πŸ“ˆ Project Statistics

⭐ Star History

Star History Chart

πŸ“Š Project Metrics

GitHub repo size GitHub code size GitHub issues GitHub pull requests GitHub last commit


πŸ“„ License

This project is open source under the Apache 2.0 License. See LICENSE file for details.

Apache License 2.0

Copyright (c) 2025 CapCutAPI Contributors

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.


πŸŽ‰ Get Started Now

Experience the power of CapCutAPI today!

Get Started Download Documentation


πŸ†• New Feature: Now with MCP protocol support for seamless AI assistant integration! Try the MCP server for advanced video editing automation.

Made with ❀️ by the CapCutAPI Community

About

Open CapCut API.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

No contributors

Languages

  • Python 100.0%