SlideShare a Scribd company logo
1 of 115
Download to read offline
Serverless 

Media Workflow
Speaker
• Serverless Lover 

• Software Engineer @ Vingle

• Freelancer Software Engineer
@ Artistscard

• Software Engineer @
Law&Company

• https://github.com/mooyoul

• https://mooyoul.github.io
A journey to

Video Service 🎥
Video is becoming 

the most important content

🔥🔥🔥
Let’s add video feature
on Vingle! 😎
…but how?
Common VOD
workflow
Common Video workflow
Common Video workflow
Common Video workflow
Common Video workflow
Building Ingest block
Ingest Step Requirements
• Support File-based workflow only for now

• Simple upload workflow for clients

• Fast upload speeds anywhere in the world

• Durable, scalable, fast storage

• No additional disk storage required for upload

• No maintenance required
Ingest Step Requirements
• Support File-based workflow only for now

• Simple upload workflow for clients

• Fast upload speeds anywhere in the world

• Durable, scalable, fast storage

• No additional disk storage required for upload

• No maintenance required
S3 Upload using pre-signed
URL
• Allows client can upload
directly to S3 using pre-
signed URL

• AWS-SDK supports pre-
signed url generation
S3 Upload using pre-signed
URL
…but we are using 

us-east-1 region
some regional ISPs have
bandwidth issue on
international network transfer 💩
Slow Upload on some ISPs
Upload speed is so
slow!🐢🐢🐢
Submarine cables 

in South Korea
Submarine cables 

in South Korea
Two options to
accelerate S3 transfer 🚀
Two options to accelerate S3 transfer
• Proxy file transfer traffic through CloudFront

• Cloudfront can accelerate dynamic content

• Uses Cloudfront Edge locations to optimize route path

• Enable S3 Transfer Acceleration

• Takes advantage of CloudFront’s globally distributed
edge locations

• More transfer optimizations
S3 Transfer Acceleration is faster than Cloudfront as
Proxy
S3 Transfer Acceleration makes throughput
faster
Ingest block architecture
Problem solved! ✅
Building Processing
block
Processing Requirements
• use fully-managed service if possible

• scalable, reliable

• adaptive bitrate streaming

• Important: compatible with various platforms, devices

• Desktop Web - IE 10+, Edge, Chrome, Firefox

• Mobile Web - Mobile Safari, Chrome Mobie

• Android - 4.1 ICS+

• iOS - 9+

• Most Important: Delivery video to users ASAP
Wait! 

What is Adaptive Bitrate
Streaming?
Adaptive Bitrate Streaming
• From Wikipedia:

• Adaptive bitrate streaming is a technique used in
streaming multimedia over computer networks. 

• It works by detecting a user's bandwidth and
CPU capacity in real time and adjusting the
quality of a video stream accordingly.
• The result: very little buffering, fast start time and a
good experience for both high-end and low-end
connections.
Adaptive Bitrate Streaming
Choosing 

Streaming Protocol
Choosing Streaming
Protocol
• Non-HTTP based protocols like RTMP are not in our interest

• Looked for HTTP-based protocols, or methods

• Progressive Download Single File via HTTP

• 1st request: Range: 0-255

• 2st request: Range: 256-511

• 3rd request: Range: 512-767

• …

• Apple HLS

• MPEG-DASH
Choosing Streaming
Protocol
• Progressive Download Single File via HTTP

• Apple HLS

• MPEG-DASH
Choosing Streaming
Protocol
• Progressive Download Single File via HTTP

• Apple HLS - Winner!
• MPEG-DASH
Why we choose HLS
Progressive Download

Single File via HTTP
• Pros

• Easy to implement

• Cons

• Implementing Adaptive Bitrate Streaming is so hard (almost
impossible) without getting “choppy” frames, or “pop” gap
sound between streams

• Slow seeking/starting since container requires metadata reading

• Large binary can occur lower cache hit

• No Live Stream compatibility
MPEG-DASH
• Pros

• New standard

• Based on Fragmented MPEG4 (similar to MPEG2 Transport Stream on
HLS)

• Broader codec support

• Cons

• IMO it is not production ready

• Market, Platform, Community support is not good at this moment

• Workflow was unstable during experiment
First Video
Specification
First Spec - Protocol
• HTTP Live Stream (HLS)

• Apple invented standard, natively supported on macOS/iOS/tvOS

• Natively supports adaptive bitrate streaming, Live Streaming, and DRM
(Apple FairPlay)

• Based on HTTP Protocol, Play well with transitional HTTP CDN

• Trusted by many providers, Many stable implementations

• Amazon, Youtube, Facebook, Twitter, Vimeo, Twitch, Akamai, New
York Times, FOX TV, TED, VK, POOQ, SK Broadband TV …

• Android - ExoPlayer

• Web - MediaSource Extension is standard spec, HLS.js, Video.js
First Spec - Input
• No codec limitation of input source



… but expects most input source are H.264/AVC
+ AAC based

• Max acceptable resolution: 1080p

• Max acceptable bitrate: 10Mbps

• Max acceptable duration: 5 minutes
First Spec - Output
• Common

• H.264/AVC1 + AAC LC

• Many graphic chipset supports hardware accelerated decoding

• Most popular codec in market

• Apple HLS

• Three variants for adaptive bitrate streaming

• High Quality: Up to 1080p, 60p, High/4.1, 4Mbps

• Medium Quality: Up to 720p, 30p, Main/4.0, 2Mbps

• Low Quality: Up to 480p, 30p, Baseline/3.1 800kbps

• Progressive Download Single File via HTTP for HLS fallback

• Medium Quality only
First Spec - Output
• 4 Outputs

• HLS HQ

• HLS MQ

• HLS LQ

• HTTP Progressive MP4 MQ
Check requirements
Requirements
• use fully-managed service if possible

• scalable, reliable

• adaptive bitrate streaming

• Important: compatible with various platforms, devices

• Desktop Web - IE 10+, Edge, Chrome, Firefox

• Mobile Web - Mobile Safari, Chrome Mobie

• Android - 4.1 ICS+

• iOS - 9+

