Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Video Killed My Data Plan: Delivering video that doesn't break the bank

Video Killed My Data Plan: Delivering video that doesn't break the bank

Video is one of the best ways to engage with your audience. But unoptimized video can take forever to startup and can stall, increasing frustration and abandonment. I’ll discuss video delivery best practices to make sure your video content is delivered beautifully and quickly without stalling.

Video is one of the fastest growing mediums on the web and in mobile applications. Video files have been shown to increase engagement, and can be a great way to deliver your message quickly. (And who doesn’t love animated GIFs?)

However, video that takes a long time to start up leads to frustration and abandonment. The same goes for video that stalls during playback. In this talk, you’ll learn best practices to optimize the delivery of your video to your customers, ensuring fast delivery and minimizing stalls for a great customer experience.

FrontConf

March 21, 2020
Tweet

More Decks by FrontConf

Other Decks in Programming

Transcript

  1. Video Killed My Data Plan Delivering video that doesn't break

    the bank Doug Sillars @dougsillars FrontConf March 21, 2020
  2. Video Killed My Data Plan Delivering video that doesn't break

    the bank Doug Sillars @dougsillars FrontConf March 21, 2020 The Internet
  3. Today’s Itinerary •0930 HTML Video: The Basics •1100 Coffee •1130

    Accessibility & Performance •1300 Lunch •1400 Formats, Encoding, Quality and Playback •1530 Coffee •1400 Video of Demand: Streaming •1730 Done!
  4. HTML Video: The Basics <video autoplay width=720p height = 100p

    src=video.mp4> </video> https://codepen.io/dougsillars/project/full/XpROwa
  5. HTML Video: The Basics <video autoplay muted loop src=video.mp4> </video>

    https://codepen.io/dougsillars/project/full/XpROwa
  6. HTML Video: The Basics <video autoplay muted loop src=video.mp4> </video>

    https://codepen.io/dougsillars/project/full/XpROwa It’s a GIF!! (or is it?)
  7. HTML Video: The Basics <video autoplay muted loop src=video.mp4> </video>

    https://codepen.io/dougsillars/project/full/XpROwa It’s a GIF!! (or is it?)
  8. HTML Video: The Basics Preload = none Preload = metadata

    https://codepen.io/dougsillars/project/full/XpROwa
  9. HTML Video: The Basics Preload = none Preload = metadata

    https://codepen.io/dougsillars/project/full/XpROwa
  10. HTML Video: The Basics Preload = none Preload = metadata

    Preload = auto https://codepen.io/dougsillars/project/full/XpROwa
  11. HTML Video: The Basics Preload = none Preload = metadata

    Preload = auto https://codepen.io/dougsillars/project/full/XpROwa
  12. <video autoplay width=720p> <source src= video.webm> <source src= video.mp4> Your

    Browser does not support video. </video> Multiple Sources https://codepen.io/dougsillars/project/full/XpROwa
  13. Video Delivery First Example <div class="video-container" aria-hidden="true"> <video class="desktop-video" muted

    autoplay loop playsinline> <source src="TrumpTowerTheExperiencev2.mp4"> Your browser does not support this video. </video> <video class="mobile-video" muted autoplay loop playsinline> <source src="TrumpTowerTheExperiencev2Mobile.mp4"> Your browser does not support this video. </video> </div>
  14. Video Delivery Second Example <div class="fullscreen-bg"> <video loop muted autoplay

    playsinline poster="firstframe.jpg" class="fullscreen-bg__video"> <source src="bg.mp4" type="video/mp4"> </video> </div>
  15. Video Delivery Second Example <div class="fullscreen-bg"> <video loop muted autoplay

    playsinline poster="firstframe.jpg" class="fullscreen-bg__video"> <source src="bg.mp4" type="video/mp4"> </video> </div>
  16. Performance 1 Does the Video Start? 2 Does the Video

    Stall? 3 Does it Look Good? Optimizing video delivery can help solve many of these issues
  17. Performance: Start & Stalls What is Causing the delay? 1.

    Network Speed 2. Video Size 3. Video Duration 4. Video Dimensions 5. Video Bitrate https://dougsillars.com/2019/09/16/state-of-the-web-video-playback-metrics/
  18. Video Sizing ReSizing Videos with Cloudinary https://res.cloudinary.com/dougsillars/video/upload/v1554841934/Bidwells_Shorty_PartA 4_vahyoz.mp4 https://res.cloudinary.com/dougsillars/video/upload/vc_auto,w_1280/v1554841934/Bidw ells_Shorty_PartA4_vahyoz.mp4

    Width Size (MB) Bitrate (MBPS) Video Startup (s) % time <5s buffer MP4 1920 72.9 20 121 NA mp4 (vc_auto) 1920 1280 7.7 4.64 2.1 1.3 14 56% webm 1920 1280 7 3.9 2.0 1.0 11 56% Video Timing Metrics: https://dougsillars.git hub.io/StreamOrNot/
  19. Video Sizing ReSizing Videos with Cloudinary https://res.cloudinary.com/dougsillars/video/upload/v1554841934/Bidwells_Shorty_PartA 4_vahyoz.mp4 https://res.cloudinary.com/dougsillars/video/upload/vc_auto,w_1280/v1554841934/Bidw ells_Shorty_PartA4_vahyoz.mp4

    Width Size (MB) Bitrate (MBPS) Video Startup (s) % time <5s buffer MP4 1920 72.9 20 121 NA mp4 (vc_auto) 1920 1280 7.7 4.64 2.1 1.3 14 3 56% 32% webm 1920 1280 7 3.9 2.0 1.0 11 3 56% 20% Video Timing Metrics: https://dougsillars.git hub.io/StreamOrNot/
  20. Video Sizing: One More Thing <video class="hero-canvas__video" loop muted preload="auto"

    poster="/assets/Uploads/banners/Bidwells_Shorty_PartB2.jpg"> <source src="https://s3-eu-west-1.amazonaws.com/bidwells-website/homepage-vid eos/Bidwells_Shorty_PartB4.mp4" type="video/mp4" /> <source src="https://s3-eu-west-1.amazonaws.com/bidwells-website/homepage-vid eos/Bidwells_Shorty_PartB4.webm" type="video/webm" /> </video>
  21. Video Sizing: One More Thing Size Bitrate mp4 73 MB

    20 MBPS webm 34.7 MB 9.7 MBPS <video class="hero-canvas__video" loop muted preload="auto" poster="/assets/Uploads/banners/Bidwells_Shorty_PartB2.jpg"> <source src="https://s3-eu-west-1.amazonaws.com/bidwells-website/homepage-vid eos/Bidwells_Shorty_PartB4.mp4" type="video/mp4" /> <source src="https://s3-eu-west-1.amazonaws.com/bidwells-website/homepage-vid eos/Bidwells_Shorty_PartB4.webm" type="video/webm" /> </video>
  22. Video Sizing: One More Thing Size Bitrate mp4 73 MB

    20 MBPS webm 34.7 MB 9.7 MBPS <video class="hero-canvas__video" loop muted preload="auto" poster="/assets/Uploads/banners/Bidwells_Shorty_PartB2.jpg"> <source src="https://s3-eu-west-1.amazonaws.com/bidwells-website/homepage-vid eos/Bidwells_Shorty_PartB4.webm" type="video/webm" /> <source src="https://s3-eu-west-1.amazonaws.com/bidwells-website/homepage-vid eos/Bidwells_Shorty_PartB4.mp4" type="video/mp4" /> </video>
  23. Video Sizing: One More Thing Size Bitrate mp4 73 MB

    20 MBPS webm 34.7 MB 9.7 MBPS <video class="hero-canvas__video" loop muted preload="auto" poster="/assets/Uploads/banners/Bidwells_Shorty_PartB2.jpg"> <source src="https://s3-eu-west-1.amazonaws.com/bidwells-website/homepage-vid eos/Bidwells_Shorty_PartB4.webm" type="video/webm" /> <source src="https://s3-eu-west-1.amazonaws.com/bidwells-website/homepage-vid eos/Bidwells_Shorty_PartB4.mp4" type="video/mp4" /> </video>
  24. Video Sizing: One More Thing <video class="hero-canvas__video" loop muted preload="auto"

    poster="/assets/Uploads/banners/Bidwells_Shorty_PartB2.jpg"> <source src="https://s3-eu-west-1.amazonaws.com/bidwells-website/homepage-vid eos/Bidwells_Shorty_PartB4.mp4" type="video/mp4" /> <source src="https://s3-eu-west-1.amazonaws.com/bidwells-website/homepage-vid eos/Bidwells_Shorty_PartB4.webm" type="video/webm" /> </video> Size Bitrate mp4 73 MB 20 MBPS webm 34.7 MB 9.7 MBPS
  25. Video Sizing: One More Thing <video class="hero-canvas__video" loop muted preload="auto"

    poster="/assets/Uploads/banners/Bidwells_Shorty_PartB2.jpg"> <source src="https://s3-eu-west-1.amazonaws.com/bidwells-website/homepage-vid eos/Bidwells_Shorty_PartB4.mp4" type="video/mp4" /> <source src="https://s3-eu-west-1.amazonaws.com/bidwells-website/homepage-vid eos/Bidwells_Shorty_PartB4.webm" type="video/webm" /> </video> Size Bitrate mp4 73 MB 20 MBPS webm 34.7 MB 9.7 MBPS AWS S3 costs $0.09/GB data transfer
  26. Video Sizing: One More Thing <video class="hero-canvas__video" loop muted preload="auto"

    poster="/assets/Uploads/banners/Bidwells_Shorty_PartB2.jpg"> <source src="https://s3-eu-west-1.amazonaws.com/bidwells-website/homepage-vid eos/Bidwells_Shorty_PartB4.mp4" type="video/mp4" /> <source src="https://s3-eu-west-1.amazonaws.com/bidwells-website/homepage-vid eos/Bidwells_Shorty_PartB4.webm" type="video/webm" /> </video> Size Bitrate S3 load cost mp4 73 MB 20 MBPS $0.006 webm 34.7 MB 9.7 MBPS $0.003 Mp4 (1280px) 4.64 MB 1.3 MBPS $0.0004
  27. Video Sizing: One More Thing <video class="hero-canvas__video" loop muted preload="auto"

    poster="/assets/Uploads/banners/Bidwells_Shorty_PartB2.jpg"> <source src="https://s3-eu-west-1.amazonaws.com/bidwells-website/homepage-vid eos/Bidwells_Shorty_PartB4.mp4" type="video/mp4" /> <source src="https://s3-eu-west-1.amazonaws.com/bidwells-website/homepage-vid eos/Bidwells_Shorty_PartB4.webm" type="video/webm" /> </video> Size Bitrate S3 load cost mp4 73 MB 20 MBPS $0.006 webm 34.7 MB 9.7 MBPS $0.003 Mp4 (1280px) 4.64 MB 1.3 MBPS $0.0004 Lower your AWS bill by 15x with this one simple trick!
  28. Measuring Video Clarity Compare original reference video to smaller version:

    Structural SIMularity (SSIM) Peak Signal to Noise (PSNR) Video MultiMethod Assessment Fusion (VMAF) MOS SSIM PSNR (db) VMAF 5 (excellent) >0.99 50 >95 4 (good) 0.95-0.99 38 3 (fair) 0.88 - 0.95 30 70 2 (poor) 0.5 - 0.88 22 1 (bad) <0.5 15 20
  29. Measuring Video Clarity Compare original reference video to smaller version:

    SSIM, PSNR are available in FFMPEG VMAF can be added to FFMPEG
  30. Measuring Video Clarity Compare original reference video to smaller version:

    SSIM, PSNR are available in FFMPEG VMAF can be added to FFMPEG
  31. Measuring Video Clarity www.streamclarity.com Width Size (MB) VMAF SSIM PSNR

    MP4 (q_99) 1280 18 100 mp4 (q_auto) 1280 960 4.5 3 99 97 0.992 0.988 39 36 Testing at 1280x720, Video is indistinguishable from original
  32. Conclusion Tools: WebPageTest http://webpagetest.org Stream or Not https://dougsillars.github.io/StreamOrNot/ Stream Clarity:

    http://streamclarity.com FFMPEG https://ffmpeg.org Video Hosting: Cloudinary http://cloudinary.com