Code Monkey home page Code Monkey logo

nginx-rtmp-docker's People

Contributors

agconti avatar alejsdev avatar cesarandreslopez avatar dependabot[bot] avatar irishsmurf avatar jezztify avatar louis70109 avatar milesegan avatar nathanael-mtd avatar nicklaw5 avatar tiangolo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nginx-rtmp-docker's Issues

nginx error "host not found" while pushing to other stream services

I just started using nginx-rtmp-docker to test a self-hosted stream server, but when I try to push stream to multiple services (Twitch, facebook, youtube, ..) nginx doesn't start due to error:

nginx: [emerg] host not found in url "live.twitch.tv/app/......"

I'm aware this is something related to DNS resolving, and using a real IP the stream is correctly pushed, but I didn't found any solution to this. Is there a workaround?

Here's my nginx.conf file

worker_processes auto;
rtmp_auto_push on;
events {}



rtmp {


     server {

        listen 1935;
        listen [::]:1935 ipv6only=on;

        application live{

            live on;
            record off;
            push rtmp://live.twitch.tv/app/XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
            
}

Am I missing something?

Running on a Raspberry Pi

what needs to be done so I can run/build this container on Raspberry Pi (arm)?
Sorry for the noob question.

Error: already publishing

Hi

I am getting below error with 4G cameras streaming on rtmp
2023/09/28 14:48:46 [error] 13#13: *849 live: already publishing, client: xx.xx.xx.xx, server: 0.0.0.0:1935

Note: There are about twenty 4G cameras streaming to this rtmp server at the same time, I am not sure if this is due to the 4G network or something wrong in my nginx config. I am using the latest tiangolo/nginx-rtmp image

My docker file

FROM tiangolo/nginx-rtmp

COPY nginx.conf /etc/nginx/nginx.conf

My Nginx File

user www-data;
worker_processes auto;
rtmp_auto_push on;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;

events {
    worker_connections 4096;
    accept_mutex on;
}

rtmp {
    log_format new '[$time_local-$remote_addr]: $command:$app:$name, Args=$args, Recv=$bytes_received, Sent=$bytes_sent, url=$pageurl, flashver=$flashver,  session_readable_time=$session_readable_time, Connection=$connection';

    server {
        listen 1935;
        listen [::]:1935 ipv6only=on;
        chunk_size 4096;

        timeout 60s;
        ping 3m;
        ping_timeout 30s;

        access_log /var/log/nginx/rtmp_access.log new;
	access_log /var/log/nginx/rtmp_access.log;

        # HLS
        hls on;
        hls_path /tmp/hls;
        hls_fragment 10s; # default is 5s
        hls_playlist_length 10m; # default is 30s
        # once playlist length is reached it deletes the oldest fragments
        # hls_continuous on;

        application live {
            live on;
            record off;

            # wait_key on;
            # wait_video on;

            # drop_idle_publisher 15s;
            # idle_streams off;  

            # Auth 
            on_publish http://myserver.com/api/v1/auth;
        }
    }
}

Any help will be greatly appreciated :)

limit the diffusion via the stream keys

Hello,
Thank you for this work! It works perfectly and I love it.

However, is it possible to allow broadcasting only at certain stream keys to prevent anyone from broadcasting on the server?

If so, how can this be achieved?
thank you

Work with ECS

Can a /health endpoint get added so that this works with ECS?

HLS

Is it possible to open the HLS Feature in the RTMP module?

Contain http_ Sub_ Module module ?

The current compiled version of Nginx does not contain http_ Sub_ Module module, which can add support for sub_ The HTTP of the filter instruction_ Sub_ Module module.?

Dashjs player cannot play from .mpd

when exposing the dash .mpd index files on the server, and pointing a player at them. the player cannot load the .mpd file properly and the stream will not play
nginx.conf

...
...
# DASH files
        location /dash {
            root /tmp;
            add_header Cache-Control no-cache;
            add_header 'Access-Control-Allow-Origin' '*';
       }

    }
}
rtmp {
    server {
        listen 1935;
        chunk_size 4096;

        application dash {
          live on;
          record off;

          dash on;
          dash_nested on;
          dash_path /tmp/dash;
          dash_fragment 2;
          dash_playlist_length 10;
          dash_cleanup on;
        }
    }
}

updating to a newer version of nginx-rtmp resolves this

Executing command from directive

I want to start off with thanking you for creating this image. It was very helpful to me already.


Creating Context (optional)

Now firstly I want to sketch my use case/setup: I have a container based on the tiangolo/nginx-rtmp-docker image running on my computer (inside of Docker of course). My mobile phone streams with an app (ManyCam) to my computer. On that same computer I also have OBS running with a Media Component that plays the stream from the Docker container. This all works.

The problem that I was having was that I was streaming from my phone via my data connection and my reception was bad at some point. At that point the stream began to stutter and the video feed froze after a while but the audio just continued to work. I stopped the stream-app (ManyCam) on the phone and restarted streaming but the Media Component stayed frozen inside of OBS. To be fair, I assume this is a problem with the Media Component in OBS. But I wanted to implement the following solution to fix this problem and support more use cases that I want.

So I wanted to see if I could subscribe to certain events on the rtmp server (the tiangolo/nginx-rtmp-docker container) on my computer so I could see when a connection drops and perhaps show something else (like a "Not streaming"-image) inside of OBS.


The problem

I found that I could change the default image you supply with a custom nginx config and add some directives to it like the exec_publish and exec_push directives. I want to communicate these events to outside of my rtmp container and I thought to do this by just executing a script on one of these events that creates a connection to a webserver running locally on my computer (not in Docker atm but we could evolve to that).

First I tried to run a node webserver inside of the rtmp container by just adding this as directive:

exec_push node /data/server.js or exec_publish node /data/server.js

I have installed node inside of the image and when I attach to the shell of the container and run node /data/server.js I can access the node web server from outside of the container (I also expanded the nginx config to proxy traffic to the web server otherwise this wouldn't work of course).

But when I publish from my mobile phone to the rtmp server, the node server isn't starting up. When I create a file in that same node script, the file is created so I know the script runs.

When this was not working, I tried a python script that makes a SignalR (websocket) connection to the web server running on my computer. Same here, the connection isn't made when I publish to the rtmp server, but when I add a piece of code that creates a file inside of the python script, I see the file is created when I stream to the rtmp server, so the script is run but I can't for the life of me figure out why the connection isn't made. Are there some constraints to the process executed by the directives?

Is there some way to see logging for this, output from the commands executed by the directives, ...?

Logs of the executed command

I'd like to redirect the logs of the command run at the exec in order to see them in docker logs. I tried the following

exec_push mycommand >>/dev/stdout 2>&1;

but it's not working. Redirecting to ay other file is working. Any hint about how to solve this?

configure for audio only

Hi,
Would like to know how to enable audio only live streaming for the module. Is there a line i need to add in nginx.conf to disable ingesting video and ingesting only audio and outputting only audio?

exec directives are not working

Hi on ubuntu 20 livestream works correctly but for some reason exec directives are not working. Is there anything I am missing?

Unable to start on a mac

Container was not starting on a Mac with error:

2020/04/24 05:36:23 [emerg] 1#1: socket() [::]:1935 failed (97: Address family not supported by protocol)
nginx: [emerg] socket() [::]:1935 failed (97: Address family not supported by protocol)

(I do have an IPv6 address on my machine):

en0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
	ether <snip>
	inet6 fe80::1887:4e81:fd6b:f639%en0 prefixlen 64 secured scopeid 0x8
	inet 192.168.178.20 netmask 0xffffff00 broadcast 192.168.178.255
	inet6 2001:<snip> prefixlen 64 autoconf secured
	inet6 2001:<snip> prefixlen 64 autoconf temporary
	nd6 options=201<PERFORMNUD,DAD>
	media: autoselect
	status: active

removing the line in nginx.conf

        listen [::]:1935 ipv6only=on;    

fixed the problem for for me.

Thank you!

Lightsail - Plesk: how to tiangolo/nginx-rtmp

hi,
I install docker tiangolo/nginx-rtmp, to streamings,
not run,
now not need Unistall/remove tiangolo/nginx-rtmp in docker.
runing Plesk in instancy.

confuse port 1935/8080.

how to?
thanks,
Carlos.

RTMPS support

Facebook has depricated RTMP and is forcing RTMPS now. Would it be possible to add support for RTMPS?

References on performance and system requirements

Do you have any reference on the system requirements?

I think this would be a super good backup for some python events but I can't find a good source to check what are the expected system requirements.

Question: RTMP / RTSP

Currently im trying to push a rtmp stream (GoPro) and output a rtsp stream so i can use that with my surveillance station (Synology) is that easy to add to this docker package?

Provide arm Docker Container (arm64/v8)

Hi there, now that Docker is available for Apple's M1 chipset, a native container that runs on linux/arm64/v8 would be fantastic! Thanks for considering it.

Cheers,

David

Install ffmpeg vaapi?

Hi there

I have a question about "ffmpeg vaapi"

how can I install the Docker Container?

I'm quite new to Linux and docker containers

I would like to stream from my Synology 718+ with Intel Celeron J3455 to Twitch in 720p and 30 FPS

and if I have already read my way through correctly you need the coding "ffmpeg vaapi" because of the performance

I have nginx.conf here

would that be right?

`worker_processes auto;
rtmp_auto_push on;
events {}
rtmp {
server {
listen 1935;
listen [::]:1935 ipv6only=on;

    application live {
        live on;
        record off;
		exec ffmpeg -hwaccel vaapi -hwaccel_device /dev/dri/renderD128 -i rtmp://127.0.0.1/live -vcodec h264_vaapi -preset medium -x264opts nal-hrd=cbr:force-cfr=1:keyint=60 -r 30 -b:v 6000k -maxrate 6000k -bufsize 6000k -threads 12 -s hd720 -sws_flags spline -acodec copy -f flv rtmp://127.0.0.1/streamout;
    }

    application streamout {
       live on;
       record off;
       push rtmp://live-ber.twitch.tv/app/API;
    }

}

}
`

sorry for my bad English

many greetings from Germany

Sven

Some RTMP streams won't start - why? Can I, can we fix it?

I know this project has not received updates lately, but this is the most active related project still.

My question is: I used libnginx-mod-rtmp and I put my setup together by hand. (yeah, I know, copy-paste is hard job.) So yeah I am not using this exact repo, but I checked the Dockerfile and it's the same just a comfier solution.

Anyway. All is well. Sometimes.
But sometimes, a stream or two just won't start.

I read a lot on the topic and it seems the control message is not going through or something? I tried to debug it but I can't make heads or tails of rtmp's inner-workings. I also found various snippets, patches online but nothing helps it seems. Even worse, I test it and it just works. When I actually want to use it live? It starts failing.

Of course I check logs, but they are empty. Error logs have no errors.

How could I diagnose this? How could I fix it? It drives me nuts. Worst, I cannot even find any alternatives, new releases. The original repo is stale too. Nginx offers a paid option which costs 9 million dollars. And there are services like Restream and StreamLabs but I bet my kidney they just use the same module / setup somehow because those also fail to work sometimes.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.