SlideShare a Scribd company logo
1 of 46
Billy Hoffman
billy.hoffman@rigor.com
rigor.com
Optimizing HTML5 Video
Agenda
• Overview of HTML5 Video
• Optimizing for context
• Optimizing for content
• Bonus: Animated GIFs
What Is HTML5 Video?
Terminology
• Container Format
• The file/structure used to store stuff (MP4, WebM, AVI)
• Audio data, Video data, Meta data
• Codec
• Algorithm used to compress/encode video/audio
• Video: H.264, VP8, VP9, Theora
• Bitrate
• I’ll probably just say MP4 Video, WebM Video, etc
HTML5 Video
HTML5 Video
HTML5 Video
So… Multiple Video Types?
• Yeah
• It’s complicated
• Concerns about how owns patents on codecs/algorithms
• Concerns about licensing costs
• Really a proxy fight between the browsers creators
H.264 in MP4 Won
WebM Has Strong Support
Microsoft Adding WebM to Edge
Getting the data
• Playing a local file
• Pseudo Streaming
• HTTP get requests
• Adaptive/Live Streaming
• HTTP Live Streaming
• MPEG-DASH
• Flash stuff
Optimizing Video for Context
3 Rules of Frontend Performance
1. Reduce the amount of data
2. Reduce the number of
requests
3. Structure data for optimal
downloading and
rendering
Is it the Right Size?
Video File: 1280 x 720
Finding Video Dimensions
Wait a second…
Muted HTML5 Video as Hero…
Optimizing Video Content
Playing an HTML5 Video
• Fetches Video file
• Using Range
requests as you skip
around the file
Aside: Support Range Requests!
• HTTP Range Request
• Accept-Ranges
• Range:
• Allows browser to do partial
downloads
• Required for
seeking/streaming
• Easy to test support
Structure of a MP4 File
• Made of “Atoms”
• Contains discrete pieces of data (like PNG chunks)
• Video data, audio data, meta data, everything
• moov atom acts like a table of contents
Jumping around to find the MOOV
Move the MOOV
• If we move it to the front…
• 1 HTTP Request...
• 200ms of delay missed...
• 600KB of content avoided...
Do it right from the start
Remember These Guys…
• Other formats for compatibility
• … ... Leverage as an optimization?
• How browsers choose the video
• Look at each <source>
• Support type?
• Play it!
Bloated Default HTML5 Video
• Formats store data differently
• What if MP4 is larger than
WebM?
• Too bad
• Take Away: Place smallest source
first
• Example: https://headspin.io/
Multiple Video Sources. Same Quality?
Multiple Video Sources. Same Bitrate?
Structure of a WebM File
• Really just a subset of Matroska container (MKV)
• Made of “Elements”
• Contains discrete pieces of data (like PNG chunks)
• Video data, audio data, meta data, everything
• “SeekHead” element acts like a table of contents
• Sounding familiar… ?
Seeking around to find the SeekHead…
Optimize WebM Structure
• Only 1 SeekHead element, placed at the front…
• Great open source tool mkclean
Other Standard Optimizations
• Are you caching the file?
• Do you have a Last-Modified
header?
BONUS!
Optimizing Animated GIFs…
… the other “video” format
Animated GIFs: Amazing it even works
“The Graphics Interchange
Format is not intended as a
platform for animation, even
though it can be done in a
limited way.”
- GIF89A Specification
Animated GIFs: The Good
• Universal support on all
platforms
• No patent or licensing concerns
• Easy, widely available creation
tools
• A culture that has grown around
creating and sharing funny
animated GIFs.
Animated GIFs: The (Unbelievably) Bad
• 256 colors per video frame
• LZW compression sucks for
photographic data
• Animated system not designed
differences between video frames
• No sexy video tricks
• chroma subsampling, discrete cosine
transforms, or motion compensation
• No hardware support on mobile
• More CPU, RAM, Power
• 5x to 10x larger than a properly
encoded video
YIKES! 26.7MB!!!!
Lossless Animated GIF Optimization
• Gifsicle
• Standard lossless optimizations
• Remove non-graphic stuff
• Find deltas between animation
frames…
• Pretty good for animations
• Terrible for video
Lossy Optimization for Animated GIFs
• Lossy matching in the
LZW encoder
• Modified version of
gifsicle
2.9 MB
1.1 MB
https://kornel.ski/lossygif
Fake GIF as an MP4?
What’s Actually going on?
Animated GIF as MP4
• Convert GIF to MP4 with ffmpeg
• Alter the HTML markup
HTML5 Video Optimization Check List
• Is your video optimized for how it will be used?
• Is your <VIDEO> tag using the right size?
• Is your <VIDEO> muted? Strip the audio!
• Does your server use HTTP Range Requests?
• What about Last-Modified?
• What about Expires/Cache-Control?
• Are you using multiple <SOURCE> tags?
• Is the smallest file first?
• Are all the videos roughly the same bitrate?
HTML5 Video Optimization Check List (con’t)
• Are your MP4 files optimized for fast start?
• Are your WebM files optimized for fast start and fast seeking?
• Animated GIFs
• Use lossless for animations
• Use Lossy for video clips
• Advanced: Try converting to MP4 instead…
Billy Hoffman
billy.hoffman@rigor.com
rigor.com
Optimizing HTML5 Video

