HIGH QUALITY LIVE BROADCASTING WITH
PHP
by Martin de Keijzer
PHP Limburg BE - July 27, 2016
A presentation by Martin de Keijzer
ABOUT ME
Martin de Keijzer
Dutch web developer
Working @ Spinnin' Records
PHPBenelux Board Member
@Martin1982
http://www.martindekeijzer.nl
A presentation by Martin de Keijzer
We digital
A presentation by Martin de Keijzer
TODAY
LIVE STREAMING
Why and when?
A presentation by Martin de Keijzer
LIVING ONTHE EDGE
Live streaming is all about bringing the latest and greatest
A presentation by Martin de Keijzer
VIRTUAL PRESENCE
A presentation by Martin de Keijzer
DIRECT FEEDBACK
Every modern live streaming service has a chat for direct feedback
A presentation by Martin de Keijzer
LIKE INTHE OLD DAYS
A presentation by Martin de Keijzer
BENEFITS AND USAGES
• More followers
• Create hype
• Product presentations
• Screencasts
THE SPINNIN' HISTORY
Why the tech dept. stepped in
A presentation by Martin de Keijzer
SPINNIN' SESSIONS
Weekly premiere onTwitch
A presentation by Martin de Keijzer
THETECHNOLOGY
A presentation by Martin de Keijzer
THETECHNOLOGY
Ingredient 1;An MP4 file
A presentation by Martin de Keijzer
THETECHNOLOGY
Ingredient 2:An old Windows desktop
A presentation by Martin de Keijzer
THETECHNOLOGY
Ingredient 3: Open Broadcaster Software
A presentation by Martin de Keijzer
THETECHNOLOGY
Ingredient 4:A human being at the controls
A presentation by Martin de Keijzer
THETECHNOLOGY
What could possibly go wrong?
A presentation by Martin de Keijzer
THE RESULT
A presentation by Martin de Keijzer
THE RESULT
The good: People were eager to hear the radio show early
A presentation by Martin de Keijzer
THE RESULT
The bad: We were struggling with technology to deliver on time
A presentation by Martin de Keijzer
THE RESULT
The ugly: Jenny got frustrated by technology issues and viewers
start complaining in chat
A presentation by Martin de Keijzer
OTHER COMPLICATIONS
Bandwidth when sending a stream to multiple social networks
A presentation by Martin de Keijzer
OTHER COMPLICATIONS
Power outages
A presentation by Martin de Keijzer
OTHER COMPLICATIONS
Technical knowledge about accepted stream settings
A presentation by Martin de Keijzer
OTHER COMPLICATIONS
Manually starting streams for timezone targeting
LIVE BROADCAST BUNDLE
The path to salvation
A presentation by Martin de Keijzer
GET ITTODAY
Demo project:
git clone git@github.com:Martin1982/live-broadcast-demo.git
Runs with SQLite / Local php server
A presentation by Martin de Keijzer
SUPPORT
A presentation by Martin de Keijzer
GET ITTODAY
composer require martin1982/live-broadcast-bundle
Just the bundle:
Still in alpha; we release early & often
A presentation by Martin de Keijzer
HIGH LEVEL OVERVIEW
Input



File
Url
RTMP
Processing


Database
FFMPEG
OS PID's
Twitch
Facebook
Youtube
Twitch
Outputs
INSIDETHE BUNDLE
Created for extensibility
A presentation by Martin de Keijzer
SCHEDULER
• Retrieves the LiveBroadcast entities
• Checks running broadcasts
• Decides to start/stop or leave a broadcast
alone
A presentation by Martin de Keijzer
I/O STREAM SERVICES
Converts the Input and Channel entities to input and output
parameters for FFMpeg
A presentation by Martin de Keijzer
ENTITIES
Input
One of File / URL or RTMP
LiveBroadcast
Title, description,

Start & end time,
Stop stream when end time is reached
Channel
Facebook
YouTube
Twitch
A presentation by Martin de Keijzer
INPUT
File
Local file location
For prerecorded video
A presentation by Martin de Keijzer
INPUT
Direct url location for prerecorded video
URL
A presentation by Martin de Keijzer
INPUT
RTMP

