JasonRivers / Docker-nginx-rtmp

Docker Image for RTMP streams using Nginx
181 stars 114 forks source link

Enable RTMP push to youtube / twitch / etc #4

Closed JasonRivers closed 6 years ago

JasonRivers commented 6 years ago

We need an option when starting the container to enable pushing the stream to youtube / twitch / etc.

schmic commented 6 years ago

Does not work for me when pushing to Twitch.

nginx-rtmp | nginx: [emerg] invalid port in url "https://twitch.tv/th...." in /opt/nginx/conf/nginx.conf:56

My docker-compose.yml:

version: "2"
services:
  nginx:
    image: jasonrivers/nginx-rtmp
    container_name: nginx-rtmp
    ports:
      - 1935:1935
      - 8081:8080
    environment: 
      - "RTMP_STREAM_NAMES=twitch,app,dadaurka"
      - "RTMP_PUSH_URLS=https://twitch.tv/XXX/YYY"
JasonRivers commented 6 years ago

The problem here is you're using HTTPS to push an RTMP stream, Please could you try using the RTMP protocol URL: rtmp://live.twitch.tv/app/

The URL for your stream may be different, you can find details on this here: https://help.twitch.tv/customer/portal/articles/2420572#BroadcastURLsandStreamKeys

schmic commented 6 years ago

Looks good!

/dockers/stream $ dc up
Creating network "stream_default" with the default driver
Creating stream_nginx_1
Attaching to stream_nginx_1
nginx_1  | Creating stream app
nginx_1  | Pushing stream to rtmp://live-fra.twitch.tv/app/live_XXXXXXXXXX

You should fix the example in the README then, cause it says https://...

JasonRivers commented 6 years ago

Thanks! I hadn't noticed I used the wrong URL in the README - This has been updated!