More Related Content

What's hot

OpenWater Premium Awards Website
OpenWater Premium Awards WebsiteOpenWater Premium Awards Website
OpenWater Premium Awards WebsiteOpenWater
 
Making kitten GIF galleries fabulous - Image optimisation for WordPress
Making kitten GIF galleries fabulous - Image optimisation for WordPressMaking kitten GIF galleries fabulous - Image optimisation for WordPress
Making kitten GIF galleries fabulous - Image optimisation for WordPressKayleigh Thorpe
 
WordCamp Atlanta 2016 Frameworks for Freelancers
WordCamp Atlanta 2016 Frameworks for FreelancersWordCamp Atlanta 2016 Frameworks for Freelancers
WordCamp Atlanta 2016 Frameworks for FreelancersShelly Peacock
 
Justmeans power point
Justmeans power pointJustmeans power point
Justmeans power pointjustmeanscsr
 
Justmeans power point
Justmeans power pointJustmeans power point
Justmeans power pointjustmeanscsr
 
Supergluing Asterisk to the Web with Adhearsion
Supergluing Asterisk to the Web with AdhearsionSupergluing Asterisk to the Web with Adhearsion
Supergluing Asterisk to the Web with AdhearsionMojo Lingo
 

What's hot (8)

OpenWater Premium Awards Website
OpenWater Premium Awards WebsiteOpenWater Premium Awards Website
OpenWater Premium Awards Website
 
Making kitten GIF galleries fabulous - Image optimisation for WordPress
Making kitten GIF galleries fabulous - Image optimisation for WordPressMaking kitten GIF galleries fabulous - Image optimisation for WordPress
Making kitten GIF galleries fabulous - Image optimisation for WordPress
 
Cine scope
Cine scopeCine scope
Cine scope
 
WordCamp Atlanta 2016 Frameworks for Freelancers
WordCamp Atlanta 2016 Frameworks for FreelancersWordCamp Atlanta 2016 Frameworks for Freelancers
WordCamp Atlanta 2016 Frameworks for Freelancers
 
Justmeans power point
Justmeans power pointJustmeans power point
Justmeans power point
 
Justmeans power point
Justmeans power pointJustmeans power point
Justmeans power point
 
Supergluing Asterisk to the Web with Adhearsion
Supergluing Asterisk to the Web with AdhearsionSupergluing Asterisk to the Web with Adhearsion
Supergluing Asterisk to the Web with Adhearsion
 
World Tv
World TvWorld Tv
World Tv
 

Viewers also liked

Mobile Web Stress: Understanding the Neurological Impact of Poor Performance
Mobile Web Stress:  Understanding the Neurological Impact of Poor PerformanceMobile Web Stress:  Understanding the Neurological Impact of Poor Performance
Mobile Web Stress: Understanding the Neurological Impact of Poor PerformanceRadware
 
Google AMP 1 an après : quel bilan, quelles perspectives ?
Google AMP 1 an après : quel bilan, quelles perspectives ?Google AMP 1 an après : quel bilan, quelles perspectives ?
Google AMP 1 an après : quel bilan, quelles perspectives ?Virginie Clève - largow ☕️
 
Scottish Government's International Development Policy- what does it mean for...
Scottish Government's International Development Policy- what does it mean for...Scottish Government's International Development Policy- what does it mean for...
Scottish Government's International Development Policy- what does it mean for...Scotland Malawi Partnership
 