• Important: Delivery video to users ASAP
Requirements
• use fully-managed service if possible

• scalable, reliable

• adaptive bitrate streaming

• Important: compatible with various platforms, devices

• Desktop Web - IE 10+, Edge, Chrome, Firefox

• Mobile Web - Mobile Safari, Chrome Mobie

• Android - 4.1 ICS+

• iOS - 9+

• Important: Delivery video to users ASAP
Requirements
• use fully-managed service if possible

• scalable, reliable

• Important: Delivery video to users ASAP
AWS provides bunch
of media products 🎉
Video Encoding Products
• AWS Elastic Transcoder

• Fully-managed service, pay only for what you use (per minute of output video)

• HLS Support

• Configurable Presets

• AWS Elemental MediaConvert

• Newly launched, Fully-managed service, pay only for what you use (per minute of output video)

• HLS Support

• Broadcasting-grade, high quality output, Professional Codec Support (e.g. ProRes)

• Configurable Presets

• In some scenarios, MediaConvert is cheaper than Elastic Transcoder

• New! Basic Tier for Simple Web Videos
…or build your own
video encoding service
Most time-consuming
task is video encoding
Tested two products
Test conditions
• Input

• f(x) 4 Walls M/V (3m 33s)

• H.264/AVC, 1080p, 23.97fps, 8Mbps, High/4.1

• AAC LC, 192k, 48KHz, 2 Channels

• Mr. Robot Clip (52m 54s)

• H.264/AVC, 720p, 23.97fps, 1.5Mbps, High/4.1

• AC3, 384k, 48KHz, 6 Channels

• Output

• Single HLS Output

• H.264/AVC, 1080p, 23.97fps, ABR 3Mbps (Max 4.5Mbps), High/4.1

• AAC LC, 128k, 48KHz, 2 Channels

• No Thumbnail Generation
Elastic Transcoder
Elastic Transcoder
Elemental MediaConvert
Elemental MediaConvert
Results
• Overall workflow was stable

• Quality

• The output quality of both was similar

• Fixed GOP => Consistant segment duration

• Processing Speed (sorted by faster)

• Elastic Transcoder

• MediaConvert Basic

• MediaConvert Pro






Problems
• Pricing is quite expensive

• Needed more faster encoding speed without losing quality

• Missing CRF (Constant Rate Factor) bitrate mode support

• Can’t control encoder options

• MediaConvert has better encoder option (e.g . quantize algorithm -
CABAC)

• Can’t control video filters

(e.g. lanczos for resizing, yadif for deinterlacing, color filters like
instagram)

• There’s no way to remux video
Make our own
processing workflow 💥
Three ways to run job
• Batch - EC2

• Fargate - ECS

• Step Functions + Lambda
Three ways to run job
• Batch - EC2

• Fargate - ECS

• Step Functions + Lambda - WINNER!
Three ways to run job
• Batch - EC2

• Requires additional instance provisioning time (extremely slow)

• Fargate - ECS

• Requires additional container provisioning time

(about 30sec~60sec)

• Setting High CPU power requires High Memory Size

• Lambda 

• Computing Power is quite slower than EC2/Fargate instances

• …but now we have 3008MB Memory option, which has faster processing power

• No additional provisioning time required
Video Processing
Workflow
Video Processing Workflow
Single Video Processing
Function
Issue #1
How to get encoding
software running on AWS
Lambda?
Lambda-runtime compatible
build
• Linux program

• Lambda execution runtime is based on Amazon Linux AMI (amzn-ami-hvm-2017.03.1.20170812-
x86_64-gp2)

• Instead of using build instance, just make build image which is based on amazon linux docker
image

• docker pull amazonlinux:2017.03.1.20170812

• vim Dockerfile # Be careful updating openssl. it can make incompatible shared library issue

• docker build . -t my-awesome-lambda-build-env

• docker run --rm -v $PWD:/workspace my-awesome-lambda-build-env /workspace/build.sh

• Test built binaries or libraries using lambci lambda image

• docker pull lambci/lambda:nodejs8.10

• docker run --rm -v $PWD:/workspace --entrypoint bash lambci/lambda:nodejs8.10 /
workspace/test.sh
Lambda-runtime compatible
build
• Node.js Native Addons

• lambci provides docker images to rebuild
native addons

• docker pull lambci/lambda:build-nodejs8.10

• docker run --rm -v $PWD:/var/task lambci/
lambda:build-nodejs8.10 # runs “npm
rebuild”
Issue #2
Timeout issues

Hard to organize each
steps
Step functions
• Makes workflow simple to orchestrate AWS Lambda functions

• Supports Parallel state

• built-in error handling, retry, fallback conditions

• Useful patterns

• Delay execution for X seconds or until specific date/time

• Recursive Execution using Choice State

• Scan all records from DynamoDB table

• dequeue messages from SQS until queue is empty
Single Video Processing
Function
Break logics
State Machine - 1st version
Issue #3
VPC makes trouble
VPC Issue
• Assigning Lambda to VPC introduces long cold-start time

• about 10 sec, even used 3008MB memory size

• impacts overall video processing time

• Occasionally we had “connection timeout” issues

• AWS Support confirmed sometimes ENI may not have
internet connectivity

• we had to implement our own retry logic
VPC Issue
• Scaling Issue when invocation spikes
VPC Issue
• VPC was required for S3 access through S3
Endpoint only (to authenticate s3 access using VPCE
ID)

• Removed VPC configuration

• Switched to stream data using pre-signed urls or
download object using AWS-SDK

• reduced cold-start time (<40ms)

• “connection timeout” issue has gone
Issue #4
Tiny ephemeral
storage (/tmp)
Tiny ephemeral storage (/
tmp)
• Ephemeral storage capacity is 512MB, too small for media processing

• You can’t add block device to lambda

• NFS / EFS

• Lambda does not provide root permission

• so you cannot mount disks - you cannot use NFS in Lambda

• Ramdisk

• Ramdisk like /dev/shm is not available on Lambda

• Lambda does not provide root permission

• so you cannot create or mount ramdisk
Tiny ephemeral storage (/
tmp)
• S3 - only available option for now