(soon)
Live video input protocol
Great for broadcasting to multiple channels from
a lower bandwidth location.
A presentation by Martin de Keijzer
INPUT DEEP-DIVE
A presentation by Martin de Keijzer
PROCESSING
Database
Is being visited by the scheduler to see
if a broadcast needs to run or stop
The core command for reading input media
and sending it to one of the output channels
FFMPEG
OS
Process list is being checked by the scheduler
to see which broadcasts from the bundle are running
and what their PID's are
A presentation by Martin de Keijzer
OUTPUT
Twitch
Configurable with a stream key from theTwitch
dashboard
A presentation by Martin de Keijzer
OUTPUT
Needs a reviewed Facebook app to run
and allow API calls
Facebook
A presentation by Martin de Keijzer
OUTPUT
YouTube
(in active development)
Needs to authenticate an app for doing
API calls
A presentation by Martin de Keijzer
OUTPUT
Your channel
Needs to be coded by you
A presentation by Martin de Keijzer
OUTPUT ENTITY
A presentation by Martin de Keijzer
OUTPUT SERVICE
A presentation by Martin de Keijzer
BONUS:ADMIN
Spinnin' uses Sonata, so we added it as a bonus and a full
setup in a demo project which you can use to test-drive
the application
THE ROAD AHEAD
Current and future goals
A presentation by Martin de Keijzer
MORE INPUTS
Mainly RTMP, as easy and functional as possible
Ideas are going around to combine graphic layers to a single
video stream output
A presentation by Martin de Keijzer
MORE CHANNELS
YouTube Live streaming is high on the priority list.
A presentation by Martin de Keijzer
MORE QUALITY
Firmly tested code, good documentation and easier implementation.
A presentation by Martin de Keijzer
IN CONCLUSION
Live broadcasting on a professional level is hard
Bandwidth may be your enemy on remote locations
Broadcasting consists of input, processing and output
Twitch and Facebook are already there, withYoutube soon to follow
More inputs will be added shortly
Spinnin' Records invested time and resources to give this
away for free, when fixing or adding stuff a PR is much appreciated
A presentation by Martin de Keijzer
LIVE DEMOTIME?
A presentation by Martin de Keijzer
Thank you for listening,
any questions?

High quality live broadcasting with PHP 27 07-2016

  • 1.
    HIGH QUALITY LIVEBROADCASTING WITH PHP by Martin de Keijzer PHP Limburg BE - July 27, 2016
  • 2.
    A presentation byMartin de Keijzer ABOUT ME Martin de Keijzer Dutch web developer Working @ Spinnin' Records PHPBenelux Board Member @Martin1982 http://www.martindekeijzer.nl
  • 4.
    A presentation byMartin de Keijzer We digital
  • 5.
    A presentation byMartin de Keijzer TODAY
  • 6.
  • 7.
    A presentation byMartin de Keijzer LIVING ONTHE EDGE Live streaming is all about bringing the latest and greatest
  • 8.
    A presentation byMartin de Keijzer VIRTUAL PRESENCE
  • 9.
    A presentation byMartin de Keijzer DIRECT FEEDBACK Every modern live streaming service has a chat for direct feedback
  • 10.
    A presentation byMartin de Keijzer LIKE INTHE OLD DAYS
  • 11.
    A presentation byMartin de Keijzer BENEFITS AND USAGES • More followers • Create hype • Product presentations • Screencasts
  • 12.
    THE SPINNIN' HISTORY Whythe tech dept. stepped in
  • 13.
    A presentation byMartin de Keijzer SPINNIN' SESSIONS Weekly premiere onTwitch
  • 14.
    A presentation byMartin de Keijzer THETECHNOLOGY
  • 15.
    A presentation byMartin de Keijzer THETECHNOLOGY Ingredient 1;An MP4 file
  • 16.
    A presentation byMartin de Keijzer THETECHNOLOGY Ingredient 2:An old Windows desktop
  • 17.
    A presentation byMartin de Keijzer THETECHNOLOGY Ingredient 3: Open Broadcaster Software
  • 18.
    A presentation byMartin de Keijzer THETECHNOLOGY Ingredient 4:A human being at the controls
  • 19.
    A presentation byMartin de Keijzer THETECHNOLOGY What could possibly go wrong?
  • 20.
    A presentation byMartin de Keijzer THE RESULT
  • 21.
    A presentation byMartin de Keijzer THE RESULT The good: People were eager to hear the radio show early
  • 22.
    A presentation byMartin de Keijzer THE RESULT The bad: We were struggling with technology to deliver on time
  • 23.
    A presentation byMartin de Keijzer THE RESULT The ugly: Jenny got frustrated by technology issues and viewers start complaining in chat
  • 24.
    A presentation byMartin de Keijzer OTHER COMPLICATIONS Bandwidth when sending a stream to multiple social networks
  • 25.
    A presentation byMartin de Keijzer OTHER COMPLICATIONS Power outages
  • 26.
    A presentation byMartin de Keijzer OTHER COMPLICATIONS Technical knowledge about accepted stream settings
  • 27.
    A presentation byMartin de Keijzer OTHER COMPLICATIONS Manually starting streams for timezone targeting
  • 28.
    LIVE BROADCAST BUNDLE Thepath to salvation
  • 29.
    A presentation byMartin de Keijzer GET ITTODAY Demo project: git clone git@github.com:Martin1982/live-broadcast-demo.git Runs with SQLite / Local php server
  • 30.
    A presentation byMartin de Keijzer SUPPORT
  • 31.
    A presentation byMartin de Keijzer GET ITTODAY composer require martin1982/live-broadcast-bundle Just the bundle: Still in alpha; we release early & often
  • 32.
    A presentation byMartin de Keijzer HIGH LEVEL OVERVIEW Input
 
 File Url RTMP Processing 
 Database FFMPEG OS PID's Twitch Facebook Youtube Twitch Outputs
  • 33.
  • 34.
    A presentation byMartin de Keijzer SCHEDULER • Retrieves the LiveBroadcast entities • Checks running broadcasts • Decides to start/stop or leave a broadcast alone
  • 35.
    A presentation byMartin de Keijzer I/O STREAM SERVICES Converts the Input and Channel entities to input and output parameters for FFMpeg
  • 36.
    A presentation byMartin de Keijzer ENTITIES Input One of File / URL or RTMP LiveBroadcast Title, description,
 Start & end time, Stop stream when end time is reached Channel Facebook YouTube Twitch
  • 37.
    A presentation byMartin de Keijzer INPUT File Local file location For prerecorded video
  • 38.
    A presentation byMartin de Keijzer INPUT Direct url location for prerecorded video URL
  • 39.
    A presentation byMartin de Keijzer INPUT RTMP
 (soon) Live video input protocol Great for broadcasting to multiple channels from a lower bandwidth location.
  • 40.
    A presentation byMartin de Keijzer INPUT DEEP-DIVE
  • 41.
    A presentation byMartin de Keijzer PROCESSING Database Is being visited by the scheduler to see if a broadcast needs to run or stop The core command for reading input media and sending it to one of the output channels FFMPEG OS Process list is being checked by the scheduler to see which broadcasts from the bundle are running and what their PID's are
  • 42.
    A presentation byMartin de Keijzer OUTPUT Twitch Configurable with a stream key from theTwitch dashboard
  • 43.
    A presentation byMartin de Keijzer OUTPUT Needs a reviewed Facebook app to run and allow API calls Facebook
  • 44.
    A presentation byMartin de Keijzer OUTPUT YouTube (in active development) Needs to authenticate an app for doing API calls
  • 45.
    A presentation byMartin de Keijzer OUTPUT Your channel Needs to be coded by you
  • 46.
    A presentation byMartin de Keijzer OUTPUT ENTITY
  • 47.
    A presentation byMartin de Keijzer OUTPUT SERVICE
  • 48.
    A presentation byMartin de Keijzer BONUS:ADMIN Spinnin' uses Sonata, so we added it as a bonus and a full setup in a demo project which you can use to test-drive the application
  • 49.
    THE ROAD AHEAD Currentand future goals
  • 50.
    A presentation byMartin de Keijzer MORE INPUTS Mainly RTMP, as easy and functional as possible Ideas are going around to combine graphic layers to a single video stream output
  • 51.
    A presentation byMartin de Keijzer MORE CHANNELS YouTube Live streaming is high on the priority list.
  • 52.
    A presentation byMartin de Keijzer MORE QUALITY Firmly tested code, good documentation and easier implementation.
  • 53.
    A presentation byMartin de Keijzer IN CONCLUSION Live broadcasting on a professional level is hard Bandwidth may be your enemy on remote locations Broadcasting consists of input, processing and output Twitch and Facebook are already there, withYoutube soon to follow More inputs will be added shortly Spinnin' Records invested time and resources to give this away for free, when fixing or adding stuff a PR is much appreciated
  • 54.
    A presentation byMartin de Keijzer LIVE DEMOTIME?
  • 55.
    A presentation byMartin de Keijzer Thank you for listening, any questions?