Skip to content

Instantly share code, notes, and snippets.

@Stylesproline
Last active January 20, 2022 07:31
Show Gist options
  • Save Stylesproline/1086c6d41043268515ec439c2162fa8b to your computer and use it in GitHub Desktop.
Save Stylesproline/1086c6d41043268515ec439c2162fa8b to your computer and use it in GitHub Desktop.
Setup YouTube Live Event

Setup YouTube Live Event

Head on over to your YouTube live Events page (https://www.youtube.com/my_live_events).

Create a new live event that is unlisted (or private) and of Custom type.

Under Basic ingestion choose 1500 Kbps - 4000 kbps (720p).

Check the Enable 60fps box.

Note your Stream Name and Primary Server URL.

Restream With FFmpeg

Get FFmpeg for your machine (sudo apt-get install ffmpeg)

Run the following in a new terminal window (replacing <m3u8_5000kbps_url> and <youtube_rtmp_address>):

ffmpeg -re -i <m3u8_5000kbps_url> -c:v copy -c:a aac -ar 44100 -ab 128k -ac 2 -strict -2 -flags +global_header -bsf:a aac_adtstoasc -bufsize 3000k -f flv "<youtube_rtmp_address>"

Example:

ffmpeg -re -i protocol://domain.tld/stream.m3u8 -c:v copy -c:a aac -ar 44100 -ab 128k -ac 2 -strict -2 -flags +global_header -bsf:a aac_adtstoasc -bufsize 3000k -f mp4 "rtmp://a.rtmp.youtube.com/live2/<STREAMNAME/KEY>"

Back To YouTube

Head back to your YouTube Live Event.

Click on the Live Control Room tab up top.

Click the Preview button.

The stream should take a moment to preview, then you can click the Start button.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment