Video Toolkit - Short Video Processing
Overview
A comprehensive toolkit for processing short videos from Chinese social media platforms (Douyin, Xiaohongshu, Kuaishou, Bilibili). Provides four core capabilities inspired by the qingdou.vip (轻抖) tool:
- Extract Text (提文案 / 文字脚本) — Download a short video and transcribe its full spoken script to text. Uses Vosk (offline, pure C++, no GPU/torch needed, works in any environment) by default, and Whisper automatically when available for higher accuracy.
- Remove Watermark (去水印) — Download videos without platform watermarks
- Remove Subtitle (去字幕) — Remove hardcoded subtitles from video files
- Image OCR (图片提文案) — Extract text from images/screenshots
How to Invoke This Skill (如何调取)
After installing this package with SkillHub, use either method below:
① Conversation trigger (most common) — In WorkBuddy, just give a link + a one-line intent; the skill auto-matches:
- "提取这个抖音视频的文字脚本 https://v.douyin.com/xxx/"
- "把这条视频里说的所有话转成逐字稿"
- "扒一下这个小红书视频的文字"
② Run the script directly (terminal / local machine) — use the bundled venv python:
cd "<skill-directory>"
python video_toolkit.py extract-text "链接" --engine vosk
Batch processing - Run video_toolkit.py extract-text once for each link.
Key prerequisite: Douyin / Kuaishou links need a valid Cookie
- Keep your own cookie file outside this package. Pass it with --cookies <path> or set VIDEO_TOOLKIT_COOKIES.
- If extraction returns 403 / empty content, refresh your own cookie export and pass its local path again.
- The Vosk Chinese model is already cached under ~/.cache/video_toolkit/vosk_models/ and runs offline — no per-run download needed
Quick Start
First-time Setup
Run the environment setup script to install all Python dependencies (requires Python 3.8+ and ffmpeg):
python setup_env.py
To check what's installed without installing:
python setup_env.py --check
ffmpeg must be installed separately (it is NOT a pip package):
- Windows: Download from https://www.gyan.dev/ffmpeg/builds/ and add to PATH
- Mac: brew install ffmpeg
- Linux: sudo apt install ffmpeg
Usage
All commands output JSON. The main script is video_toolkit.py.
# Extract text (full spoken script) from a Douyin share link
python video_toolkit.py extract-text "7.xx 复制此链接 https://v.douyin.com/xxxxx/"
# Same, forcing the offline Vosk engine explicitly
python video_toolkit.py extract-text "https://v.douyin.com/xxxxx/" --engine vosk --model-key cn-small
# Use higher-accuracy Whisper if you have it installed
python video_toolkit.py extract-text "https://v.douyin.com/xxxxx/" --engine whisper --model small
# Download video without watermark
python video_toolkit.py remove-watermark "https://v.douyin.com/xxxxx/"
# Remove subtitles from a local video file
python video_toolkit.py remove-subtitle video.mp4 --method delogo
python video_toolkit.py remove-subtitle video.mp4 --method blur --region 0,80%,100%,20%
python video_toolkit.py remove-subtitle video.mp4 --method inpaint
# Extract text from an image (OCR)
python video_toolkit.py image-text screenshot.png
# Get video metadata
python video_toolkit.py video-info "https://v.douyin.com/xxxxx/"
Task Guide
Task 1: Extract Text from Video (提文案 / 文字脚本)
When: User provides a short video share link and wants the complete spoken script (逐字稿) of the video — i.e. everything said in the video, transcribed into text. This is the core "把所有文字提取出来" capability.
How:
1. Run extract-text with the share link or URL (or a local video file)
2. The script automatically: downloads the video (with cookies if needed) → extracts audio (ffmpeg) → transcribes speech (ASR)
3. Output JSON contains:
- spoken_script — the full transcript of everything spoken in the video
- segments — same text with start/end timestamps
- platform_caption — the original platform 文案/description
- all_text — platform_caption + spoken_script merged for convenience
ASR engine (--engine, default auto):
- auto — use Whisper if installed, otherwise Vosk (offline, always works)
- vosk — offline, pure C++ inference. No torch, no GPU, runs anywhere. Chinese model auto-downloaded on first use. Fast & reliable; recommended default.
- whisper — higher accuracy (openai-whisper / faster-whisper); needs PyTorch, slower on CPU.
Vosk model (--model-key, default cn-small):
- cn-small — fast, ~40MB, good accuracy (default)
- cn — larger, best Chinese accuracy (~1.4GB)
- cn-kaldi-multicn — alternative Chinese model
- en — English
Example user requests:
- "帮我提取这个抖音视频的文案 [share link]"
- "把这条视频里说的所有话转成文字" → extract-text [link] --engine vosk
- "扒一下这个小红书视频的文字"
- "这个快手视频说了什么 [share link]"
Task 2: Remove Watermark (去水印)
When: User wants to download a video without the platform watermark.
How:
1. Run remove-watermark command with the share link
2. For Douyin: parses share text → follows redirect → calls API → gets no-watermark URL → downloads
3. For Xiaohongshu: parses share text → gets note data → downloads original video/images
4. Fallback: yt-dlp for platforms where custom parsing fails
Supported platforms:
| Platform | Share link format | Watermark removal |
|----------|------------------|-------------------|
| Douyin (抖音) | https://v.douyin.com/xxxxx/ | Yes (API + page parse) |
| Xiaohongshu (小红书) | http://xhslink.com/xxxxx | Yes (page parse) |
| Kuaishou (快手) | https://v.kuaishou.com/xxxxx | Via yt-dlp |
| Bilibili (B站) | https://www.bilibili.com/video/BVxxx | Via yt-dlp |
Notes:
- Platform APIs change frequently. If the custom parser fails, yt-dlp is used as fallback.
- Xiaohongshu image posts (图文笔记) are downloaded as image files, not video.
- Some platforms may require cookies or specific headers that change over time.
Task 3: Remove Subtitles (去字幕)
When: User has a local video file with hardcoded subtitles and wants them removed.
How:
1. Run remove-subtitle command with the video file path
2. Choose a removal method (see below)
3. Optionally specify the subtitle region (default: bottom 20% of video)
Removal methods:
| Method | Quality | Speed | Description |
|---|---|---|---|
delogo (default) |
Good | Fast | ffmpeg delogo filter, best for simple subtitle areas |
blur |
Medium | Fast | Blurs the subtitle region (crop+overlay+boxblur) |
black |
Low | Fastest | Covers subtitle with a solid black box |
inpaint |
Best | Slow | OpenCV inpainting, highest quality but requires opencv-python |
Region format: x,y,width,height where values can be pixels or percentages.
- Default (bottom 20%): 0,80%,100%,20%
- Custom: 0,85%,100%,15% (narrower strip at the very bottom)
- The script also accepts ffmpeg expression syntax like ih*0.8
Example user requests:
- "帮我去掉这个视频的字幕 video.mp4"
- "这个视频底部的字幕怎么去掉"
- "视频去字幕 [file path]"
Task 4: Image Text Extraction (图片提文案)
When: User has an image (screenshot, photo, poster) and wants to extract text from it.
How:
1. Run image-text command with the image file path
2. The script tries OCR engines in order: PaddleOCR → EasyOCR → pytesseract
3. Output JSON contains texts (list of detected text lines) and full_text
OCR engine priority:
1. PaddleOCR (recommended) — Best for Chinese text, handles angled text
2. EasyOCR — Good for mixed Chinese/English, easy to install
3. pytesseract — Lightweight, requires tesseract-ocr system package
Task 5: Video Info
When: User wants metadata about a video (duration, resolution, codec, etc.).
How: Run video-info with a URL or file path. Uses ffprobe for local files, and downloads + probes for URLs.
Workflow Decision Tree
User input
├── Share link / URL?
│ ├── "提取文案" / "扒文案" / "文字" → extract-text
│ ├── "去水印" / "下载" / "保存" → remove-watermark
│ └── "信息" / "详情" → video-info
├── Local video file?
│ ├── "去字幕" / "去字幕" → remove-subtitle
│ └── "信息" → video-info
├── Local image file?
│ └── "文字" / "识别" → image-text
└── Multiple links?
└── Loop through each link and run the appropriate command
Important Notes
Platform API Stability
Social media platform APIs (especially Douyin and Xiaohongshu) change frequently to prevent scraping. The custom parsers in this toolkit may break when APIs change. When this happens:
1. The script automatically falls back to yt-dlp
2. yt-dlp is actively maintained and usually has up-to-date extractors
3. Update yt-dlp regularly: pip install -U yt-dlp
Performance Considerations
- Vosk (default, offline): Pure C++ inference, no torch/ctranslate2, no GPU. Runs in any environment (including sandboxes where Whisper won't load). The Chinese model is auto-downloaded once (
cn-small~40MB,cn~1.4GB) and cached under~/.cache/video_toolkit/vosk_models. Near real-time on CPU for short clips. - Whisper (higher accuracy, optional): Auto-used when
openai-whisperis installed (--engine whisper).basemodel ≈ 1-2 min per minute of audio on CPU; use--model tinyfor speed. NOTE:faster-whisper/ctranslate2 segfaults on Python 3.13 — avoid it. - OpenCV inpaint: Much slower than ffmpeg methods. Only use when quality matters.
- PaddleOCR: First run downloads model files (~100MB). Subsequent runs are fast.
Legal & Ethical Use
- Only download and process videos for personal use or with the creator's permission
- Respect platform terms of service and copyright laws
- Do not redistribute downloaded content without permission
- Watermark removal is for personal use only (e.g., creating clean references)
Scripts
video_toolkit.py
Main CLI script with all four capabilities. Run with --help for full usage.
setup_env.py
Environment setup script. Checks and installs all Python dependencies.
requirements.txt
Complete list of Python dependencies. Install with: pip install -r requirements.txt
References
platforms.md
Detailed documentation of supported platforms, URL formats, and API parsing methods.