• stream everything if possible
• use s3 as temporary storage

• Video Input - S3 supports seeking object using Range request header => can be streamed

• Video Output - may vary depending on container

• MP4 - requires seekable output => you cannot pipe output => you cannot stream outputs

• HLS - does not support writing outputs to pipes, since HLS consists of several files

• Watch file system (e.g. chokidar)

• Upload segments to s3 if generated

• Removed uploaded file

• Note: Higher memory size option provides faster Disk I/O and Network I/O
• Note: S3 Object keys are stored in UTF-8 binary ordering across multiple partitions in the index

=> UUID key prefix helps to reduce first byte latency
Issue #5
Optimize container
reusability
Optimize container
reusability
• Invoking different functions 

=> lambda container cannot be reused
Optimize container
reusability
• HACK: Group multiple lambda functions to single lambda
function

• Inject task name using Pass State
Processing Pipeline
Architecture - 1st version
Building Delivery block
Delivery block
• Currently we don’t need any DRM or AD
insertion solution

• Simple architecture

• Use S3 as origin, Cloudfront as CDN

• Use maximum TTL to maximize cache hit
Delivery block architecture
Connect blocks to
make pipeline
Media Pipeline Architecture
Media Pipeline Architecture
Media Pipeline Architecture
Media Pipeline Architecture
Launch
Appearing video uploads
Wait! There’s more!
2nd Version
• Improves encoding speed, output quality

• Support Parallel Encoding

• Split video streams to small chunks

• Split Video/Audio encoding process

• Encode streams per each preset, not outputs

• HLS HQ / HLS MQ / HLS LQ / MP4 MQ

=> Encode streams to HQ / MQ / LQ and assemble them

• Bypass encoding if input is compatible with our spec

• Skip HLS encoding process if source quality is not good, or duration is too short

• Support GIF input/output
Parallel Encoding
Break logics
State Machine - 2nd version
Results
• Fast processing without losing quality

• now processing f(x) M/V (1080p, 3m 33s) just takes 60 sec

• if input source is compatible with our spec, processing can be done within <10 sec

• Great output quality

• Saving cost

• encoding is not required if input source is compatible with our spec

• Stable workflow

• There’s no resource to manage

• Acceptable max bitrate: Up to 300Mbps (Tested with ProRes source)

Acceptable max resolution: 4K

Acceptable codec: HEVC, ProRes

Acceptable max duration: 1 hour
Further Steps
• Support 1 hour+ video processing using Elastic Transcoder

• Support Live Streaming

• MediaLive? Fargate?

• Finding solution for WebRTC gateway to relay live video stream

• Video Advertisement

• MediaTailor?

• Metrics, Management Tools …

• NSFW filtering - rekognition video or rekognition
Postmortem
•


• Elastic Transcode Elemental MediaConvert


• Processing pipeline
VOD 

• Lambda 

• Lambda
How about other media
types?

(Audio, GIF, Image…)
We’re hiring!

https://careers.vingle.net
Thank you

* * *

More Related Content

What's hot

DevOps at Amazon: A Look at Our Tools and Processes
DevOps at Amazon: A Look at Our Tools and ProcessesDevOps at Amazon: A Look at Our Tools and Processes
DevOps at Amazon: A Look at Our Tools and ProcessesAmazon Web Services
 
ESB Presentation
ESB PresentationESB Presentation
ESB PresentationF K
 
Chaos Engineering with Kubernetes - Berlin / Hamburg Chaos Engineering Meetup...
Chaos Engineering with Kubernetes - Berlin / Hamburg Chaos Engineering Meetup...Chaos Engineering with Kubernetes - Berlin / Hamburg Chaos Engineering Meetup...
Chaos Engineering with Kubernetes - Berlin / Hamburg Chaos Engineering Meetup...Ana Medina
 
How is Kafka so Fast?
How is Kafka so Fast?How is Kafka so Fast?
How is Kafka so Fast?Ricardo Paiva
 
Balkan - data eng meetup - data fusion
Balkan - data eng meetup - data fusionBalkan - data eng meetup - data fusion
Balkan - data eng meetup - data fusionBalkan Misirli
 
Gatling overview
Gatling overviewGatling overview
Gatling overviewViral Jain
 
Oracle CodeOne 2019: Descending the Testing Pyramid: Effective Testing Strate...
Oracle CodeOne 2019: Descending the Testing Pyramid: Effective Testing Strate...Oracle CodeOne 2019: Descending the Testing Pyramid: Effective Testing Strate...
Oracle CodeOne 2019: Descending the Testing Pyramid: Effective Testing Strate...Chris Richardson
 
Micro services Architecture
Micro services ArchitectureMicro services Architecture
Micro services ArchitectureAraf Karsh Hamid
 
Workday's Next Generation Private Cloud
Workday's Next Generation Private CloudWorkday's Next Generation Private Cloud
Workday's Next Generation Private CloudSilvano Buback
 
Building serverless integration solutions with Microsoft Azure
Building serverless integration solutions with Microsoft AzureBuilding serverless integration solutions with Microsoft Azure
Building serverless integration solutions with Microsoft AzureBizTalk360
 
Non Functional Testing
Non Functional TestingNon Functional Testing
Non Functional TestingNishant Worah
 
22nd Athens Big Data Meetup - 1st Talk - MLOps Workshop: The Full ML Lifecycl...
22nd Athens Big Data Meetup - 1st Talk - MLOps Workshop: The Full ML Lifecycl...22nd Athens Big Data Meetup - 1st Talk - MLOps Workshop: The Full ML Lifecycl...
22nd Athens Big Data Meetup - 1st Talk - MLOps Workshop: The Full ML Lifecycl...Athens Big Data
 
Nightwatch JS for End to End Tests
Nightwatch JS for End to End TestsNightwatch JS for End to End Tests
Nightwatch JS for End to End TestsSriram Angajala
 
Microservices Docker Kubernetes Istio Kanban DevOps SRE
Microservices Docker Kubernetes Istio Kanban DevOps SREMicroservices Docker Kubernetes Istio Kanban DevOps SRE
Microservices Docker Kubernetes Istio Kanban DevOps SREAraf Karsh Hamid
 
