Extracts highlight segments from the original YouTube video and creates 9:16 vertical Shorts clips.
Requirements
System Dependencies
- Python 3.8+
- yt-dlp (YouTube download)
- ffmpeg (video editing)
- OpenAI Whisper (speech recognition) or Whisper API
Installation
pip install yt-dlp openai-whisper
brew install ffmpeg # macOS
# 또는 apt-get install ffmpeg # Ubuntu
Workflow
Step 1: Download Video
python scripts/download_video.py --url "YOUTUBE_URL" --output "temp/"
- Download the highest quality video with yt-dlp
- Output:
temp/video.mp4
Step 2: Extract Subtitles
python scripts/transcribe.py --input "temp/video.mp4" --output "temp/transcript.json"
- Convert speech to text with Whisper
- Output JSON with timestamps
- Output:
temp/transcript.json
Step 3: Reference Shorts Script
outputs/shorts-scripts/shorts-01.md~shorts-03.mdRead- Check segment information in the "Original Video Reference" section of the script
- Or automatically search for matching segments in transcript.json
Step 4: Extract and Edit Clips
python scripts/cut_shorts.py \
--input "temp/video.mp4" \
--transcript "temp/transcript.json" \
--scripts "outputs/shorts-scripts/" \
--output "outputs/shorts-videos/"
- Clip segments with ffmpeg
- Crop to 9:16 ratio
- Hardcode subtitles (optional)
- Output:
outputs/shorts-videos/shorts-01.mp4~shorts-03.mp4
Shorts Specs
Video Specifications
- Resolution: 1080x1920px (vertical)
- Aspect Ratio: 9:16
- Length: 15-60초
- Format: MP4 (H.264)
Subtitle Style
- Position: bottom center or top
- Font: bold sans-serif
- Color: white + black outline
- Size: 80% of screen width
Script Details
download_video.py
- Enter YouTube URL
- Download highest quality
- Show progress
- Error handling
transcribe.py
- Extract audio
- Load Whisper model
- Generate timestamps per segment
- Output in JSON format
cut_shorts.py
- Clip based on start/end time
- Convert 16:9 → 9:16 (center crop)
- Subtitle overlay (optional)
- Batch process 3 clips
Output
Final result
outputs/shorts-videos/shorts-01.mp4outputs/shorts-videos/shorts-02.mp4outputs/shorts-videos/shorts-03.mp4
Intermediate files (temp/)
temp/video.mp4: original downloadtemp/transcript.json: subtitle datatemp/audio.wav: extracted audio
Reference Files
references/shorts-spec.md: Shorts platform-specific specs../shorts-scriptwriter.md: script agent (integration)
Usage Examples
# 전체 파이프라인 실행
cd .claude/skills/shorts-video-maker
# 1. 다운로드
python scripts/download_video.py \
--url "https://youtube.com/watch?v=xxxxx" \
--output "temp/"
# 2. 자막 추출
python scripts/transcribe.py \
--input "temp/video.mp4" \
--output "temp/transcript.json"
# 3. 쇼츠 생성
python scripts/cut_shorts.py \
--input "temp/video.mp4" \
--transcript "temp/transcript.json" \
--scripts "outputs/shorts-scripts/" \
--output "outputs/shorts-videos/"
Notes
- YouTube video copyright check required
- Crop adjustment required if the original video is not 16:9
- Accuracy/speed tradeoff depending on Whisper model size
- Processing speed improves when using a GPU