Downloads viral clips β cuts funniest moments β crops to 9:16 vertical β adds meme-style captions β exports ready-to-upload YouTube Shorts MP4s. Bonus: auto-builds a Top-5 compilation video from all clips.
brew install ffmpeg yt-dlpsudo apt update
sudo apt install ffmpeg -y
sudo curl -L https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp \
-o /usr/local/bin/yt-dlp
sudo chmod a+rx /usr/local/bin/yt-dlp# Install Scoop first: https://scoop.sh
scoop install ffmpeg yt-dlpVerify:
ffmpeg -version
yt-dlp --version# Create venv (recommended)
python3 -m venv venv
source venv/bin/activate # macOS/Linux
# venv\Scripts\activate # Windows
# Install Python packages
pip install moviepy pillow numpy yt-dlpOptional β AI auto-captions (Whisper):
pip install openai-whisper(Whisper integration can be added by calling
whisper <clip.mp4>and piping the SRT into ffmpeg's subtitle filter.)
After running the script once, this structure is created automatically:
project/
βββ shorts_creator.py β the main script
βββ downloads/ β raw downloaded videos
βββ clips/ β intermediate cut/vertical clips
βββ output/ β β
FINAL YouTube Shorts go here
β βββ video1.mp4
β βββ video2.mp4
β βββ TOP5_compilation.mp4
βββ fonts/ β Roboto-Bold.ttf (auto-downloaded)
python3 shorts_creator.pypython3 shorts_creator.py \
"https://www.youtube.com/watch?v=YOUR_VIDEO_ID" \
12.5 \
27.0 \
"WAIT FOR IT π" \
my_funny_clipArguments: <url> <start_sec> <end_sec> <caption_text> <output_name>
Edit the CLIPS_LIST section in shorts_creator.py:
CLIPS_LIST: list[ClipSpec] = [
ClipSpec(
url = "https://www.youtube.com/watch?v=YOUR_VIDEO",
start = 10.0, # start time in seconds
end = 23.0, # end time in seconds (5β15 sec clips only)
caption = "THIS IS INSANE ππ₯",
title = "my_clip_name", # used for filenames
zoom = 1.15, # subtle zoom-in (1.0 = none, 1.3 = big)
),
# add more ClipSpec(...) entries here
]After the script finishes, collect everything from the output/ folder:
ls -lh output/
# video1.mp4 β Short #1
# video2.mp4 β Short #2
# ...
# TOP5_compilation.mp4 β Bonus compilationUpload directly to YouTube β Create β Upload Video β select Shorts format.
| Variable | Default | Description |
|---|---|---|
SHORTS_W / H |
1080Γ1920 | YouTube Shorts resolution |
CAPTION_FONT_SIZE |
72 | Caption text size in pixels |
CAPTION_STROKE_W |
6 | Black outline thickness |
CAPTION_POSITION |
0.72 | Vertical position (0=top, 1=bottom) |
TARGET_FPS |
30 | Output frame rate |
CRF |
23 | Video quality (18=best, 28=smallest) |
PRESET |
medium | ffmpeg speed/quality tradeoff |
| Problem | Fix |
|---|---|
yt-dlp rate-limited / blocked |
Add --cookies-from-browser chrome to yt-dlp cmd in script |
zoompan makes video slow |
Reduce clip zoom to 1.05 or 1.0 |
| Captions look bad | Increase CAPTION_FONT_SIZE or change CAPTION_POSITION |
| Audio out of sync | Change CRF from 23 β 18 for higher quality |
moviepy ImportError |
pip install moviepy==1.0.3 (stable version) |
| Font not loading | Place Roboto-Bold.ttf manually in fonts/ folder |
# Rick Astley - Never Gonna Give You Up
https://www.youtube.com/watch?v=dQw4w9WgXcQ
# Me at the zoo (first YouTube video)
https://www.youtube.com/watch?v=jNQXAC9IVRw
# Charlie Bit My Finger
https://www.youtube.com/watch?v=FtutLA63Cp8
# Evolution of Dance
https://www.youtube.com/watch?v=e_DqV1xdf-Y
β οΈ Copyright notice: Only use clips you have rights to, or clips under Creative Commons license. Useyt-dlp --list-formats <url>to inspect available quality options.
pip install openai-whisper
# Generate SRT for a clip:
whisper clips/my_clip_raw.mp4 --model base --output_format srt
# Then burn into video with ffmpeg:
ffmpeg -i clips/my_clip_vertical.mp4 \
-vf "subtitles=clips/my_clip_raw.srt:force_style='FontSize=24,PrimaryColour=&Hffffff&'" \
output/video1.mp4