Tools → Video clips (migration 036, admins and up). Paste a YouTube or Facebook link and the server downloads it with yt-dlp; then cut clips: start and end set while watching, a shape (as filmed, 16:9, square or 9:16 at the sizes the platforms ask for, cropped around a chosen point shown over the video), and MP4 video or MP3 audio. Jobs queue and run one at a time with progress. Only YouTube and Facebook links are accepted, and both tools run with argument lists, never a shell. A clip's file is deleted once it has been downloaded in full, unless it's saved to the media library first, which now holds video and audio (image fields still pick images only). Everything is swept a day after it's made. Setup is in docs/video-clips.md. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2.7 KiB
Video clips
Admin → Tools → Video clips (admins and up). Paste one of our YouTube or Facebook links; the server downloads it, then you cut clips from it:
- Trim: set the start and end while watching, or type them (
1:23.5). - Shape: as filmed, landscape 16:9 (1920×1080), square (1080×1080) or vertical 9:16 (1080×1920, for Reels, Shorts and TikTok). A slider moves the crop; the white box over the video shows what's kept.
- Format: video (MP4, H.264 and AAC) or audio only (MP3).
Clips queue and run one at a time. A finished clip is deleted from the server once it's downloaded, unless Save to library is pressed first, which puts it in the media library as an upload (usable as a featured video or in a video block). Everything is cleared a day after it's made.
Only YouTube and Facebook links are accepted, and only for videos NGU owns
or has permission to use. Sources can be up to 4 hours and 4 GB; clips up
to an hour. Limits are constants at the top of server/src/clips.js.
Server setup
-
ffmpeg (with ffprobe):
sudo apt install ffmpeg -
yt-dlp: the standalone binary, kept current (YouTube changes often, and an old yt-dlp is the usual reason downloads start failing):
sudo curl -L https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp_linux -o /usr/local/bin/yt-dlp sudo chmod a+rx /usr/local/bin/yt-dlp sudo yt-dlp -U # to update laterYouTube needs a JavaScript runtime to list formats; the tool hands yt-dlp the Node that runs the API, so nothing else is needed.
-
A working folder the service can write, and the settings on the
ngu-apiunit (systemctl edit ngu-api):sudo mkdir -p /var/lib/ngu/clips sudo chown <ngu-api user>: /var/lib/ngu/clips[Service] Environment=CLIPS_DIR=/var/lib/ngu/clips # Only if they aren't on the service's PATH: # Environment=YTDLP_PATH=/usr/local/bin/yt-dlp # Environment=FFMPEG_PATH=/usr/bin/ffmpeg # Environment=FFPROBE_PATH=/usr/bin/ffprobeA source can be several GB, so leave room on that disk.
-
nginx: the editor's video and clip downloads are big streams. Give them their own block so nginx passes them straight through:
location /api/admin/clips/ { proxy_pass http://127.0.0.1:3001; proxy_http_version 1.1; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_buffering off; proxy_read_timeout 300s; }
The Video clips page says if yt-dlp or ffmpeg is missing.