Большой Урал: мониторинг настроений, мнений, планов жителей региона
Большой Урал: мониторинг настроений, мнений, планов жителей региона Большой Урал: мониторинг настроений, мнений, планов жителей региона
Большой Урал: мониторинг настроений, мнений, планов жителей региона Фонд "Социум"
 
9789740335863
97897403358639789740335863
9789740335863CUPress
 
avantages des ressources éducatives libres (REL)
avantages des ressources éducatives libres (REL)avantages des ressources éducatives libres (REL)
avantages des ressources éducatives libres (REL)Formation 3.0
 
Characteristics of commercial arable farming
Characteristics of commercial arable farmingCharacteristics of commercial arable farming
Characteristics of commercial arable farmingTacius Golding High
 
How the 1961 Al-Azhar Law changed the institution
How the 1961 Al-Azhar Law changed the institutionHow the 1961 Al-Azhar Law changed the institution
How the 1961 Al-Azhar Law changed the institutionMadaMasr
 
Progama de prevenciona antidrogas a ser aplicado al personal de tropa del 608...
Progama de prevenciona antidrogas a ser aplicado al personal de tropa del 608...Progama de prevenciona antidrogas a ser aplicado al personal de tropa del 608...
Progama de prevenciona antidrogas a ser aplicado al personal de tropa del 608...Pedro Capitan
 
Memes, Memes Everywhere
Memes, Memes EverywhereMemes, Memes Everywhere
Memes, Memes EverywhereCast From Clay
 

Viewers also liked (20)

Greenit
GreenitGreenit
Greenit
 
Mobile Web Stress: Understanding the Neurological Impact of Poor Performance
Mobile Web Stress:  Understanding the Neurological Impact of Poor PerformanceMobile Web Stress:  Understanding the Neurological Impact of Poor Performance
Mobile Web Stress: Understanding the Neurological Impact of Poor Performance
 
reveal.js 3.0.0
reveal.js 3.0.0reveal.js 3.0.0
reveal.js 3.0.0
 
Google AMP 1 an après : quel bilan, quelles perspectives ?
Google AMP 1 an après : quel bilan, quelles perspectives ?Google AMP 1 an après : quel bilan, quelles perspectives ?
Google AMP 1 an après : quel bilan, quelles perspectives ?
 
mohammad fathi cv2017
mohammad fathi cv2017mohammad fathi cv2017
mohammad fathi cv2017
 
Human Bandwidth
Human BandwidthHuman Bandwidth
Human Bandwidth
 
Scottish Government's International Development Policy- what does it mean for...
Scottish Government's International Development Policy- what does it mean for...Scottish Government's International Development Policy- what does it mean for...
Scottish Government's International Development Policy- what does it mean for...
 
Большой Урал: мониторинг настроений, мнений, планов жителей региона
Большой Урал: мониторинг настроений, мнений, планов жителей региона Большой Урал: мониторинг настроений, мнений, планов жителей региона
Большой Урал: мониторинг настроений, мнений, планов жителей региона
 
Orçamento Participativo Portugal Sessão de Aveiro
Orçamento Participativo Portugal Sessão de AveiroOrçamento Participativo Portugal Sessão de Aveiro
Orçamento Participativo Portugal Sessão de Aveiro
 
22
2222
22
 
Hr governance fheili
Hr governance fheiliHr governance fheili
Hr governance fheili
 
9789740335863
97897403358639789740335863
9789740335863
 
Laravel 5
Laravel 5Laravel 5
Laravel 5
 
avantages des ressources éducatives libres (REL)
avantages des ressources éducatives libres (REL)avantages des ressources éducatives libres (REL)
avantages des ressources éducatives libres (REL)
 
Characteristics of commercial arable farming
Characteristics of commercial arable farmingCharacteristics of commercial arable farming
Characteristics of commercial arable farming
 
Slideshare
SlideshareSlideshare
Slideshare
 
How the 1961 Al-Azhar Law changed the institution
How the 1961 Al-Azhar Law changed the institutionHow the 1961 Al-Azhar Law changed the institution
How the 1961 Al-Azhar Law changed the institution
 
Progama de prevenciona antidrogas a ser aplicado al personal de tropa del 608...
Progama de prevenciona antidrogas a ser aplicado al personal de tropa del 608...Progama de prevenciona antidrogas a ser aplicado al personal de tropa del 608...
Progama de prevenciona antidrogas a ser aplicado al personal de tropa del 608...
 
Scientix stem workshop
Scientix stem workshopScientix stem workshop
Scientix stem workshop
 
Memes, Memes Everywhere
Memes, Memes EverywhereMemes, Memes Everywhere
Memes, Memes Everywhere
 

Similar to Optimizing HTML5 Video

Serverless Media Workflow
Serverless Media WorkflowServerless Media Workflow
Serverless Media WorkflowMooYeol Lee
 
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
 
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
 
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 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
 
Wordcamp Raleigh Multimedia: Photos, Video, and Podcasting
Wordcamp Raleigh Multimedia: Photos, Video, and PodcastingWordcamp Raleigh Multimedia: Photos, Video, and Podcasting
Wordcamp Raleigh Multimedia: Photos, Video, and PodcastingDigital Strategy Works LLC
 
Enhanced Video Experience in SharePoint 2013
Enhanced Video Experience in SharePoint 2013Enhanced Video Experience in SharePoint 2013
Enhanced Video Experience in SharePoint 2013Mai Omar Desouki
 
Encoding Video for the Web - Webinar from ReelSEO.com
Encoding Video for the Web  - Webinar from ReelSEO.comEncoding Video for the Web  - Webinar from ReelSEO.com
Encoding Video for the Web - Webinar from ReelSEO.comMark Robertson ⏩
 
Adobe HTTP Streaming
Adobe HTTP StreamingAdobe HTTP Streaming
Adobe HTTP StreamingYoss Cohen
 
Intro to Compression: Audio and Video Optimization for Learning
Intro to Compression: Audio and Video Optimization for LearningIntro to Compression: Audio and Video Optimization for Learning
Intro to Compression: Audio and Video Optimization for LearningNick Floro
 
ExpressionEngine - Simple Steps to Performance and Security (EECI 2014)
ExpressionEngine - Simple Steps to Performance and Security (EECI 2014)ExpressionEngine - Simple Steps to Performance and Security (EECI 2014)
ExpressionEngine - Simple Steps to Performance and Security (EECI 2014)Nexcess.net LLC
 
Beginning html5 media, 2nd edition
Beginning html5 media, 2nd editionBeginning html5 media, 2nd edition
Beginning html5 media, 2nd editionser
 
Image and Video formates
Image and Video formatesImage and Video formates
Image and Video formatesPrerak Shirpur
 

Similar to Optimizing HTML5 Video (20)

Serverless Media Workflow
Serverless Media WorkflowServerless Media Workflow
Serverless Media Workflow
 
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)
 
Frontcon video
Frontcon videoFrontcon video
Frontcon video
 
Pycon2013
Pycon2013Pycon2013
Pycon2013
 
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
 
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 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
 
Wordcamp Raleigh Multimedia: Photos, Video, and Podcasting
Wordcamp Raleigh Multimedia: Photos, Video, and PodcastingWordcamp Raleigh Multimedia: Photos, Video, and Podcasting
Wordcamp Raleigh Multimedia: Photos, Video, and Podcasting
 
Enhanced Video Experience in SharePoint 2013
Enhanced Video Experience in SharePoint 2013Enhanced Video Experience in SharePoint 2013
Enhanced Video Experience in SharePoint 2013
 
Apan media encoding
Apan media encodingApan media encoding
Apan media encoding
 
Encoding Video for the Web - Webinar from ReelSEO.com
Encoding Video for the Web  - Webinar from ReelSEO.comEncoding Video for the Web  - Webinar from ReelSEO.com
Encoding Video for the Web - Webinar from ReelSEO.com
 
Adobe HTTP Streaming
Adobe HTTP StreamingAdobe HTTP Streaming
Adobe HTTP Streaming
 
HTML5
HTML5 HTML5
HTML5
 
Intro to Compression: Audio and Video Optimization for Learning
Intro to Compression: Audio and Video Optimization for LearningIntro to Compression: Audio and Video Optimization for Learning
Intro to Compression: Audio and Video Optimization for Learning
 
Chapter 1 Video
Chapter 1 VideoChapter 1 Video
Chapter 1 Video
 
ExpressionEngine - Simple Steps to Performance and Security (EECI 2014)
ExpressionEngine - Simple Steps to Performance and Security (EECI 2014)ExpressionEngine - Simple Steps to Performance and Security (EECI 2014)
ExpressionEngine - Simple Steps to Performance and Security (EECI 2014)
 
Html5
Html5Html5
Html5
 
Beginning html5 media, 2nd edition
Beginning html5 media, 2nd editionBeginning html5 media, 2nd edition
Beginning html5 media, 2nd edition
 
Image and Video formates
Image and Video formatesImage and Video formates
Image and Video formates
 
sAudio & video db
sAudio & video dbsAudio & video db
sAudio & video db
 

More from Rigor

Policing ads and 3rd party content at scale on media sites
Policing ads and 3rd party content at scale on media sitesPolicing ads and 3rd party content at scale on media sites
Policing ads and 3rd party content at scale on media sitesRigor
 
Achieving better image optimizations
Achieving better image optimizationsAchieving better image optimizations
Achieving better image optimizationsRigor
 
Improving the Digital UX - By Optimizing for Performance
Improving the Digital UX - By Optimizing for PerformanceImproving the Digital UX - By Optimizing for Performance
Improving the Digital UX - By Optimizing for PerformanceRigor
 
Managing the Performance of Web Applications
Managing the Performance of Web ApplicationsManaging the Performance of Web Applications
Managing the Performance of Web ApplicationsRigor
 
Insights: The Hidden Cost of Web Components
Insights: The Hidden Cost of Web ComponentsInsights: The Hidden Cost of Web Components
Insights: The Hidden Cost of Web ComponentsRigor
 
Rigor | TAG Georgia Technology Summit 2014
Rigor | TAG Georgia Technology Summit 2014Rigor | TAG Georgia Technology Summit 2014
Rigor | TAG Georgia Technology Summit 2014Rigor
 
The Need For Speed - Rigor's slides from ShopVisible Client Connect 2012
The Need For Speed - Rigor's slides from ShopVisible Client Connect 2012The Need For Speed - Rigor's slides from ShopVisible Client Connect 2012
The Need For Speed - Rigor's slides from ShopVisible Client Connect 2012Rigor
 

More from Rigor (7)

Policing ads and 3rd party content at scale on media sites
Policing ads and 3rd party content at scale on media sitesPolicing ads and 3rd party content at scale on media sites
Policing ads and 3rd party content at scale on media sites
 
Achieving better image optimizations
Achieving better image optimizationsAchieving better image optimizations
Achieving better image optimizations
 
Improving the Digital UX - By Optimizing for Performance
Improving the Digital UX - By Optimizing for PerformanceImproving the Digital UX - By Optimizing for Performance
Improving the Digital UX - By Optimizing for Performance
 
Managing the Performance of Web Applications
Managing the Performance of Web ApplicationsManaging the Performance of Web Applications
Managing the Performance of Web Applications
 
Insights: The Hidden Cost of Web Components
Insights: The Hidden Cost of Web ComponentsInsights: The Hidden Cost of Web Components
Insights: The Hidden Cost of Web Components
 
Rigor | TAG Georgia Technology Summit 2014
Rigor | TAG Georgia Technology Summit 2014Rigor | TAG Georgia Technology Summit 2014
Rigor | TAG Georgia Technology Summit 2014
 
The Need For Speed - Rigor's slides from ShopVisible Client Connect 2012
The Need For Speed - Rigor's slides from ShopVisible Client Connect 2012The Need For Speed - Rigor's slides from ShopVisible Client Connect 2012
The Need For Speed - Rigor's slides from ShopVisible Client Connect 2012
 

Recently uploaded

Q4-1-Illustrating-Hypothesis-Testing.pptx
Q4-1-Illustrating-Hypothesis-Testing.pptxQ4-1-Illustrating-Hypothesis-Testing.pptx
Q4-1-Illustrating-Hypothesis-Testing.pptxeditsforyah
 
A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)
A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)
A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)Christopher H Felton
 
Call Girls In The Ocean Pearl Retreat Hotel New Delhi 9873777170
Call Girls In The Ocean Pearl Retreat Hotel New Delhi 9873777170Call Girls In The Ocean Pearl Retreat Hotel New Delhi 9873777170
Call Girls In The Ocean Pearl Retreat Hotel New Delhi 9873777170Sonam Pathan
 
