mm-4113, vp9 – next generation video for the web, by james bankoski

26
VP9 - Next Generation Video For the Web Developer Summit

Upload: amd-developer-central

Post on 15-Jan-2015

640 views

Category:

Technology


3 download

DESCRIPTION

Presentation MM-4113, Vp9 – Next Generation Video For the Web, by James Bankoski, at the AMD Developer Summit (APU13) November 11-13, 2013.

TRANSCRIPT

Page 1: MM-4113, Vp9 – Next Generation Video For the Web, by James Bankoski

VP9 - Next Generation Video For the Web

Developer Summit

Page 2: MM-4113, Vp9 – Next Generation Video For the Web, by James Bankoski

VP9 - Next Generation Video For the Web

Agenda

● Introduction● Why use HTML5 and VP9 for video? ● How you can make video files.● How to put video on a web page.● Some more advanced things you can do. ● Conclusion.

Page 3: MM-4113, Vp9 – Next Generation Video For the Web, by James Bankoski

VP9 - Next Generation Video For the Web

Introduction

● About me● WebM Project Org (webmproject.org)● Chrome Media

Page 4: MM-4113, Vp9 – Next Generation Video For the Web, by James Bankoski

VP9 - Next Generation Video For the Web

Benefits of using the Web for Your Video Application

● Free deployment● Works everywhere● Simple to develop● Easy usage tracking● Functionality

Page 5: MM-4113, Vp9 – Next Generation Video For the Web, by James Bankoski

VP9 - Next Generation Video For the Web

Demo - The Same Video App Running 2 places

Run

Page 6: MM-4113, Vp9 – Next Generation Video For the Web, by James Bankoski

VP9 - Next Generation Video For the Web

Why use VP9

● Saves you bits and bits = money

○ Incorrect estimates from: Forbes○ These estimates say :

■ Gangnam Style cost $300k to store and serve○ Cut that in half if we used VP9

■ Especially useful for mobile users

● Need lossless

● To avoid licensing restrictions

Page 7: MM-4113, Vp9 – Next Generation Video For the Web, by James Bankoski

VP9 - Next Generation Video For the Web

Why is this important?

Page 8: MM-4113, Vp9 – Next Generation Video For the Web, by James Bankoski

VP9 - Next Generation Video For the Web

YouTube Statistics

Over 100 Hours of video uploaded every minute

Over 1 Billion unique users every month

Over 6 Billion Hours viewed every month

Over 70% of users are non-US

Page 9: MM-4113, Vp9 – Next Generation Video For the Web, by James Bankoski

VP9 - Next Generation Video For the Web

Page 10: MM-4113, Vp9 – Next Generation Video For the Web, by James Bankoski

VP9 - Next Generation Video For the Web

Demo - VP9 Vs H264

Run

Page 11: MM-4113, Vp9 – Next Generation Video For the Web, by James Bankoski

VP9 - Next Generation Video For the Web

At the same bitrate

Run

Page 12: MM-4113, Vp9 – Next Generation Video For the Web, by James Bankoski

VP9 - Next Generation Video For the Web

How to encode a video file : Hands On!

● Get and build FFmpeg with the instructions found here : ○ https://sites.google.com/a/webmproject.org/wiki/ffmpeg/building-with-libvpx

● Record using camera or phone & store on your computer● Run a 2 pass encode like this:

ffmpeg -i MYINPUTFILE -pass 1 -passlogfile t -b:v 350k -auto-alt-ref 1 -vf scale=iw/2:-1 -vcodec libvpx-vp9 -strict experimental MYOUTPUTFILE.webm

ffmpeg -i MYINPUTFILE -pass 2 -passlogfile t -b:v 350k -auto-alt-ref 1 -arnr_max_frames 7 -vf scale=iw/2:-1 -vcodec libvpx-vp9 -strict experimental -acodec libvorbis -b:a 96k MYOUTPUTFILE.webm

● View the results ○ ffplay MYOUTPUTFILE.webm

Page 13: MM-4113, Vp9 – Next Generation Video For the Web, by James Bankoski

VP9 - Next Generation Video For the Web

Putting Video on a Web Page

● Copy the video file you created to your webserver● Create a web page that looks something like this:

<HTML> <body>

