phips28 / facebook-live-video

Stream a website with phantomjs to Facebook Live via ffmpeg (video) and collect Facebook reactions
MIT License
90 stars 32 forks source link

The live video has ended. #1

Closed mmccaff closed 7 years ago

mmccaff commented 7 years ago

I just tried this. Very cool!

I am running into an issue where on starting the live stream, what I see in my feed is "This live video has ended." I tried it on a $5/mo Digital Ocean droplet, and thought maybe the server was too wimpy to keep up, so upped it to a $20/mo server but am seeing the same thing.

However when I ctrl-c to kill the node process, and refresh my feed, I'll be able to playback the historical live video that has previously said it had "ended."

A snapshot of what I see in the stream.log looks like this:

Metadata: encoder : Lavf56.40.101 Stream #0:0: Video: h264 (libx264) ([7][0][0][0] / 0x0007), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], q=-1--1, 10 fps, 1k tbn, 10 tbc Metadata: encoder : Lavc56.60.100 libx264 Stream mapping: Stream #0:0 -> #0:0 (png (native) -> h264 (libx264)) frame= 1905 fps=8.3 q=25.0 size= 695kB time=00:03:05.60 bitrate= 30.7kbits/s

Any idea what could cause this?

phips28 commented 7 years ago

Hi, afaik a lot of user see this message. Can you please check:

  1. Start stream
  2. Go to you wall and open the developer console
  3. Look for network issues

I got a 404 from FB for the video while other friends saw it :(

Best, Philipp Holly

mmccaff commented 7 years ago

Yes, I am seeing GETs from the video-iad3-1.xx.fbcdn.net domain which are 404s, followed by a 'Refused to get unsafe header "Date"' message.

Matt

phips28 commented 7 years ago

Yeah, same here. must be a facebook issue !?

mmccaff commented 7 years ago

Interesting, so it's stopped working for you also?

I've been digging into this but have kind of reached a dead end. Please let me know if you find anything, and I'll do the same.

Thanks!

Matt

mmccaff commented 7 years ago

Btw -I also wondered if it was a Facebook issue, but checked and found that plenty of other people are currently live. So if it is on their end, it's not a problem across the board.

phips28 commented 7 years ago

We should open a bugreport.

I am out of office till friday. So will check it later

phips28 commented 7 years ago

I tried to start a live video from my iPhone.

And I can see this stream on my wall but not the stream from the tool. strange.

phips28 commented 7 years ago

https://developers.facebook.com/bugs/364589023882917/ & https://developers.facebook.com/bugs/682644368552749/

mmccaff commented 7 years ago

Interesting. Let's keep an eye on those threads. Did you take any meaning from the responses other than to try increasing the frame rate?

I saw that FB recommends 30 fps. I tried changing 10 to 30 in your index.js and scraper.js, but that didn't help.

phips28 commented 7 years ago

Yes I also tried to update the framerate but the streaming stays at ~12 fps..

mmccaff commented 7 years ago

I wonder if there is an issue when streams don't have audio? Just a hunch from some of the discussion in the second link.

phips28 commented 7 years ago

@mmccaff have you tried it?

mmccaff commented 7 years ago

I didn't try including audio. I did upgrade ffmpeg to 3.2-1~16.04.york1 instead of the 2.x included in the Ubuntu 16.04 repo, but that didn't help. The fps always starts at 30, and then drops down to around 9 fps.

I also tried a whole bunch of different fmpeg parameters (setting fps with -r on both input and output, using -framerate, setting threads to 0, setting a buffer size) based on these threads, none of which helped:

http://superuser.com/questions/452542/ffmpeg-drops-frames-when-encoding-a-png-image-sequence-into-an-x264-mp4-video

https://ffmpeg.zeranoe.com/forum/viewtopic.php?t=657&start=30#p2210

https://trac.ffmpeg.org/ticket/1604

http://ubuntuhandbook.org/index.php/2016/09/install-ffmpeg-3-1-ubuntu-16-04-ppa/

https://ffmpeg.zeranoe.com/forum/viewtopic.php?f=7&t=657&sid=fc0fa365d4581cb9255fa053acc00d85&start=40

phips28 commented 7 years ago

I also tested every combination of parameter, but no success :(

necenzurat commented 7 years ago

Not using the app, but i have the same problem with ffmpeg & facebook.

HsounaZinoubi commented 7 years ago

same problem with me live video has ended

flaviolivolsi commented 7 years ago

You may take a look to my PR, which has solved the issue for me.

https://github.com/phips28/facebook-live-video/pull/2

phips28 commented 7 years ago

thx @flaviolivolsi for this fix!!!

HsounaZinoubi commented 7 years ago

now i m getting my profile picture as a video what is happen ? see https://www.facebook.com/video/embed?video_id=1163193180415264

mmccaff commented 7 years ago

Confirmed for me also that this fixed the problem. Nice work @flaviolivolsi !!