rtmp {
server {
listen 1935;
chunk_size 4096;
application transcode {
live on;
record off;
exec ffmpeg -re -i rtmp://localhost:1935/trans/$name -vcodec libx264 -preset medium -x264opts nal-hrd=cbr:force-cfr=1:keyint=60 -r 30 -b:v 2000k -maxrate 2000k -bufsize 2000k -threads 12 -s hd720 -sws_flags spline -acodec copy -f flv rtmp://localhost:1935/live/${name};
}
application live {
live on;
record off;
push rtmp://live-dfw.twitch.tv/app/live_53394267_blahblah;
}
}
}
rtmp {
server {
listen 1935;
chunk_size 4000;
application transcode {
live on;
record off;
exec ffmpeg -re -i rtmp://localhost:1935/trans/test -vcodec libx264 -preset fast -x264opts nal-hrd=cbr:force-cfr=1:keyint=120 -r 60 -b:v 3000k -maxrate 3000k -bufsize 3000k -threads 12 -s hd720 -sws_flags spline -acodec copy -f flv rtmp://localhost:1935/live/test;
}
application live {
live on;
record off;
push rtmp://live-ams.twitch.tv/app/(streameditedout);
}
}
rtmp {
server {
listen 1935;
chunk_size 4096;
application live {
live on;
record off;
}
}
}
Jack0r said:chunk_size 4000 -> I normally use 8192
-re -> I so far never used because of its description in the manual:
"Should not be used with actual grab devices or live input streams (where it can cause packet loss)."
-threads 12 -> is normally not necessary and could cause bad load, maybe remove that
I tested quickly with your chunksize and -re but could not produce any stutter, so I would try removing -threads and checking your cpu usage on the linux machine. On the commandline "top" is a good system monitor, or you boot into a desktopmanager if you can and check with the normal system monitor :)
You can also check the ffmpeg commando by hand, remove it from the config for a bit and start it yourself using the commandline. see if it throws any errors.
#user nobody;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
#access_log logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root html;
index index.html index.htm;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
# another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
# listen 8000;
# listen somename:8080;
# server_name somename alias another.alias;
# location / {
# root html;
# index index.html index.htm;
# }
#}
# HTTPS server
#
#server {
# listen 443;
# server_name localhost;
# ssl on;
# ssl_certificate cert.pem;
# ssl_certificate_key cert.key;
# ssl_session_timeout 5m;
# ssl_protocols SSLv2 SSLv3 TLSv1;
# ssl_ciphers HIGH:!aNULL:!MD5;
# ssl_prefer_server_ciphers on;
# location / {
# root html;
# index index.html index.htm;
# }
#}
}
rtmp {
server {
listen 1935;
chunk_size 8192;
application transcode {
live on;
record off;
exec ffmpeg -i rtmp://localhost:1935/trans/test -vcodec libx264 -preset medium -x264opts nal-hrd=cbr:force-cfr=1:keyint=60 -r 30 -b:v 2000k -maxrate 2000k -bufsize 2000k -s hd720 -sws_flags spline -acodec copy -f flv rtmp://localhost:1935/live/test;
}
application live {
live on;
record off;
push rtmp://live-lhr.twitch.tv/app/streamkey;
}
}
}
Jack0r said:Yea I just tested on a fresh ubuntu installation, with the deprecated ffmpeg it will not work. I quickly tested it with the static release which you can download of the ffmpeg page and that will work just fine.
gauss5546 said:So if I'm understanding this correctly I can use OBS to capture one PC and send that stream to my second PC which is running the virtualbox which has my RTMP server on it and from there I can encode on the second PC and upload to my favorite streaming website.
Is that correct?
worker_processes 1;
error_log logs/error.log;
events {
worker_connections 1024;
}
rtmp {
server {
listen 1935;
chunk_size 4096;
application transcode {
live on;
record off;
exec avconv -i rtmp://localhost:1935/transcode/stream -c:v libx264 -x264opts keyint=120:min-keyint=120 -preset medium -r 60 -b:v 3500k -minrate 3500k -maxrate 3500k -bufsize 3500k -s 1280x720 -c:a copy -f flv rtmp://localhost:1935/live2/anykey;
}
application live2 {
live on;
record off;
push rtmp://live-dfw.twitch.tv/app/live_1234567890;
}
}
}
worker_processes 1;
error_log logs/error.log;
events {
worker_connections 1024;
}
rtmp {
server {
listen 1935;
chunk_size 8192;
application transcode {
live on;
record off;
exec /home/myuser/ffmpeg_static/ffmpeg-2.1.3-64bit-static/ffmpeg -i rtmp://localhost:1935/transcode/stream -vcodec libx264 -preset medium -x264opts nal-hrd=cbr:force-cfr=1:keyint=120 -r 60 -b:v 3500k -minrate 3500k -maxrate 3500k -bufsize 3500k -threads 6 -s 1280x720 -sws_flags spline -acodec copy -f flv rtmp://localhost:1935/live/anykey;
}
application live {
live on;
record off;
push rtmp://live-dfw.twitch.tv/app/live_312345;
}
}
}
nrw2000 said:-s hd720. Resolution of target video. Also you can use following syntax: -s 1280x720. Video quality will be better in case you use downscaling by ffmpeg instead of first PS, because quicksync add too much sharpness into downscaled video. Remove this option in case you are streaming in 1080p.