Top 10 Interactive Website Design Trends in 2024.pptx
Top 10 Interactive Website Design Trends in 2024.pptxTop 10 Interactive Website Design Trends in 2024.pptx
Top 10 Interactive Website Design Trends in 2024.pptxDyna Gilbert
 
办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一
办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一
办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一z xss
 
SCM Symposium PPT Format Customer loyalty is predi
SCM Symposium PPT Format Customer loyalty is prediSCM Symposium PPT Format Customer loyalty is predi
SCM Symposium PPT Format Customer loyalty is predieusebiomeyer
 
Magic exist by Marta Loveguard - presentation.pptx
Magic exist by Marta Loveguard - presentation.pptxMagic exist by Marta Loveguard - presentation.pptx
Magic exist by Marta Loveguard - presentation.pptxMartaLoveguard
 
Font Performance - NYC WebPerf Meetup April '24
Font Performance - NYC WebPerf Meetup April '24Font Performance - NYC WebPerf Meetup April '24
Font Performance - NYC WebPerf Meetup April '24Paul Calvano
 
定制(Lincoln毕业证书)新西兰林肯大学毕业证成绩单原版一比一
定制(Lincoln毕业证书)新西兰林肯大学毕业证成绩单原版一比一定制(Lincoln毕业证书)新西兰林肯大学毕业证成绩单原版一比一
定制(Lincoln毕业证书)新西兰林肯大学毕业证成绩单原版一比一Fs
 
Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)
Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)
Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)Dana Luther
 
Call Girls Near The Suryaa Hotel New Delhi 9873777170
Call Girls Near The Suryaa Hotel New Delhi 9873777170Call Girls Near The Suryaa Hotel New Delhi 9873777170
Call Girls Near The Suryaa Hotel New Delhi 9873777170Sonam Pathan
 
Call Girls South Delhi Delhi reach out to us at ☎ 9711199012
Call Girls South Delhi Delhi reach out to us at ☎ 9711199012Call Girls South Delhi Delhi reach out to us at ☎ 9711199012
Call Girls South Delhi Delhi reach out to us at ☎ 9711199012rehmti665
 
Elevate Your Business with Our IT Expertise in New Orleans
Elevate Your Business with Our IT Expertise in New OrleansElevate Your Business with Our IT Expertise in New Orleans
Elevate Your Business with Our IT Expertise in New Orleanscorenetworkseo
 
定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一
定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一
定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一Fs
 
Blepharitis inflammation of eyelid symptoms cause everything included along w...
Blepharitis inflammation of eyelid symptoms cause everything included along w...Blepharitis inflammation of eyelid symptoms cause everything included along w...
Blepharitis inflammation of eyelid symptoms cause everything included along w...Excelmac1
 
定制(AUT毕业证书)新西兰奥克兰理工大学毕业证成绩单原版一比一
定制(AUT毕业证书)新西兰奥克兰理工大学毕业证成绩单原版一比一定制(AUT毕业证书)新西兰奥克兰理工大学毕业证成绩单原版一比一
定制(AUT毕业证书)新西兰奥克兰理工大学毕业证成绩单原版一比一Fs
 
PHP-based rendering of TYPO3 Documentation
PHP-based rendering of TYPO3 DocumentationPHP-based rendering of TYPO3 Documentation
PHP-based rendering of TYPO3 DocumentationLinaWolf1
 

Recently uploaded (20)

Q4-1-Illustrating-Hypothesis-Testing.pptx
Q4-1-Illustrating-Hypothesis-Testing.pptxQ4-1-Illustrating-Hypothesis-Testing.pptx
Q4-1-Illustrating-Hypothesis-Testing.pptx
 
A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)
A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)
A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)
 
Call Girls In The Ocean Pearl Retreat Hotel New Delhi 9873777170
Call Girls In The Ocean Pearl Retreat Hotel New Delhi 9873777170Call Girls In The Ocean Pearl Retreat Hotel New Delhi 9873777170
Call Girls In The Ocean Pearl Retreat Hotel New Delhi 9873777170
 
Top 10 Interactive Website Design Trends in 2024.pptx
Top 10 Interactive Website Design Trends in 2024.pptxTop 10 Interactive Website Design Trends in 2024.pptx
Top 10 Interactive Website Design Trends in 2024.pptx
 
