High quality live broadcasting with PHP 27 07-2016

Post on 22-Jan-2018

244 views 4 download

transcript

HIGH QUALITY LIVE BROADCASTING WITH PHP

by Martin de KeijzerPHP Limburg BE - July 27, 2016

A presentation by Martin de Keijzer

ABOUT ME

Martin de KeijzerDutch 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 STREAMINGWhy and when?

A presentation by Martin de Keijzer

LIVING ON THE 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 IN THE OLD DAYS

A presentation by Martin de Keijzer

BENEFITS AND USAGES

• More followers

• Create hype

• Product presentations

• Screencasts

THE SPINNIN' HISTORYWhy the tech dept. stepped in

A presentation by Martin de Keijzer

SPINNIN' SESSIONS

Weekly premiere on Twitch

A presentation by Martin de Keijzer

THE TECHNOLOGY

A presentation by Martin de Keijzer

THE TECHNOLOGY

Ingredient 1; An MP4 file

A presentation by Martin de Keijzer

THE TECHNOLOGY

Ingredient 2: An old Windows desktop

A presentation by Martin de Keijzer

THE TECHNOLOGY

Ingredient 3: Open Broadcaster Software

A presentation by Martin de Keijzer

THE TECHNOLOGY

Ingredient 4: A human being at the controls

A presentation by Martin de Keijzer

THE TECHNOLOGY

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 BUNDLEThe path to salvation

A presentation by Martin de Keijzer

GET IT TODAY

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 IT TODAY

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

FileUrl

RTMP

Processing

Database FFMPEGOS PID's

Twitch

Facebook

Youtube

Twitch

Outputs

INSIDE THE BUNDLECreated 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

ENTITIESInput

One of File / URL or RTMP

LiveBroadcast

Title, description,Start & end time,

Stop stream when end time is reached

Channel

Facebook YouTubeTwitch

A presentation by Martin de Keijzer

INPUTFile

Local file locationFor prerecorded video

A presentation by Martin de Keijzer

INPUT

Direct url location for prerecorded video

URL

A presentation by Martin de Keijzer

INPUTRTMP(soon)

Live video input protocolGreat 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 seeif a broadcast needs to run or stop

The core command for reading input mediaand sending it to one of the output channelsFFMPEG

OSProcess list is being checked by the scheduler

to see which broadcasts from the bundle are runningand what their PID's are

A presentation by Martin de Keijzer

OUTPUTTwitch

Configurable with a stream key from the Twitchdashboard

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

OUTPUTYouTube

(in active development)

Needs to authenticate an app for doingAPI calls

A presentation by Martin de Keijzer

OUTPUTYour 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 fullsetup in a demo project which you can use to test-drive

the application

THE ROAD AHEADCurrent 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 CONCLUSIONLive broadcasting on a professional level is hard

Bandwidth may be your enemy on remote locations

Broadcasting consists of input, processing and outputTwitch and Facebook are already there, with Youtube soon to follow

More inputs will be added shortly

Spinnin' Records invested time and resources to give thisaway for free, when fixing or adding stuff a PR is much appreciated

A presentation by Martin de Keijzer

LIVE DEMO TIME?

A presentation by Martin de Keijzer

Thank you for listening,any questions?