Drupal, NetFlix, & Chill: Adaptive Bitrate Video Streaming · Finishing Touches Taking care of all...

25
Drupal, NetFlix, & Chill: Adaptive Bitrate Video Streaming Stephen Barker, Digital Frontiers Media, Inc. Dave Kopecek, Aisle 8, Inc. 1

Transcript of Drupal, NetFlix, & Chill: Adaptive Bitrate Video Streaming · Finishing Touches Taking care of all...

Page 1: Drupal, NetFlix, & Chill: Adaptive Bitrate Video Streaming · Finishing Touches Taking care of all existing files. • Bulk upload all files from Drupal files directory to S3 •

Drupal, NetFlix, & Chill: Adaptive Bitrate Video StreamingStephen Barker, Digital Frontiers Media, Inc. Dave Kopecek, Aisle 8, Inc.

1

Page 2: Drupal, NetFlix, & Chill: Adaptive Bitrate Video Streaming · Finishing Touches Taking care of all existing files. • Bulk upload all files from Drupal files directory to S3 •

The Problem

Existing Site 400 HD videos Slow video loading/buffering/playback latency (10-11 seconds average; sometimes up to 30 seconds!) Stuttering video playback Web server disk space being exhausted Budget Two-Pronged Issue of User Experience (stutter) v. Site Maintainability

2

Page 3: Drupal, NetFlix, & Chill: Adaptive Bitrate Video Streaming · Finishing Touches Taking care of all existing files. • Bulk upload all files from Drupal files directory to S3 •

Does NetFlix hate you?

3Image: cnet.com

Page 4: Drupal, NetFlix, & Chill: Adaptive Bitrate Video Streaming · Finishing Touches Taking care of all existing files. • Bulk upload all files from Drupal files directory to S3 •

Adaptive Bitrate Streaming

4Image: encoding.com

Page 5: Drupal, NetFlix, & Chill: Adaptive Bitrate Video Streaming · Finishing Touches Taking care of all existing files. • Bulk upload all files from Drupal files directory to S3 •

HLS Video File Structure

5Image: apple.com

Page 6: Drupal, NetFlix, & Chill: Adaptive Bitrate Video Streaming · Finishing Touches Taking care of all existing files. • Bulk upload all files from Drupal files directory to S3 •

Stutter Solution: Amazon Elastic Transcoder

6

Page 7: Drupal, NetFlix, & Chill: Adaptive Bitrate Video Streaming · Finishing Touches Taking care of all existing files. • Bulk upload all files from Drupal files directory to S3 •

Transcoder Workflow

7

Page 8: Drupal, NetFlix, & Chill: Adaptive Bitrate Video Streaming · Finishing Touches Taking care of all existing files. • Bulk upload all files from Drupal files directory to S3 •

AWS Elastic Transcoder HLS Presets

8

Page 9: Drupal, NetFlix, & Chill: Adaptive Bitrate Video Streaming · Finishing Touches Taking care of all existing files. • Bulk upload all files from Drupal files directory to S3 •

Pipelines and Jobs

9

Page 10: Drupal, NetFlix, & Chill: Adaptive Bitrate Video Streaming · Finishing Touches Taking care of all existing files. • Bulk upload all files from Drupal files directory to S3 •

AmazonS3 Events

10

Page 11: Drupal, NetFlix, & Chill: Adaptive Bitrate Video Streaming · Finishing Touches Taking care of all existing files. • Bulk upload all files from Drupal files directory to S3 •

AWS Lambda

11

Page 12: Drupal, NetFlix, & Chill: Adaptive Bitrate Video Streaming · Finishing Touches Taking care of all existing files. • Bulk upload all files from Drupal files directory to S3 •

Node.js Lambda Function

12

Page 13: Drupal, NetFlix, & Chill: Adaptive Bitrate Video Streaming · Finishing Touches Taking care of all existing files. • Bulk upload all files from Drupal files directory to S3 •

Lambda Initiated HLS Files

13

Page 14: Drupal, NetFlix, & Chill: Adaptive Bitrate Video Streaming · Finishing Touches Taking care of all existing files. • Bulk upload all files from Drupal files directory to S3 •

Standard Drupal File Handling

14

Page 15: Drupal, NetFlix, & Chill: Adaptive Bitrate Video Streaming · Finishing Touches Taking care of all existing files. • Bulk upload all files from Drupal files directory to S3 •

AmazonS3 Module

15

Page 16: Drupal, NetFlix, & Chill: Adaptive Bitrate Video Streaming · Finishing Touches Taking care of all existing files. • Bulk upload all files from Drupal files directory to S3 •

AmazonS3 CORS Upload Module

16

Page 17: Drupal, NetFlix, & Chill: Adaptive Bitrate Video Streaming · Finishing Touches Taking care of all existing files. • Bulk upload all files from Drupal files directory to S3 •

Tying It All Together

17

Page 18: Drupal, NetFlix, & Chill: Adaptive Bitrate Video Streaming · Finishing Touches Taking care of all existing files. • Bulk upload all files from Drupal files directory to S3 •

CloudFront CDN Setup in Minutes

18

Page 19: Drupal, NetFlix, & Chill: Adaptive Bitrate Video Streaming · Finishing Touches Taking care of all existing files. • Bulk upload all files from Drupal files directory to S3 •

Two URL Issues

19

Page 20: Drupal, NetFlix, & Chill: Adaptive Bitrate Video Streaming · Finishing Touches Taking care of all existing files. • Bulk upload all files from Drupal files directory to S3 •

hook_file_url_alter

20

Page 21: Drupal, NetFlix, & Chill: Adaptive Bitrate Video Streaming · Finishing Touches Taking care of all existing files. • Bulk upload all files from Drupal files directory to S3 •

hook_file_url_alter (cont.)

21

Page 22: Drupal, NetFlix, & Chill: Adaptive Bitrate Video Streaming · Finishing Touches Taking care of all existing files. • Bulk upload all files from Drupal files directory to S3 •

Finishing TouchesTaking care of all existing files.

• Bulk upload all files from Drupal files directory to S3

• UPDATE file_managed SET uri = REPLACE(uri, 'public', 's3') WHERE INSTR(filemime, 'video') > 0;

22

Lambda cleanup functions.

• If Elastic Transcoder is succesful, then move original mp4 to an Archive bucket.

• If Elastic Transcoder fails send Amazon SNS push notification

Page 23: Drupal, NetFlix, & Chill: Adaptive Bitrate Video Streaming · Finishing Touches Taking care of all existing files. • Bulk upload all files from Drupal files directory to S3 •

Results

23

Page 24: Drupal, NetFlix, & Chill: Adaptive Bitrate Video Streaming · Finishing Touches Taking care of all existing files. • Bulk upload all files from Drupal files directory to S3 •

Results

Both New and Existing Videos now served via fast Amazon CloudFront CDN! End User Experience - No stuttering video playback or video stoppage! Maintainer Experience - No change from standard Drupal node creation. Single video upload. ZERO web server disk space used and nearly infinite S3 expandability! Super cheap and easy to maintain!

24

Page 25: Drupal, NetFlix, & Chill: Adaptive Bitrate Video Streaming · Finishing Touches Taking care of all existing files. • Bulk upload all files from Drupal files directory to S3 •

Stephen [email protected] https://twitter.com/DigitalFrontier

25

Dave [email protected] https://twitter.com/davekopecek