Cut AI-generated videos into 9:16 videos ready to publish on TikTok. Codex is responsible for judging the story, pacing, visual flaws, and caption copy; the script is responsible for repeatable FFmpeg rendering.
Quick workflow
- Locate inputs: confirm the video files, asset folder, BGM, captions/SRT, product selling points, or script. When the user has not provided complete parameters, first proceed with TikTok defaults: 1080x1920, 30fps, 15-45 seconds, strong hook in the first 1-3 seconds, large captions, light BGM.
- Create project: collect the outputs of this session into one project directory to avoid scattering them across the workspace.
python3 <skill-dir>/scripts/init_project.py "<project-dir>" --name "<name>" --inputs "<video1>" "<video2>" - Probe assets: generate a media inventory and extract frames, using the extracted frames to judge bad frames in the AI video, subject position, and whether cover or blur-bg is suitable.
python3 <skill-dir>/scripts/probe_media.py "<project-dir>/raw" --out "<project-dir>/metadata/media_inventory.json" --frames-dir "<project-dir>/diagnostics/frames" - Transcribe when speech is needed: generate JSON/SRT when there is voiceover/narration; for AI videos without speech, captions/overlays can be written directly based on the script.
python3 <skill-dir>/scripts/transcribe.py "<project-dir>/raw/source.mp4" --out-dir "<project-dir>/transcripts" --model small --language auto - Write edit plan: edit
plans/edit_plan.template.json, or first generate a starter plan and then modify it.python3 <skill-dir>/scripts/make_plan.py "<project-dir>" --title "<hook>" --target-seconds 30 - Render:
python3 <skill-dir>/scripts/render_tiktok_cut.py "<project-dir>/plans/edit_plan.json" - Self-check: use
ffprobeto verify output dimensions, duration, and audio; spot-check the beginning, densely captioned areas, and the ending. If captions are blocked by the TikTok UI safe area, the main subject is cropped out, the audio clips, or the BGM is too loud, modify the plan and re-render.
Editing judgment
- For AI videos, prioritize visual continuity: delete clips with deformed hands, drifting logos, caption mistakes, flicker frames, obvious loop stutter, and subjects going out of frame.
- The first 3 seconds must give a reason: open with one of strong on-screen action, result preview, contrast line, price/pain point/selling point overlay. Do not use slow buildup.
- Default vertical recomposition
blur-bg: for landscape or wide-aspect AI videos, use blurred background to preserve the complete subject; when the subject is stable and large enough, usecover; when the full image needs to be shown, usecontain。 - Caption safe area: by default place captions in the lower-middle area, avoiding TikTok's bottom description area and right-side action bar. Place price, discount, and CTA in a top or middle badge.
- BGM is auxiliary: when there is voiceover, lay BGM lightly, default 0.08-0.14; for visual-oriented videos without voiceover, it can be raised to 0.18-0.28, but avoid overpowering key sound effects.
- Batch editing: create a separate project for each video or save multiple
plans/*.jsonin the same project, and include product/angle/index number in the output naming.
Edit Plan
The render script reads the JSON plan. For detailed fields, read references/edit-plan-schema.md。
Minimal usable example:
{
"version": 1,
"project": {
"title": "TikTok cut",
"platform": "tiktok",
"target": {"width": 1080, "height": 1920, "fps": 30}
},
"settings": {
"fit": "blur-bg",
"grade": "punch",
"caption_style": "tiktok-bold",
"voice_volume": 1.0,
"output_name": "final_tiktok.mp4"
},
"clips": [
{"source": "raw/clip.mp4", "start": 0.0, "end": 6.2, "fit": "blur-bg", "label": "HOOK"}
],
"captions": [
{"start": 0.0, "end": 2.4, "text": "第一眼就要看到结果", "style": "hook"}
],
"overlays": [
{"start": 0.0, "end": 2.4, "text": "AI 视频二创", "style": "hook"}
],
"bgm": {"path": "assets/bgm/music.mp3", "volume": 0.12},
"export": {"crf": 20, "preset": "fast"}
}
Script responsibilities
scripts/init_project.py: create the project structure, copy inputs, and write the plan template and manifest.scripts/probe_media.py: ffprobe the assets and extract frames.scripts/transcribe.py: optional local transcription, preferring faster-whisper, falling back to whisper CLI.scripts/make_plan.py: fromraw/generate a conservative starter plan.scripts/render_tiktok_cut.py: according to the plan, normalize clips, concatenate, add captions/overlays/watermark, mix BGM, and export TikTok MP4.
Reference materials
- Read when editing strategy is needed
references/tiktok-editing-playbook.md。 - Read this when you need to modify JSON fields
references/edit-plan-schema.md。 - Read this when you need to understand the trade-offs of the reference project
references/source-projects.md。 - Third-party reference repositories are not vendored with this skill;
references/source-projects.mdonly the learned design patterns and traceable sources are recorded.
Delivery format
After completion, give the user these paths:
- Final video:
<project-dir>/renders/final_tiktok.mp4 - Editing plan:
<project-dir>/plans/edit_plan.json - Render report:
<project-dir>/renders/render_report.json - Subtitles:
<project-dir>/captions/final_captions.ass, and if a transcript was generated, also give the SRT/JSON paths
If there are issues that were not resolved automatically, write them clearly as a short list: for example, a certain AI-generated segment has an unfixable distortion, Whisper is not installed, BGM is missing, or the user needs to manually confirm brand-compliant copy.