I Love APIs 2015: Crash Course Foundational Topics in Apigee Edge Workshop
I Love APIs 2015: Crash Course Foundational Topics in Apigee Edge WorkshopI Love APIs 2015: Crash Course Foundational Topics in Apigee Edge Workshop
I Love APIs 2015: Crash Course Foundational Topics in Apigee Edge WorkshopApigee | Google Cloud
 
Building a Streaming Microservice Architecture: with Apache Spark Structured ...
Building a Streaming Microservice Architecture: with Apache Spark Structured ...Building a Streaming Microservice Architecture: with Apache Spark Structured ...
Building a Streaming Microservice Architecture: with Apache Spark Structured ...Databricks
 
Continuous integration using Jenkins and Sonar
Continuous integration using Jenkins and SonarContinuous integration using Jenkins and Sonar
Continuous integration using Jenkins and SonarPascal Larocque
 
Quality engineering in DevOps... Why? How? (TestBusters Day&Night))
Quality engineering in DevOps... Why? How? (TestBusters Day&Night))Quality engineering in DevOps... Why? How? (TestBusters Day&Night))
Quality engineering in DevOps... Why? How? (TestBusters Day&Night))Rik Marselis
 
아해2019 SpringAOP 문겸
아해2019 SpringAOP 문겸아해2019 SpringAOP 문겸
아해2019 SpringAOP 문겸MoonGyeom1
 
Showdown: Integration Framework (Spring Integration, Apache Camel) vs. Enterp...
Showdown: Integration Framework (Spring Integration, Apache Camel) vs. Enterp...Showdown: Integration Framework (Spring Integration, Apache Camel) vs. Enterp...
Showdown: Integration Framework (Spring Integration, Apache Camel) vs. Enterp...Kai Wähner
 

What's hot (20)

DevOps at Amazon: A Look at Our Tools and Processes
DevOps at Amazon: A Look at Our Tools and ProcessesDevOps at Amazon: A Look at Our Tools and Processes
DevOps at Amazon: A Look at Our Tools and Processes
 
ESB Presentation
ESB PresentationESB Presentation
ESB Presentation
 
Chaos Engineering with Kubernetes - Berlin / Hamburg Chaos Engineering Meetup...
Chaos Engineering with Kubernetes - Berlin / Hamburg Chaos Engineering Meetup...Chaos Engineering with Kubernetes - Berlin / Hamburg Chaos Engineering Meetup...
Chaos Engineering with Kubernetes - Berlin / Hamburg Chaos Engineering Meetup...
 
How is Kafka so Fast?
How is Kafka so Fast?How is Kafka so Fast?
How is Kafka so Fast?
 
Balkan - data eng meetup - data fusion
Balkan - data eng meetup - data fusionBalkan - data eng meetup - data fusion
Balkan - data eng meetup - data fusion
 
Gatling overview
Gatling overviewGatling overview
Gatling overview
 
Oracle CodeOne 2019: Descending the Testing Pyramid: Effective Testing Strate...
Oracle CodeOne 2019: Descending the Testing Pyramid: Effective Testing Strate...Oracle CodeOne 2019: Descending the Testing Pyramid: Effective Testing Strate...
Oracle CodeOne 2019: Descending the Testing Pyramid: Effective Testing Strate...
 
Micro services Architecture
Micro services ArchitectureMicro services Architecture
Micro services Architecture
 
Workday's Next Generation Private Cloud
Workday's Next Generation Private CloudWorkday's Next Generation Private Cloud
Workday's Next Generation Private Cloud
 
Building serverless integration solutions with Microsoft Azure
Building serverless integration solutions with Microsoft AzureBuilding serverless integration solutions with Microsoft Azure
Building serverless integration solutions with Microsoft Azure
 
Non Functional Testing
Non Functional TestingNon Functional Testing
Non Functional Testing
 
22nd Athens Big Data Meetup - 1st Talk - MLOps Workshop: The Full ML Lifecycl...
22nd Athens Big Data Meetup - 1st Talk - MLOps Workshop: The Full ML Lifecycl...22nd Athens Big Data Meetup - 1st Talk - MLOps Workshop: The Full ML Lifecycl...
22nd Athens Big Data Meetup - 1st Talk - MLOps Workshop: The Full ML Lifecycl...
 
Nightwatch JS for End to End Tests
Nightwatch JS for End to End TestsNightwatch JS for End to End Tests
Nightwatch JS for End to End Tests
 
Microservices Docker Kubernetes Istio Kanban DevOps SRE
Microservices Docker Kubernetes Istio Kanban DevOps SREMicroservices Docker Kubernetes Istio Kanban DevOps SRE
Microservices Docker Kubernetes Istio Kanban DevOps SRE
 
I Love APIs 2015: Crash Course Foundational Topics in Apigee Edge Workshop
I Love APIs 2015: Crash Course Foundational Topics in Apigee Edge WorkshopI Love APIs 2015: Crash Course Foundational Topics in Apigee Edge Workshop
I Love APIs 2015: Crash Course Foundational Topics in Apigee Edge Workshop
 
Building a Streaming Microservice Architecture: with Apache Spark Structured ...
Building a Streaming Microservice Architecture: with Apache Spark Structured ...Building a Streaming Microservice Architecture: with Apache Spark Structured ...
Building a Streaming Microservice Architecture: with Apache Spark Structured ...
 
Continuous integration using Jenkins and Sonar
Continuous integration using Jenkins and SonarContinuous integration using Jenkins and Sonar
Continuous integration using Jenkins and Sonar
 
Quality engineering in DevOps... Why? How? (TestBusters Day&Night))
Quality engineering in DevOps... Why? How? (TestBusters Day&Night))Quality engineering in DevOps... Why? How? (TestBusters Day&Night))
Quality engineering in DevOps... Why? How? (TestBusters Day&Night))
 
아해2019 SpringAOP 문겸
아해2019 SpringAOP 문겸아해2019 SpringAOP 문겸
아해2019 SpringAOP 문겸
 
