Skip to content

Instantly share code, notes, and snippets.

@AkdM
Last active October 22, 2022 21:50
Show Gist options
  • Save AkdM/d50f0f21f16d1747213a969275ff5d95 to your computer and use it in GitHub Desktop.
Save AkdM/d50f0f21f16d1747213a969275ff5d95 to your computer and use it in GitHub Desktop.
youtube-dl and ffmpeg with a YouTube live stream

The following will get the YT livestream (it should be a .m3u8 file), and will output multiple %d.mp4 files, every 20 seconds thanks to ffmpeg:

ffmpeg -i `youtube-dl --youtube-skip-dash-manifest -g "https://www.youtube.com/watch?v=f9ALdmDLPGU"` -c copy -flags +global_header -f segment -segment_time 20 -segment_format_options movflags=+faststart -reset_timestamps 1 "%d.mp4"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment