arut / nginx-rtmp-module

NGINX-based Media Streaming Server
http://nginx-rtmp.blogspot.com
BSD 2-Clause "Simplified" License
13.45k stars 3.52k forks source link

120,000kbits Bitrate to Twitch #1315

Open h1rule opened 6 years ago

h1rule commented 6 years ago

Hello guys,

i've successfully setup my RTMP server. I would like to stream to 2 services multiple, but when i just use the default config

rtmp { server { listen 1935; chunk_size 4096; application live { live on; record off; push rtmp://eu-central.restream.io/live/re_xxx_xxxxxxxxxxxxxx; push rtmp://rtmp-pc.facebook.com:80/rtmp/xxx?s_l=2&s_ps=1&s_vt=api-pc&a=xxx; } } }

it goes up in the statistics of Twitch to 115.000 - 125.000kbit/s and gives Drops.

My OBS Settings should be fine, i've set the maximum and puffer bitrate to 6000 and if i stream to the legit rtmp servers, everything is fine!

However, i came up with using ffmpeg, but im a little bit confused in how to set this stuff up. My current nginx config looks like this:

rtmp { server { listen 1935; chunk_size 4096; application live { live on; record off; allow publish all; allow play all; push rtmp://127.0.0.1:1935/facebook; exec ffmpeg -i rtmp://127.0.0.1:1935/live/test -b:v 6000k -minrate 6000k -maxrate 6000k -bufsize 6000k -threads 1 -vcodec libx264 -acodec copy -s 1280x720 -f flv rtmp://127.0.0.1:1935/restream; } application facebook { live on; record off; push rtmp://rtmp-pc.facebook.com:80/rtmp/xxx?s_l=2&s_ps=1&s_vt=api-pc&a=xxx; } application restream { live on; record off; push rtmp://eu-central.restream.io/live/re_xxx_xxx; } } } Its not working! :(

Villar74 commented 4 years ago

I make it work with that settings, but cpu on my VPS was not enough to do encoding(

exec ffmpeg -re -i rtmp://localhost:1935/$app/$name -vcodec libx264 -b:v 6000k -minrate 6000k
                                -maxrate 6000k -bufsize 12000k -threads 0 -ac 2 -pix_fmt yuv420p -preset "ultrafast" -acodec aac
                                -ar 44100 -f flv rtmp://localhost:1935/small/${name};

-pix_fmt yuv420p this parameter is important for twitch