arut / nginx-rtmp-module

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

Cannot push to periscope #898

Open simonavril opened 8 years ago

simonavril commented 8 years ago

Hi,

I am trying to set up a rtmp relay to the periscope app but I can't seem to make it work. Note: the same push configuration works to other destinations like Facebook live.

I am using nginx 1.9.15 and have this module source from master.

my conf looks like:

rtmp {
    server {
        listen 1935;
        application my_app {
            live on;
            push rtmp://ca.pscp.tv:80/x/1/stream_key;
        }
    }
}

I attach the debug logs generated. Please let me know if I can help in any way to test or send you more info. nginx-rtmp.txt

matiasbenedetto commented 7 years ago

I have the same problem. The push is working ok with Facebook and Youtube, but with Periscope is not working. Streaming direct from OBS to Periscope is working ok, but streaming from OBS to NGINX pushing to Periscope not.

RADRaze2KX commented 7 years ago

have you both applied to and been approved as Periscope Publishers?

matiasbenedetto commented 7 years ago

I have been aproveed as Periscope Producer and i can stream directly with OBS to Periscope but not with OBS streaming to the nginx rtmp module and making the the push to Periscope.

voxxit commented 7 years ago

I have the same issue. Anyone figure this one out? Is it on Periscope's side?

yaxu commented 7 years ago

Same here, perhaps periscope is identifying and denying nginx connections on purpose?

jon-freed commented 7 years ago

Have you used the Periscope mobile app to both preview and then start the broadcast? If not, try that. If yes, then what does it show?

matiasbenedetto commented 7 years ago

Have you used the Periscope mobile app to both preview and then start the broadcast? If not, try that. If yes, then what does it show?

Yes i tried that, is the only way to start the broadacast whit Periscope.

jon-freed commented 7 years ago

