Javascript FFMPEG Project to Live Stream to Facebook Live Using PhantomJS in Browser Using HTML5




Stream a website with phantomjs to Facebook Live via ffmpeg (video) and collect Facebook reactions


Overview: API Doc:

If you need help with the setup or if you want to use it for commercial please text me


I installed everything on Ubuntu 16.04, for other versions check docs how to install.



Install latest NodeJS on your server – you can do it 😉


I used the self-contained binary. Check


  1. Create Facebook App (if you dont already have one) >> FB App
  2. Get Facebook User Access Token with this app and your user >> Explorer Important: User needs publish_actions permission
  3. Go to your cli and type in:

It creates a Live Video (via FB API) and streams the index.html inside the /website folder. Modify this files for your needs. 😉

The video is set to privacy:SELF, only you can see it.

Check your Facebook wall. 😉


Go to src/index.js and checkout the function start() there is another function call:

modify the options object to configure your stream see: for possible parameters.

Privacy parameter:

Customize your own settings. You can find privacy settings here: (search for privacy)

Modify the files in /website how you like. You can also stream another website by changing the url in the index.js file


If you have problems with your installation, check the stream.log:

If you just want to fake increase the reaction counter use :

It will increase the numbers every 2 sec by a random number.

If your phantomjs script stuck (sometimes it doesnt stop after a ctrl + c) use to kill every process:

FB API wrapper – /src/fb.js

I build a little wrapper for the FB API in /src/fb.js which is also available from the cli.


  •  keep ffmpeg stream at 30 fps
  •  configure streaming video with cli params, e.g. stringified JSON
  •  stop process after ~4h (max. fb live video length)
  •  kill phantomjs process properly after the stream ends or main process exits
  •  optimize quality (ffmpeg)




Leave a Reply