{"skill":{"slug":"video-editor","displayName":"Video Editor","summary":"Perform video editing tasks with ffmpeg, including cutting, merging, converting formats, extracting audio, adding subtitles, resizing, cropping, adjusting sp...","description":"---\nname: video-editor\ndescription: Video editing operations using ffmpeg. Use when user needs to: (1) Cut/trim video clips, (2) Merge/join multiple videos, (3) Convert video formats, (4) Extract audio from video, (5) Add subtitles or text overlays, (6) Adjust video speed, (7) Resize/crop video dimensions, (8) Apply filters or effects. Supports common formats like MP4, MOV, AVI, MKV, WebM.\nhomepage: https://ffmpeg.org\nmetadata:\n  {\n    \"openclaw\":\n      {\n        \"emoji\": \"🎬\",\n        \"requires\": { \"bins\": [\"ffmpeg\", \"ffprobe\"] },\n        \"install\":\n          [\n            {\n              \"id\": \"brew\",\n              \"kind\": \"brew\",\n              \"formula\": \"ffmpeg\",\n              \"bins\": [\"ffmpeg\", \"ffprobe\"],\n              \"label\": \"Install ffmpeg (brew)\",\n            },\n          ],\n      },\n  }\n---\n\n# Video Editor (ffmpeg)\n\nVideo editing operations for cutting, merging, converting, and processing video files.\n\n## Prerequisites\n\nRequires `ffmpeg` and `ffprobe` installed:\n\n```bash\nbrew install ffmpeg\n```\n\n## Quick Start\n\n### Cut/Trim Video\n\nExtract a segment from a video:\n\n```bash\n{baseDir}/scripts/cut.sh /path/to/input.mp4 --start 00:00:10 --end 00:00:30 --out /path/to/output.mp4\n```\n\nOr use duration instead of end time:\n\n```bash\n{baseDir}/scripts/cut.sh /path/to/input.mp4 --start 00:01:00 --duration 30 --out /path/to/output.mp4\n```\n\n### Merge Videos\n\nConcatenate multiple videos (must have same codec/resolution):\n\n```bash\n{baseDir}/scripts/merge.sh video1.mp4 video2.mp4 video3.mp4 --out merged.mp4\n```\n\n### Convert Format\n\nConvert between video formats:\n\n```bash\n{baseDir}/scripts/convert.sh input.mov --format mp4 --out output.mp4\n```\n\n### Extract Audio\n\nExtract audio track from video:\n\n```bash\n{baseDir}/scripts/extract-audio.sh input.mp4 --out audio.mp3\n```\n\n### Add Subtitles\n\nBurn subtitles into video:\n\n```bash\n{baseDir}/scripts/add-subtitles.sh input.mp4 subtitles.srt --out output.mp4\n```\n\n### Resize Video\n\nChange video resolution:\n\n```bash\n{baseDir}/scripts/resize.sh input.mp4 --width 1920 --height 1080 --out output.mp4\n```\n\nOr scale proportionally:\n\n```bash\n{baseDir}/scripts/resize.sh input.mp4 --scale 720 --out output.mp4\n```\n\n### Adjust Speed\n\nSpeed up or slow down video:\n\n```bash\n{baseDir}/scripts/speed.sh input.mp4 --rate 2.0 --out output.mp4   # 2x faster\n{baseDir}/scripts/speed.sh input.mp4 --rate 0.5 --out output.mp4   # 0.5x slower\n```\n\n### Crop Video\n\nCrop to specific region:\n\n```bash\n{baseDir}/scripts/crop.sh input.mp4 --x 100 --y 100 --width 800 --height 600 --out output.mp4\n```\n\n## Common Workflows\n\n### Social Media Clip\n\nCut a segment and resize for Instagram/TikTok:\n\n```bash\n# First cut the segment\n{baseDir}/scripts/cut.sh input.mp4 --start 00:00:15 --duration 15 --out clip.mp4\n\n# Then resize to vertical format\n{baseDir}/scripts/resize.sh clip.mp4 --width 1080 --height 1920 --out tiktok.mp4\n```\n\n### Extract Highlights\n\nCut multiple segments and merge:\n\n```bash\n{baseDir}/scripts/cut.sh input.mp4 --start 00:00:10 --duration 5 --out highlight1.mp4\n{baseDir}/scripts/cut.sh input.mp4 --start 00:01:30 --duration 5 --out highlight2.mp4\n{baseDir}/scripts/merge.sh highlight1.mp4 highlight2.mp4 --out highlights.mp4\n```\n\n### Add Background Music\n\nReplace or mix audio:\n\n```bash\n# Replace audio\nffmpeg -i video.mp4 -i music.mp3 -c:v copy -map 0:v:0 -map 1:a:0 -shortest output.mp4\n\n# Mix audio (video audio at 70%, music at 30%)\nffmpeg -i video.mp4 -i music.mp3 -filter_complex \"[0:a]volume=0.7[a0];[1:a]volume=0.3[a1];[a0][a1]amix=inputs=2:duration=first\" -c:v copy -shortest output.mp4\n```\n\n## Tips\n\n- **Quality**: Use `-crf 18` for high quality, `-crf 28` for smaller files (default is 23)\n- **Presets**: Use `-preset slow` for better compression, `-preset fast` for quicker encoding\n- **Hardware acceleration**: On Apple Silicon, add `-c:v h264_videotoolbox` for faster encoding\n- **Copy mode**: Use `-c copy` to avoid re-encoding (much faster, but limited editing)\n\n## Troubleshooting\n\n### Merge fails with \"Codec mismatch\"\n\nVideos must have the same codec, resolution, and frame rate. Re-encode them first:\n\n```bash\nffmpeg -i input1.mp4 -c:v libx264 -c:a aac -vf \"scale=1920:1080\" -r 30 temp1.mp4\nffmpeg -i input2.mp4 -c:v libx264 -c:a aac -vf \"scale=1920:1080\" -r 30 temp2.mp4\n{baseDir}/scripts/merge.sh temp1.mp4 temp2.mp4 --out merged.mp4\n```\n\n### Subtitles not showing\n\nEnsure subtitle file format matches extension (.srt, .ass, .vtt). Check encoding:\n\n```bash\nfile -I subtitles.srt  # Should show charset=utf-8\n```\n\nConvert if needed:\n\n```bash\niconv -f GBK -t UTF-8 subtitles.srt > subtitles_utf8.srt\n```\n","tags":{"latest":"1.0.0"},"stats":{"comments":0,"downloads":1716,"installsAllTime":17,"installsCurrent":17,"stars":1,"versions":1},"createdAt":1773618649093,"updatedAt":1778491933006},"latestVersion":{"version":"1.0.0","createdAt":1773618649093,"changelog":"Initial release with cut, merge, convert, extract-audio, add-subtitles, resize, speed, and crop operations","license":"MIT-0"},"metadata":null,"owner":{"handle":"cntuang","userId":"s17fje3cczrajt3n8frc4ajre1842240","displayName":"cntuang","image":"https://avatars.githubusercontent.com/u/34436708?v=4"},"moderation":null}