So, "yes", apparently, so then what does it show? What are you seeing, both during the preview and then, if you can get this far, when you try to go beyond the preview to the broadcast? (Incidentally, is there some reason why you only answered "yes" and didn't respond to the "if yes, then" question?)

yaxu commented 7 years ago

I've just tried it. When I go into advanced sources, I see "checking source". When I stream to it via nginx, that does not change. Then when I stream to it directly from obs studio, it changes to 'preview broadcast'.

So there is no chance to preview when going via nginx, the app does not acknowledge that a stream is being sent.

yaxu commented 7 years ago

This is all I see in the nginx log, every few seconds (urls + ip addresses hidden..)

2017/01/22 19:26:55 [info] 16198#0: *1332 relay: create push name='yaxu' app='' playpath='' url='ie.pscp.tv:80/x/x/x', client: x.x.x.x, server: 0.0.0.0:1935
2017/01/22 19:26:55 [info] 16198#0: *1344 disconnect, client: ie.pscp.tv:80/x/x/x, server: ngx-relay
2017/01/22 19:26:55 [info] 16198#0: *1344 deleteStream, client: ie.pscp.tv:80/x/x/x, server: ngx-relay
yaxu commented 7 years ago

@jon-freed are you able to help?

mckmatter commented 7 years ago

I also have this issue. I can push to YouTube and Facebook, but when adding the push to periscope, the periscope app never changes from "checking source" as @yaxu mentioned.

acceptableEngineering commented 7 years ago

Hi everyone, I suffered from the same issue but found the for-now solution is NOT using nginx-rtmp-module to push but ffmpeg itself, which is documented as a supported encoder in the Periscope Producer PDF/instructions.

I'm doing this inside my nginx.conf's rtmp -> server block:

application test {
  live on;
  record off;
  drop_idle_publisher 5s;
  publish_notify on;

  exec ffmpeg -i rtmp://localhost/test/$name -crf 30 -preset ultrafast -acodec aac -strict experimental -ar 44100 -ac 2 -b:a 64k -vcodec libx264 -x264-params keyint=60:no-scenecut=1 -r 30 -b:v 500k -s 960x540 -f flv rtmp://va.pscp.tv:80/x/SOME_NODE/YOUR_KEY_HERE;
}

Hope this helps! It's working nicely for me.

yaxu commented 7 years ago

Thanks @markmutti. Does this work with sending to multiple services including periscope at the same time?

acceptableEngineering commented 7 years ago

@yaxu Yes, it's just a different way of doing it, using ffmpeg rather than the super-efficient relay directive of nginx-rtmp-module. You'll declare your other destinations with push like the OP did, EG:

application test {
  live on;
  record off;
  drop_idle_publisher 5s;
  publish_notify on;

  push rtmp://youtube...
  push rtmp://facebook...

  exec ffmpeg -i rtmp://localhost/test/$name -crf 30 -preset ultrafast -acodec aac -strict experimental -ar 44100 -ac 2 -b:a 64k -vcodec libx264 -x264-params keyint=60:no-scenecut=1 -r 30 -b:v 500k -s 960x540 -f flv rtmp://va.pscp.tv:80/x/SOME_NODE/YOUR_KEY_HERE;
}

I think everyone pushing to Periscope will end up having to use ffmpeg since Periscope requires some strange/sad ingestion characteristics.

mckmatter commented 7 years ago

EDIT: It turns out that nginx didn't have permission to run ffmpeg, so at first we were having some trouble getting @markmutti 's exec line to work. Our nginx is on a 'cheese grater' mac pro running El Cap 10.11.6

We gave the world permission to execute ffmpeg with:

chmod -R 755 /usr/local/bin/ffmpeg

We also needed to explicitly state the path of ffmpeg in our nginx app. So our exec line was:

exec /usr/local/bin/ffmpeg -i rtmp://localhost/live/test -crf 30 -preset ultrafast -acodec aac -strict experimental -ar 44100 -ac 2 -b:a 64k -vcodec libx264 -x264-params keyint=60:no-scenecut=1 -r 30 -b:v 500k -s 960x540 -f flv rtmp://va.pscp.tv:80/x/SOME_NODE/YOUR_KEY_HERE;

Thanks!

yonailo commented 7 years ago

Hello, I have been able to stream to periscope with this url in the push command:

push rtmp://ca.pscp.tv:80/x/stream_key;

I don't use '/1/' dans the periscope's url as you might have noticed.

yaxu commented 7 years ago

I just tried this again and although the stream shows up in the app and I can go to preview, no video shows up, and it says it has height and width of zero. It works fine when I stream directly. Closer though!

myLordJ commented 6 years ago

Hello everyone, I have tried all solutions that I found online but noting seems to work; Anyone in 07/2018 with the right working settings to Periscope? Thanks

ChildLearningClub commented 5 years ago

@myLordJ the settings that were add by @acceptableEngineering are working for me. @mckmatter suggested that you might need to put the path of the ffmpeg, but I found that just exec ffmpeg ... worked. I'm running from a docker image and here were the steps that I took, hope this might help if you are needing it still.

docker run -d -p 1935:1935 --name nginx-rtmp tiangolo/nginx-rtmp

docker exec -t -i nginx-rtmp /bin/bash

apt update

apt install nano

apt install ffmpeg

nano /etc/nginx/nginx.conf

ADD:


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

        application live {
            live on;
            record off;

            push rtmp://localhost/youtube;

            exec ffmpeg -i rtmp://your_localhost_ip/live/test -crf 30 -preset ultrafast -acodec aac -strict experimental -ar 44100 -ac 2 -b:a 64k -vcodec libx264 -x264-params keyint=60:no-scenecut=1 -r 30 -b:v 500k -s 1280x720 -f flv rtmp://jp.pscp.tv:80/x/your_stream_key;
        }

        application youtube {
            live on;
            record off;

            push rtmp://a.rtmp.youtube.com/live2/your_stream_key;
        }
    }
}

I changed "your_localhost_ip" and "your_stream_key" in the values above.

make sure to restart nginx.

also a note, I did notice that I had to start the OBS stream and then stop and restart it again before periscope would read the correct X264/AVC encoder when restarting nginx.

Zola commented 4 years ago

I have the same problem.

rtmp { server { listen 1935; chunk_size 4096; application obs{ live on; record off;

youtube push with stunnel

   push rtmp://127.0.0.1:19350/rtmp/facebook_KEY_AbzFiHTBMObvdKYA;

push rtmp://a.rtmp.youtube.com/live2/YOUTUBE_KEY; push rtmp://kr.pscp.tv:80/x/PERISCOPE_KEY/; } } }

  1. The push is working ok with Facebook and Youtube, but with Periscope is not working.
  2. Streaming direct from OBS to Periscope is working ok,
  3. but streaming from OBS to NGINX pushing to Periscope not.

I did run shell at terminal, push to Periscope works, but seems not rely with nginx

exec ffmpeg -i rtmp://127.0.0.1/obs/ -crf 30 -preset ultrafast -acodec aac -strict experimental -ar 44100 -ac 2 -b:a 64k -vcodec libx264 -x264-params keyint=60:no-scenecut=1 -r 30 -b:v 500k -s 1280x720 -f flv rtmp://jp.pscp.tv:80/x/PERISCOPE_KEY

that was my solution to stream to Twitter\youtube\facebook at same time.

anyone have better solutions?

mobizent commented 4 years ago

any update to this?

sqr commented 3 years ago

Did anyone find an alternative that doesn't require reencoding?

Is there any way to troubleshoot what might be causing the issue with Twitter?