Skip to content

Instantly share code, notes, and snippets.

@yosemitebandit
Last active November 27, 2016 09:41
Show Gist options
  • Save yosemitebandit/c17db9fbc7dc908cb61a4e34d51ae791 to your computer and use it in GitHub Desktop.
Save yosemitebandit/c17db9fbc7dc908cb61a4e34d51ae791 to your computer and use it in GitHub Desktop.
live streaming notes

youtube

  • create an event and setup custom ingestion so you get an rtmp url, then use something like to stream from a mac's webcam:
ffmpeg -f avfoundation -i "default" -re -ar 44100 -ac 2 -acodec pcm_s16le -f s16le -ac 2 -i /dev/zero -f h264 -acodec aac -ab 128k -g 50 -strict experimental -f flv -s 426x240 "<rtmp_path>/<stream_id>"

zencoder

  • setup a bucket that's CORS-capable as per these docs
  • setup gcs keys as per their docs and then send a request ala:
{
    "live_stream": true,
    "region": "us-central-gce",
    "output": [
        {
            "label": "livestream-name",
            "size": "480x270",
            "video_bitrate": 300,
            "url": "gcs://some-bucket",
            "credentials": "credentials-nickname-in-zencoder",
            "type": "segmented",
            "live_stream": true,
            "headers":{
                "x-goog-acl": "public-read"
            }
        }
    ]
}

this responds with rtmp info, you can then make stream from a mac's webcam:

ffmpeg -f avfoundation -i "default" -s 284x164 -vcodec libx264 -preset ultrafast -tune stillimage -f flv <zencoder-rtmp-path>/<zencoder-key>

bitmovin

  • they have a nice tutorial but you need a paid plan to try it out

on efficiency

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