办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一
办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一
办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一
 
SCM Symposium PPT Format Customer loyalty is predi
SCM Symposium PPT Format Customer loyalty is prediSCM Symposium PPT Format Customer loyalty is predi
SCM Symposium PPT Format Customer loyalty is predi
 
Magic exist by Marta Loveguard - presentation.pptx
Magic exist by Marta Loveguard - presentation.pptxMagic exist by Marta Loveguard - presentation.pptx
Magic exist by Marta Loveguard - presentation.pptx
 
Font Performance - NYC WebPerf Meetup April '24
Font Performance - NYC WebPerf Meetup April '24Font Performance - NYC WebPerf Meetup April '24
Font Performance - NYC WebPerf Meetup April '24
 
定制(Lincoln毕业证书)新西兰林肯大学毕业证成绩单原版一比一
定制(Lincoln毕业证书)新西兰林肯大学毕业证成绩单原版一比一定制(Lincoln毕业证书)新西兰林肯大学毕业证成绩单原版一比一
定制(Lincoln毕业证书)新西兰林肯大学毕业证成绩单原版一比一
 
Hot Sexy call girls in Rk Puram 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in  Rk Puram 🔝 9953056974 🔝 Delhi escort ServiceHot Sexy call girls in  Rk Puram 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in Rk Puram 🔝 9953056974 🔝 Delhi escort Service
 
Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)
Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)
Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)
 
Call Girls Near The Suryaa Hotel New Delhi 9873777170
Call Girls Near The Suryaa Hotel New Delhi 9873777170Call Girls Near The Suryaa Hotel New Delhi 9873777170
Call Girls Near The Suryaa Hotel New Delhi 9873777170
 
Call Girls South Delhi Delhi reach out to us at ☎ 9711199012
Call Girls South Delhi Delhi reach out to us at ☎ 9711199012Call Girls South Delhi Delhi reach out to us at ☎ 9711199012
Call Girls South Delhi Delhi reach out to us at ☎ 9711199012
 
Elevate Your Business with Our IT Expertise in New Orleans
Elevate Your Business with Our IT Expertise in New OrleansElevate Your Business with Our IT Expertise in New Orleans
Elevate Your Business with Our IT Expertise in New Orleans
 
定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一
定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一
定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一
 
young call girls in Uttam Nagar🔝 9953056974 🔝 Delhi escort Service
young call girls in Uttam Nagar🔝 9953056974 🔝 Delhi escort Serviceyoung call girls in Uttam Nagar🔝 9953056974 🔝 Delhi escort Service
young call girls in Uttam Nagar🔝 9953056974 🔝 Delhi escort Service
 
Model Call Girl in Jamuna Vihar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in  Jamuna Vihar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in  Jamuna Vihar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Jamuna Vihar Delhi reach out to us at 🔝9953056974🔝
 
Blepharitis inflammation of eyelid symptoms cause everything included along w...
Blepharitis inflammation of eyelid symptoms cause everything included along w...Blepharitis inflammation of eyelid symptoms cause everything included along w...
Blepharitis inflammation of eyelid symptoms cause everything included along w...
 
定制(AUT毕业证书)新西兰奥克兰理工大学毕业证成绩单原版一比一
定制(AUT毕业证书)新西兰奥克兰理工大学毕业证成绩单原版一比一定制(AUT毕业证书)新西兰奥克兰理工大学毕业证成绩单原版一比一
定制(AUT毕业证书)新西兰奥克兰理工大学毕业证成绩单原版一比一
 
PHP-based rendering of TYPO3 Documentation
PHP-based rendering of TYPO3 DocumentationPHP-based rendering of TYPO3 Documentation
PHP-based rendering of TYPO3 Documentation
 