<video src="MYOUTPUTVIDEO.webm" loop="loop" autoplay controls></video> </body></html>

● Make sure your videos have the right permission● Test your new web page. run

Page 14: MM-4113, Vp9 – Next Generation Video For the Web, by James Bankoski

VP9 - Next Generation Video For the Web

Adaptive Bitrate Video

Run

Page 15: MM-4113, Vp9 – Next Generation Video For the Web, by James Bankoski

VP9 - Next Generation Video For the Web

Adaptive Bitrate Control

● Follow the instructions here: http://wiki.webmproject.org/adaptive-streaming/instructions-to-playback-a-webm-dash-presentation

● Create a manifest file listing separate files at each separate bandwidth

● You’ll be using MediaSource instead of <video> tag…

Page 16: MM-4113, Vp9 – Next Generation Video For the Web, by James Bankoski

VP9 - Next Generation Video For the Web

Green Screen

Run

Page 17: MM-4113, Vp9 – Next Generation Video For the Web, by James Bankoski

VP9 - Next Generation Video For the Web

Green Screen

● Make your own http://updates.html5rocks.com/2013/07/Alpha-transparency-in-Chrome-video○ Film with a colored back drop○ use an open source tool like Blender to key the color :○ export png or rgba○ convert to WebM using FFmpeg...

● Lots of ways to render○ use <video> tag and just play the video over the background image.○ use <canvas> and draw videos on top of it .

Page 18: MM-4113, Vp9 – Next Generation Video For the Web, by James Bankoski

VP9 - Next Generation Video For the Web

WebGL and Video

Run

Page 19: MM-4113, Vp9 – Next Generation Video For the Web, by James Bankoski

VP9 - Next Generation Video For the Web

Using WebGL with the Video Tag

● Draw a video tag ● use gl.createFramebuffer, gl.createRenderbuffer and gl.

createTexture to set up gl buffers● use gl.createShader, gl.shaderSource, gl.compileShader to set up

shaders● use gl.bindTexture to get the data into a webgl texture● use webkitRequestAnimationFrame; to make sure you get every

frame

Page 20: MM-4113, Vp9 – Next Generation Video For the Web, by James Bankoski

VP9 - Next Generation Video For the Web

Subtitles

Run

Page 21: MM-4113, Vp9 – Next Generation Video For the Web, by James Bankoski

VP9 - Next Generation Video For the Web

Subtitles - http://www.html5rocks.com/en/tutorials/track/basics/

● Creating a WebVtt file like this bbb_subtitles.vtt:WEBVTT

100:00.800 --> 00:02.933This is a Sample Subtitle Track to show off

200:02.933 --> 00:07.333HTML5 VIDEO ACCESSIBILITY AND THE WebVTT FILE FORMAT.

● and refer to it in your HTML <video id="vid1" src="bbb_nosubtitles.webm" controls="true" autoplay> <track kind='subtitles' srclang='en' label='English' src='bbb_subtitles.vtt' default /> </video>

Page 22: MM-4113, Vp9 – Next Generation Video For the Web, by James Bankoski

VP9 - Next Generation Video For the Web

CuePoints

Run

Page 23: MM-4113, Vp9 – Next Generation Video For the Web, by James Bankoski

VP9 - Next Generation Video For the Web

Cue Points (http://www.samdutton.net/mapTrack/)

● A simple extension to the webvtt file

Page 24: MM-4113, Vp9 – Next Generation Video For the Web, by James Bankoski

VP9 - Next Generation Video For the Web

Video Conferencing in Javascript

Run

Page 25: MM-4113, Vp9 – Next Generation Video For the Web, by James Bankoski

VP9 - Next Generation Video For the Web

WebRTC - ( www.webrtc.org )

● http://www.html5rocks.com/en/tutorials/webrtc/infrastructure/● You’ll be using interfaces like

○ getUserMedia ( to get access to the camera and microphone)○ RTCPeerConnection ( to set up connections to the other side)

● getUserMedia will let you do lots of other cool things. :)

Page 26: MM-4113, Vp9 – Next Generation Video For the Web, by James Bankoski

VP9 - Next Generation Video For the Web

Conclusion

● You should use HTML5 for video.● Use VP9.● Do a ton of cool stuff with it.

Any questions? using our mailing list post: [email protected] subscribe: [email protected].