Skip to content

Instantly share code, notes, and snippets.

@lourou
Last active December 3, 2024 14:43
Show Gist options
  • Save lourou/a2af14fb7ca618eea25a7656bc447ffc to your computer and use it in GitHub Desktop.
Save lourou/a2af14fb7ca618eea25a7656bc447ffc to your computer and use it in GitHub Desktop.

Archiving past live events from Vimeo/Youtube

Quick reference for saving an active live stream in the past, and compressing it using FFmpeg on Apple Silicon Macs.

Recording Past Content

# Record from specific time in past
streamlink --hls-start-offset HH:MM:SS VIMEO_URL best -o output.mp4

# Record from beginning
streamlink --hls-live-restart VIMEO_URL best -o output.mp4

Trim Video

ffmpeg -i input.mp4 -ss START_TIME -to END_TIME -c copy output_trimmed.mp4

Compress for Storage (Apple Silicon M-series)

# Fast (Hardware Accelerated)
ffmpeg -i input.mp4 -c:v hevc_videotoolbox -q:v 50 -c:a aac -b:a 192k compressed.mp4

# High Quality (Slower)
ffmpeg -i input.mp4 -c:v libx265 -crf 23 -preset slow -c:a aac -b:a 192k archive.mp4

Prameters Explained:

  • hevc_videotoolbox: Apple Silicon hardware encoder
  • q:v 50: Quality setting (0-100, higher is better)
  • crf 23: Constant Rate Factor (0-51, lower is better)
  • b:a 192k: Audio bitrate
  • -ss: Start time
  • -to: End time
  • -c copy: Copy stream without re-encoding
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment