High quality live broadcasting with PHP 27 07-2016
1. HIGH QUALITY LIVE BROADCASTING WITH
PHP
by Martin de Keijzer
PHP Limburg BE - July 27, 2016
2. 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
29. 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
31. A presentation by Martin de Keijzer
GET ITTODAY
composer require martin1982/live-broadcast-bundle
Just the bundle:
Still in alpha; we release early & often
32. A presentation by Martin de Keijzer
HIGH LEVEL OVERVIEW
Input
File
Url
RTMP
Processing
Database
FFMPEG
OS PID's
Twitch
Facebook
Youtube
Twitch
Outputs
34. A presentation by Martin de Keijzer
SCHEDULER
• Retrieves the LiveBroadcast entities
• Checks running broadcasts
• Decides to start/stop or leave a broadcast
alone
35. A presentation by Martin de Keijzer
I/O STREAM SERVICES
Converts the Input and Channel entities to input and output
parameters for FFMpeg
36. 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
37. A presentation by Martin de Keijzer
INPUT
File
Local file location
For prerecorded video
38. A presentation by Martin de Keijzer
INPUT
Direct url location for prerecorded video
URL
39. A presentation by Martin de Keijzer
INPUT
RTMP
(soon)
Live video input protocol
Great for broadcasting to multiple channels from
a lower bandwidth location.
41. 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
42. A presentation by Martin de Keijzer
OUTPUT
Twitch
Configurable with a stream key from theTwitch
dashboard
43. A presentation by Martin de Keijzer
OUTPUT
Needs a reviewed Facebook app to run
and allow API calls
Facebook
44. A presentation by Martin de Keijzer
OUTPUT
YouTube
(in active development)
Needs to authenticate an app for doing
API calls
45. A presentation by Martin de Keijzer
OUTPUT
Your channel
Needs to be coded by you
48. 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
50. 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
51. A presentation by Martin de Keijzer
MORE CHANNELS
YouTube Live streaming is high on the priority list.
52. A presentation by Martin de Keijzer
MORE QUALITY
Firmly tested code, good documentation and easier implementation.
53. 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