Showdown: Integration Framework (Spring Integration, Apache Camel) vs. Enterp...
Showdown: Integration Framework (Spring Integration, Apache Camel) vs. Enterp...Showdown: Integration Framework (Spring Integration, Apache Camel) vs. Enterp...
Showdown: Integration Framework (Spring Integration, Apache Camel) vs. Enterp...
 

Similar to Serverless Media Workflow

Silverlight Wireshark Analysis
Silverlight Wireshark AnalysisSilverlight Wireshark Analysis
Silverlight Wireshark AnalysisYoss Cohen
 
Building A Streaming Apple TV App (CocoaConf San Jose, Nov 2016)
Building A Streaming Apple TV App (CocoaConf San Jose, Nov 2016)Building A Streaming Apple TV App (CocoaConf San Jose, Nov 2016)
Building A Streaming Apple TV App (CocoaConf San Jose, Nov 2016)Chris Adamson
 
AWS re:Invent 2016: Accelerating the Transition to Broadcast and OTT Infrastr...
AWS re:Invent 2016: Accelerating the Transition to Broadcast and OTT Infrastr...AWS re:Invent 2016: Accelerating the Transition to Broadcast and OTT Infrastr...
AWS re:Invent 2016: Accelerating the Transition to Broadcast and OTT Infrastr...Amazon Web Services
 
Multicore ware applications of machine learning for video encoding
Multicore ware applications of machine learning for video encodingMulticore ware applications of machine learning for video encoding
Multicore ware applications of machine learning for video encodingGanesan Narayanasamy
 
Building A Streaming Apple TV App (CocoaConf DC, Sept 2016)
Building A Streaming Apple TV App (CocoaConf DC, Sept 2016)Building A Streaming Apple TV App (CocoaConf DC, Sept 2016)
Building A Streaming Apple TV App (CocoaConf DC, Sept 2016)Chris Adamson
 
HTML5 video & Amazon elastic transcoder - FCIP August 2014
HTML5 video & Amazon elastic transcoder - FCIP August 2014HTML5 video & Amazon elastic transcoder - FCIP August 2014
HTML5 video & Amazon elastic transcoder - FCIP August 2014RZasadzinski
 
[AWS Media Symposium 2019] AWS Media Services Innovation - Christer Whitehorn...
[AWS Media Symposium 2019] AWS Media Services Innovation - Christer Whitehorn...[AWS Media Symposium 2019] AWS Media Services Innovation - Christer Whitehorn...
[AWS Media Symposium 2019] AWS Media Services Innovation - Christer Whitehorn...Amazon Web Services Korea
 
Glitch-Free A/V Encoding (CocoaConf Boston, October 2013)
Glitch-Free A/V Encoding (CocoaConf Boston, October 2013)Glitch-Free A/V Encoding (CocoaConf Boston, October 2013)
Glitch-Free A/V Encoding (CocoaConf Boston, October 2013)Chris Adamson
 
Adobe HTTP Streaming
Adobe HTTP StreamingAdobe HTTP Streaming
Adobe HTTP StreamingYoss Cohen
 
Sm west 2010-microsoft-workshop
Sm west 2010-microsoft-workshopSm west 2010-microsoft-workshop
Sm west 2010-microsoft-workshopPrashant Ohal
 
Cloudsolutionday 2016: DevOps workflow with Docker on AWS
Cloudsolutionday 2016: DevOps workflow with Docker on AWSCloudsolutionday 2016: DevOps workflow with Docker on AWS
Cloudsolutionday 2016: DevOps workflow with Docker on AWSAWS Vietnam Community
 
IBC Content Everywhere Hub Presentation: HTML5 And Fastest Encoding
IBC Content Everywhere Hub Presentation: HTML5 And Fastest EncodingIBC Content Everywhere Hub Presentation: HTML5 And Fastest Encoding
IBC Content Everywhere Hub Presentation: HTML5 And Fastest EncodingBitmovin Inc
 
Zitec+ +new business+-+3iun2010
Zitec+ +new business+-+3iun2010Zitec+ +new business+-+3iun2010
Zitec+ +new business+-+3iun2010Agora Group
 
Criteo Labs Infrastructure Tech Talk Meetup Nov. 7
Criteo Labs Infrastructure Tech Talk Meetup Nov. 7Criteo Labs Infrastructure Tech Talk Meetup Nov. 7
Criteo Labs Infrastructure Tech Talk Meetup Nov. 7Shuo LI
 
NAB Show 2018 Notes
NAB Show 2018 NotesNAB Show 2018 Notes
NAB Show 2018 NotesYusuke Goto
 
AWS Webcast - What's New with Amazon Elastic Transcoder
AWS Webcast - What's New with Amazon Elastic TranscoderAWS Webcast - What's New with Amazon Elastic Transcoder
AWS Webcast - What's New with Amazon Elastic TranscoderAmazon Web Services
 
ReproNow—Save Time Reproducing and Triaging Security Bugs
ReproNow—Save Time Reproducing and Triaging Security BugsReproNow—Save Time Reproducing and Triaging Security Bugs
ReproNow—Save Time Reproducing and Triaging Security BugsPriyanka Aash
 

Similar to Serverless Media Workflow (20)

Pycon2013
Pycon2013Pycon2013
Pycon2013
 
Silverlight Wireshark Analysis
Silverlight Wireshark AnalysisSilverlight Wireshark Analysis
Silverlight Wireshark Analysis
 
Building A Streaming Apple TV App (CocoaConf San Jose, Nov 2016)
Building A Streaming Apple TV App (CocoaConf San Jose, Nov 2016)Building A Streaming Apple TV App (CocoaConf San Jose, Nov 2016)
Building A Streaming Apple TV App (CocoaConf San Jose, Nov 2016)
 
AWS re:Invent 2016: Accelerating the Transition to Broadcast and OTT Infrastr...
AWS re:Invent 2016: Accelerating the Transition to Broadcast and OTT Infrastr...AWS re:Invent 2016: Accelerating the Transition to Broadcast and OTT Infrastr...
AWS re:Invent 2016: Accelerating the Transition to Broadcast and OTT Infrastr...
 