Optimizing HTML5 Video

  • 2. Agenda • Overview of HTML5 Video • Optimizing for context • Optimizing for content • Bonus: Animated GIFs
  • 3. What Is HTML5 Video?
  • 4. Terminology • Container Format • The file/structure used to store stuff (MP4, WebM, AVI) • Audio data, Video data, Meta data • Codec • Algorithm used to compress/encode video/audio • Video: H.264, VP8, VP9, Theora • Bitrate • I’ll probably just say MP4 Video, WebM Video, etc
  • 8. So… Multiple Video Types? • Yeah • It’s complicated • Concerns about how owns patents on codecs/algorithms • Concerns about licensing costs • Really a proxy fight between the browsers creators
  • 10. WebM Has Strong Support
  • 12. Getting the data • Playing a local file • Pseudo Streaming • HTTP get requests • Adaptive/Live Streaming • HTTP Live Streaming • MPEG-DASH • Flash stuff
  • 14. 3 Rules of Frontend Performance 1. Reduce the amount of data 2. Reduce the number of requests 3. Structure data for optimal downloading and rendering
  • 15. Is it the Right Size? Video File: 1280 x 720
  • 18. Muted HTML5 Video as Hero…
  • 20. Playing an HTML5 Video • Fetches Video file • Using Range requests as you skip around the file
  • 21. Aside: Support Range Requests! • HTTP Range Request • Accept-Ranges • Range: • Allows browser to do partial downloads • Required for seeking/streaming • Easy to test support
  • 22. Structure of a MP4 File • Made of “Atoms” • Contains discrete pieces of data (like PNG chunks) • Video data, audio data, meta data, everything • moov atom acts like a table of contents
  • 23. Jumping around to find the MOOV
  • 24. Move the MOOV • If we move it to the front… • 1 HTTP Request... • 200ms of delay missed... • 600KB of content avoided...
  • 25. Do it right from the start
  • 26. Remember These Guys… • Other formats for compatibility • … ... Leverage as an optimization? • How browsers choose the video • Look at each <source> • Support type? • Play it!
  • 27. Bloated Default HTML5 Video • Formats store data differently • What if MP4 is larger than WebM? • Too bad • Take Away: Place smallest source first • Example: https://headspin.io/
  • 28. Multiple Video Sources. Same Quality?
  • 29. Multiple Video Sources. Same Bitrate?
  • 30. Structure of a WebM File • Really just a subset of Matroska container (MKV) • Made of “Elements” • Contains discrete pieces of data (like PNG chunks) • Video data, audio data, meta data, everything • “SeekHead” element acts like a table of contents • Sounding familiar… ?
  • 31. Seeking around to find the SeekHead…
  • 32. Optimize WebM Structure • Only 1 SeekHead element, placed at the front… • Great open source tool mkclean
  • 33. Other Standard Optimizations • Are you caching the file? • Do you have a Last-Modified header?
  • 34. BONUS! Optimizing Animated GIFs… … the other “video” format
  • 35. Animated GIFs: Amazing it even works “The Graphics Interchange Format is not intended as a platform for animation, even though it can be done in a limited way.” - GIF89A Specification
  • 36. Animated GIFs: The Good • Universal support on all platforms • No patent or licensing concerns • Easy, widely available creation tools • A culture that has grown around creating and sharing funny animated GIFs.
  • 37. Animated GIFs: The (Unbelievably) Bad • 256 colors per video frame • LZW compression sucks for photographic data • Animated system not designed differences between video frames • No sexy video tricks • chroma subsampling, discrete cosine transforms, or motion compensation • No hardware support on mobile • More CPU, RAM, Power • 5x to 10x larger than a properly encoded video
  • 39. Lossless Animated GIF Optimization • Gifsicle • Standard lossless optimizations • Remove non-graphic stuff • Find deltas between animation frames… • Pretty good for animations • Terrible for video
  • 40. Lossy Optimization for Animated GIFs • Lossy matching in the LZW encoder • Modified version of gifsicle 2.9 MB 1.1 MB https://kornel.ski/lossygif
  • 41. Fake GIF as an MP4?
  • 43. Animated GIF as MP4 • Convert GIF to MP4 with ffmpeg • Alter the HTML markup
  • 44. HTML5 Video Optimization Check List • Is your video optimized for how it will be used? • Is your <VIDEO> tag using the right size? • Is your <VIDEO> muted? Strip the audio! • Does your server use HTTP Range Requests? • What about Last-Modified? • What about Expires/Cache-Control? • Are you using multiple <SOURCE> tags? • Is the smallest file first? • Are all the videos roughly the same bitrate?
  • 45. HTML5 Video Optimization Check List (con’t) • Are your MP4 files optimized for fast start? • Are your WebM files optimized for fast start and fast seeking? • Animated GIFs • Use lossless for animations • Use Lossy for video clips • Advanced: Try converting to MP4 instead…