Multicore ware applications of machine learning for video encoding
Multicore ware applications of machine learning for video encodingMulticore ware applications of machine learning for video encoding
Multicore ware applications of machine learning for video encoding
 
Building A Streaming Apple TV App (CocoaConf DC, Sept 2016)
Building A Streaming Apple TV App (CocoaConf DC, Sept 2016)Building A Streaming Apple TV App (CocoaConf DC, Sept 2016)
Building A Streaming Apple TV App (CocoaConf DC, Sept 2016)
 
HTML5 video & Amazon elastic transcoder - FCIP August 2014
HTML5 video & Amazon elastic transcoder - FCIP August 2014HTML5 video & Amazon elastic transcoder - FCIP August 2014
HTML5 video & Amazon elastic transcoder - FCIP August 2014
 
[AWS Media Symposium 2019] AWS Media Services Innovation - Christer Whitehorn...
[AWS Media Symposium 2019] AWS Media Services Innovation - Christer Whitehorn...[AWS Media Symposium 2019] AWS Media Services Innovation - Christer Whitehorn...
[AWS Media Symposium 2019] AWS Media Services Innovation - Christer Whitehorn...
 
Glitch-Free A/V Encoding (CocoaConf Boston, October 2013)
Glitch-Free A/V Encoding (CocoaConf Boston, October 2013)Glitch-Free A/V Encoding (CocoaConf Boston, October 2013)
Glitch-Free A/V Encoding (CocoaConf Boston, October 2013)
 
Adobe HTTP Streaming
Adobe HTTP StreamingAdobe HTTP Streaming
Adobe HTTP Streaming
 
Mm sys 2013-demo
Mm sys 2013-demoMm sys 2013-demo
Mm sys 2013-demo
 
Apan media encoding
Apan media encodingApan media encoding
Apan media encoding
 
Sm west 2010-microsoft-workshop
Sm west 2010-microsoft-workshopSm west 2010-microsoft-workshop
Sm west 2010-microsoft-workshop
 
Cloudsolutionday 2016: DevOps workflow with Docker on AWS
Cloudsolutionday 2016: DevOps workflow with Docker on AWSCloudsolutionday 2016: DevOps workflow with Docker on AWS
Cloudsolutionday 2016: DevOps workflow with Docker on AWS
 
IBC Content Everywhere Hub Presentation: HTML5 And Fastest Encoding
IBC Content Everywhere Hub Presentation: HTML5 And Fastest EncodingIBC Content Everywhere Hub Presentation: HTML5 And Fastest Encoding
IBC Content Everywhere Hub Presentation: HTML5 And Fastest Encoding
 
Zitec+ +new business+-+3iun2010
Zitec+ +new business+-+3iun2010Zitec+ +new business+-+3iun2010
Zitec+ +new business+-+3iun2010
 
Criteo Labs Infrastructure Tech Talk Meetup Nov. 7
Criteo Labs Infrastructure Tech Talk Meetup Nov. 7Criteo Labs Infrastructure Tech Talk Meetup Nov. 7
Criteo Labs Infrastructure Tech Talk Meetup Nov. 7
 
NAB Show 2018 Notes
NAB Show 2018 NotesNAB Show 2018 Notes
NAB Show 2018 Notes
 
AWS Webcast - What's New with Amazon Elastic Transcoder
AWS Webcast - What's New with Amazon Elastic TranscoderAWS Webcast - What's New with Amazon Elastic Transcoder
AWS Webcast - What's New with Amazon Elastic Transcoder
 
ReproNow—Save Time Reproducing and Triaging Security Bugs
ReproNow—Save Time Reproducing and Triaging Security BugsReproNow—Save Time Reproducing and Triaging Security Bugs
ReproNow—Save Time Reproducing and Triaging Security Bugs
 

Recently uploaded

The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...ICS
 
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfkalichargn70th171
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackVICTOR MAESTRE RAMIREZ
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...stazi3110
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio, Inc.
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxComplianceQuest1
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEOrtus Solutions, Corp
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideChristina Lin
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 
Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...aditisharan08
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software DevelopersVinodh Ram
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityNeo4j
 

Recently uploaded (20)

The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStack
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software Developers
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered Sustainability
 

Serverless Media Workflow

  • 2. Speaker • Serverless Lover • Software Engineer @ Vingle • Freelancer Software Engineer @ Artistscard • Software Engineer @ Law&Company • https://github.com/mooyoul • https://mooyoul.github.io
  • 3.
  • 4. A journey to
 Video Service 🎥
  • 5. Video is becoming 
 the most important content
 🔥🔥🔥
  • 6. Let’s add video feature on Vingle! 😎
  • 14. Ingest Step Requirements • Support File-based workflow only for now • Simple upload workflow for clients • Fast upload speeds anywhere in the world • Durable, scalable, fast storage • No additional disk storage required for upload • No maintenance required
  • 15. Ingest Step Requirements • Support File-based workflow only for now • Simple upload workflow for clients • Fast upload speeds anywhere in the world • Durable, scalable, fast storage • No additional disk storage required for upload • No maintenance required
  • 16. S3 Upload using pre-signed URL • Allows client can upload directly to S3 using pre- signed URL • AWS-SDK supports pre- signed url generation
  • 17. S3 Upload using pre-signed URL
  • 18. …but we are using 
 us-east-1 region
  • 19. some regional ISPs have bandwidth issue on international network transfer 💩
  • 20. Slow Upload on some ISPs
  • 21. Upload speed is so slow!🐢🐢🐢
  • 22. Submarine cables 
 in South Korea
  • 23. Submarine cables 
 in South Korea
  • 24. Two options to accelerate S3 transfer 🚀
  • 25. Two options to accelerate S3 transfer • Proxy file transfer traffic through CloudFront • Cloudfront can accelerate dynamic content • Uses Cloudfront Edge locations to optimize route path • Enable S3 Transfer Acceleration • Takes advantage of CloudFront’s globally distributed edge locations • More transfer optimizations
  • 26. S3 Transfer Acceleration is faster than Cloudfront as Proxy
  • 27. S3 Transfer Acceleration makes throughput faster
  • 31. Processing Requirements • use fully-managed service if possible • scalable, reliable • adaptive bitrate streaming • Important: compatible with various platforms, devices • Desktop Web - IE 10+, Edge, Chrome, Firefox • Mobile Web - Mobile Safari, Chrome Mobie • Android - 4.1 ICS+ • iOS - 9+ • Most Important: Delivery video to users ASAP
  • 32. Wait! 
 What is Adaptive Bitrate Streaming?
  • 33. Adaptive Bitrate Streaming • From Wikipedia: • Adaptive bitrate streaming is a technique used in streaming multimedia over computer networks. • It works by detecting a user's bandwidth and CPU capacity in real time and adjusting the quality of a video stream accordingly. • The result: very little buffering, fast start time and a good experience for both high-end and low-end connections.
  • 36. Choosing Streaming Protocol • Non-HTTP based protocols like RTMP are not in our interest • Looked for HTTP-based protocols, or methods • Progressive Download Single File via HTTP • 1st request: Range: 0-255 • 2st request: Range: 256-511 • 3rd request: Range: 512-767 • … • Apple HLS • MPEG-DASH
  • 37. Choosing Streaming Protocol • Progressive Download Single File via HTTP • Apple HLS • MPEG-DASH
  • 38. Choosing Streaming Protocol • Progressive Download Single File via HTTP • Apple HLS - Winner! • MPEG-DASH
  • 40. Progressive Download
 Single File via HTTP • Pros • Easy to implement • Cons • Implementing Adaptive Bitrate Streaming is so hard (almost impossible) without getting “choppy” frames, or “pop” gap sound between streams • Slow seeking/starting since container requires metadata reading • Large binary can occur lower cache hit • No Live Stream compatibility
  • 41. MPEG-DASH • Pros • New standard • Based on Fragmented MPEG4 (similar to MPEG2 Transport Stream on HLS) • Broader codec support • Cons • IMO it is not production ready • Market, Platform, Community support is not good at this moment • Workflow was unstable during experiment
  • 43. First Spec - Protocol • HTTP Live Stream (HLS) • Apple invented standard, natively supported on macOS/iOS/tvOS • Natively supports adaptive bitrate streaming, Live Streaming, and DRM (Apple FairPlay) • Based on HTTP Protocol, Play well with transitional HTTP CDN • Trusted by many providers, Many stable implementations • Amazon, Youtube, Facebook, Twitter, Vimeo, Twitch, Akamai, New York Times, FOX TV, TED, VK, POOQ, SK Broadband TV … • Android - ExoPlayer • Web - MediaSource Extension is standard spec, HLS.js, Video.js
  • 44. First Spec - Input • No codec limitation of input source
 
 … but expects most input source are H.264/AVC + AAC based • Max acceptable resolution: 1080p • Max acceptable bitrate: 10Mbps • Max acceptable duration: 5 minutes
  • 45. First Spec - Output • Common • H.264/AVC1 + AAC LC • Many graphic chipset supports hardware accelerated decoding • Most popular codec in market • Apple HLS • Three variants for adaptive bitrate streaming • High Quality: Up to 1080p, 60p, High/4.1, 4Mbps • Medium Quality: Up to 720p, 30p, Main/4.0, 2Mbps • Low Quality: Up to 480p, 30p, Baseline/3.1 800kbps • Progressive Download Single File via HTTP for HLS fallback • Medium Quality only
  • 46. First Spec - Output • 4 Outputs • HLS HQ • HLS MQ • HLS LQ • HTTP Progressive MP4 MQ
  • 48. Requirements • use fully-managed service if possible • scalable, reliable • adaptive bitrate streaming • Important: compatible with various platforms, devices • Desktop Web - IE 10+, Edge, Chrome, Firefox • Mobile Web - Mobile Safari, Chrome Mobie • Android - 4.1 ICS+ • iOS - 9+ • Important: Delivery video to users ASAP
  • 49. Requirements • use fully-managed service if possible • scalable, reliable • adaptive bitrate streaming • Important: compatible with various platforms, devices • Desktop Web - IE 10+, Edge, Chrome, Firefox • Mobile Web - Mobile Safari, Chrome Mobie • Android - 4.1 ICS+ • iOS - 9+ • Important: Delivery video to users ASAP
  • 50. Requirements • use fully-managed service if possible • scalable, reliable • Important: Delivery video to users ASAP
  • 51. AWS provides bunch of media products 🎉
  • 52. Video Encoding Products • AWS Elastic Transcoder • Fully-managed service, pay only for what you use (per minute of output video) • HLS Support • Configurable Presets • AWS Elemental MediaConvert • Newly launched, Fully-managed service, pay only for what you use (per minute of output video) • HLS Support • Broadcasting-grade, high quality output, Professional Codec Support (e.g. ProRes) • Configurable Presets • In some scenarios, MediaConvert is cheaper than Elastic Transcoder • New! Basic Tier for Simple Web Videos
  • 53. …or build your own video encoding service
  • 54. Most time-consuming task is video encoding
  • 56. Test conditions • Input • f(x) 4 Walls M/V (3m 33s) • H.264/AVC, 1080p, 23.97fps, 8Mbps, High/4.1 • AAC LC, 192k, 48KHz, 2 Channels • Mr. Robot Clip (52m 54s) • H.264/AVC, 720p, 23.97fps, 1.5Mbps, High/4.1 • AC3, 384k, 48KHz, 6 Channels • Output • Single HLS Output • H.264/AVC, 1080p, 23.97fps, ABR 3Mbps (Max 4.5Mbps), High/4.1 • AAC LC, 128k, 48KHz, 2 Channels • No Thumbnail Generation
  • 61. Results • Overall workflow was stable • Quality • The output quality of both was similar • Fixed GOP => Consistant segment duration • Processing Speed (sorted by faster) • Elastic Transcoder • MediaConvert Basic • MediaConvert Pro 
 
 

  • 62. Problems • Pricing is quite expensive • Needed more faster encoding speed without losing quality • Missing CRF (Constant Rate Factor) bitrate mode support • Can’t control encoder options • MediaConvert has better encoder option (e.g . quantize algorithm - CABAC) • Can’t control video filters
 (e.g. lanczos for resizing, yadif for deinterlacing, color filters like instagram) • There’s no way to remux video
  • 63. Make our own processing workflow 💥
  • 64. Three ways to run job • Batch - EC2 • Fargate - ECS • Step Functions + Lambda
  • 65. Three ways to run job • Batch - EC2 • Fargate - ECS • Step Functions + Lambda - WINNER!
  • 66. Three ways to run job • Batch - EC2 • Requires additional instance provisioning time (extremely slow) • Fargate - ECS • Requires additional container provisioning time
 (about 30sec~60sec) • Setting High CPU power requires High Memory Size • Lambda • Computing Power is quite slower than EC2/Fargate instances • …but now we have 3008MB Memory option, which has faster processing power • No additional provisioning time required
  • 71. How to get encoding software running on AWS Lambda?
  • 72. Lambda-runtime compatible build • Linux program • Lambda execution runtime is based on Amazon Linux AMI (amzn-ami-hvm-2017.03.1.20170812- x86_64-gp2) • Instead of using build instance, just make build image which is based on amazon linux docker image • docker pull amazonlinux:2017.03.1.20170812 • vim Dockerfile # Be careful updating openssl. it can make incompatible shared library issue • docker build . -t my-awesome-lambda-build-env • docker run --rm -v $PWD:/workspace my-awesome-lambda-build-env /workspace/build.sh • Test built binaries or libraries using lambci lambda image • docker pull lambci/lambda:nodejs8.10 • docker run --rm -v $PWD:/workspace --entrypoint bash lambci/lambda:nodejs8.10 / workspace/test.sh
  • 73. Lambda-runtime compatible build • Node.js Native Addons • lambci provides docker images to rebuild native addons • docker pull lambci/lambda:build-nodejs8.10 • docker run --rm -v $PWD:/var/task lambci/ lambda:build-nodejs8.10 # runs “npm rebuild”
  • 75. Timeout issues Hard to organize each steps
  • 76. Step functions • Makes workflow simple to orchestrate AWS Lambda functions • Supports Parallel state • built-in error handling, retry, fallback conditions • Useful patterns • Delay execution for X seconds or until specific date/time • Recursive Execution using Choice State • Scan all records from DynamoDB table • dequeue messages from SQS until queue is empty
  • 79. State Machine - 1st version
  • 82. VPC Issue • Assigning Lambda to VPC introduces long cold-start time • about 10 sec, even used 3008MB memory size • impacts overall video processing time • Occasionally we had “connection timeout” issues • AWS Support confirmed sometimes ENI may not have internet connectivity • we had to implement our own retry logic
  • 83. VPC Issue • Scaling Issue when invocation spikes
  • 84. VPC Issue • VPC was required for S3 access through S3 Endpoint only (to authenticate s3 access using VPCE ID) • Removed VPC configuration • Switched to stream data using pre-signed urls or download object using AWS-SDK • reduced cold-start time (<40ms) • “connection timeout” issue has gone
  • 87. Tiny ephemeral storage (/ tmp) • Ephemeral storage capacity is 512MB, too small for media processing • You can’t add block device to lambda • NFS / EFS • Lambda does not provide root permission • so you cannot mount disks - you cannot use NFS in Lambda • Ramdisk • Ramdisk like /dev/shm is not available on Lambda • Lambda does not provide root permission • so you cannot create or mount ramdisk
  • 88. Tiny ephemeral storage (/ tmp) • S3 - only available option for now • stream everything if possible • use s3 as temporary storage • Video Input - S3 supports seeking object using Range request header => can be streamed • Video Output - may vary depending on container • MP4 - requires seekable output => you cannot pipe output => you cannot stream outputs • HLS - does not support writing outputs to pipes, since HLS consists of several files • Watch file system (e.g. chokidar) • Upload segments to s3 if generated • Removed uploaded file • Note: Higher memory size option provides faster Disk I/O and Network I/O • Note: S3 Object keys are stored in UTF-8 binary ordering across multiple partitions in the index
 => UUID key prefix helps to reduce first byte latency
  • 91. Optimize container reusability • Invoking different functions 
 => lambda container cannot be reused
  • 92. Optimize container reusability • HACK: Group multiple lambda functions to single lambda function • Inject task name using Pass State
  • 95. Delivery block • Currently we don’t need any DRM or AD insertion solution • Simple architecture • Use S3 as origin, Cloudfront as CDN • Use maximum TTL to maximize cache hit
  • 102. Launch
  • 105. 2nd Version • Improves encoding speed, output quality • Support Parallel Encoding • Split video streams to small chunks • Split Video/Audio encoding process • Encode streams per each preset, not outputs • HLS HQ / HLS MQ / HLS LQ / MP4 MQ
 => Encode streams to HQ / MQ / LQ and assemble them • Bypass encoding if input is compatible with our spec • Skip HLS encoding process if source quality is not good, or duration is too short • Support GIF input/output
  • 108. State Machine - 2nd version
  • 109. Results • Fast processing without losing quality • now processing f(x) M/V (1080p, 3m 33s) just takes 60 sec • if input source is compatible with our spec, processing can be done within <10 sec • Great output quality • Saving cost • encoding is not required if input source is compatible with our spec • Stable workflow • There’s no resource to manage • Acceptable max bitrate: Up to 300Mbps (Tested with ProRes source)
 Acceptable max resolution: 4K
 Acceptable codec: HEVC, ProRes
 Acceptable max duration: 1 hour
  • 110. Further Steps • Support 1 hour+ video processing using Elastic Transcoder • Support Live Streaming • MediaLive? Fargate? • Finding solution for WebRTC gateway to relay live video stream • Video Advertisement • MediaTailor? • Metrics, Management Tools … • NSFW filtering - rekognition video or rekognition
  • 112. • • Elastic Transcode Elemental MediaConvert • Processing pipeline VOD • Lambda • Lambda
  • 113. How about other media types?
 (Audio, GIF, Image…)