Video streaming on the Web


Introduction to Web-based video streaming,
and lessons learned at Norwegian Research Council


Arild Nilsen
Anja Svartberg
Brynjulv Brynulvsen


August, 2012

Outline

  • History
  • Video streaming technologies
  • Experiences from project

Outdated technologies

RealMedia

QuickTime

Windows Media

(.rm)

(.mov/.qt)

(.wmv)


	<object>
	    <!-- censored due to verbosity -->
	    <embed>
	    ...
	    </embed>
	</object>
				

The road towards HTML5 video

  • 2005: Discussion about <video> starts
  • 2007: Opera supports <video>
  • 2010: YouTube and Vimeo support HTML5 video

Why did Flash conquer the market?

  • Flash is more than just video
  • Tools and codecs
  • 2005: Google videos and Youtube launched using Flash

HTML5 video

Cross browser <video> element


	<video src="HelloWorld.webm" ></video>
					

@controls and <source>

						
	<video controls>
	    <source src="HelloWorld.mp4" type="video/mp4">
	    <source src="HelloWorld.webm" type="video/webm">
	    <source src="HelloWorld.ogg" type="video/ogg">
	</video>
					
					

@poster and @width

						
	<video controls poster="HelloWorld.jpg" width="400">
	    <source src="HelloWorld.mp4" type="video/mp4">
	    <source src="HelloWorld.webm" type="video/webm">
	    <source src="HelloWorld.ogg" type="video/ogg">
	</video>
					
					

@preload and video scaling

						
	<video controls preload="none">
	    <source src="HelloWorld.mp4" type="video/mp4">
	    <source src="HelloWorld.webm" type="video/webm">
	    <source src="HelloWorld.ogg" type="video/ogg">
	</video>
					
					

HTML5 video + CSS3

Box model and video


	<video>...</video>       
					

	video {
	    width: 500px;           
	    padding: 15px;           
	    border: 5px solid black;           
	    border-radius: 15px; /* rounded corners */          
	    box-shadow: 10px 10px 5px gray;           
	    box-sizing: border-box;
	}         
					

Positioning and video

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.


	<body>
	    <video>...</video>       
	    <p>...</p>
	    <p>...</p>
	<body>
					

	video {
	    width: 40%;
	    float: right;
	    border: 5px solid black;         
	}         
					

Absolute positioning and opacity


	<body>
	    <video>...</video>       
	    <img>
	<body>
					

	video {
	    width: 25%;
	    position: absolute;
	    padding: 50px;	
	    opacity: 0.5;					
	}         
					

HTML5 video + JavaScript


	<video controls id="videoPlayer">
	    ...
	</video>
				

	var v = document.getElementById('videoPlayer');
	v.volume = 0.5;
	v.currentTime = v.duration - 3;
	v.play();
	v.addEventListener('ended', function videoEndedHandler(e) {
	    v.autoplay = true;
	    v.src = 'HelloWorld2.webm';
	});
				

HTML5 video + headache(s)

Current codec support

retrieved Aug. 28, 2012

h.264 seems to win the codec-war


h.264 ubiquitous on mobile devices


Mozilla execs capitulate in H.264 Web-video war

CNET News, March 2012


Though H.264 plays an important role in video, as our goal is to enable open innovation, support for the codec will be removed and our resources directed towards completely open codec technologies.

The Chromium Blog, January 2011

Adaptive streaming


Not supported in HTML5 video


Dynamically adapt video stream to ensure a good user experience


HTTP Live Streaming


HTTP-based adaptive streaming by Apple




Early stages of Internet Engineering Task Force (IETF) standardization


How to use HTTP Live Streaming?



	<video controls>
	    <source src="HelloWorld.m3u8" type="video/mp4">
	    <source src="HelloWorld.mp4" type="video/mp4">
	    <source src="HelloWorld.webm" type="video/webm">
	    <source src="HelloWorld.ogg" type="video/ogg">
	</video>
				


	#EXTM3U
	#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=1280000
	http://example.com/low.m3u8
	#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=2560000
	http://example.com/mid.m3u8
	#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=7680000
	http://example.com/hi.m3u8
				

?

Is Flash dying? – Mobile Platforms

  • Not supported on Apple mobile devices
  • Essentially dead on Android
  • Adobe kills mobile Flash, giving Steve Jobs the last laugh

    The Guardian, 2011

Is Flash dying? – Desktop

  • Flash player 11.2 -> last version for Linux
  • Not pre-installed on several Apple products
  • Windows 8?

What does Adobe say?

HTML5 is great. It’s a great move forward for video on the web

Kevin Lynch, Adobe CTO


Adobe's roadmap for Flash:

Looking forward, Adobe believes that Flash is particularly suited for addressing the gaming and premium video markets, and will focus its development efforts in those areas.

&
(...) including 11.2 and the subsequent 2012 release, we are also modernizing the Flash runtime’s code base in order to ensure that the Flash runtimes meet the needs of developers over the next five to 10 years.

Experiences and lessons learned at
Norwegian Research Council

Video Archive at Norwegian Research Council

Mobile version

Available technologies

Flash

HTML5 video

HTTP Live Streaming

RTSP

Microsoft Smooth Streaming

Serving video of different quality

	
	Nfr.VideoResolution = function() {
	    if (Nfr.Platform.isPhone()) {
	        if (screen.width * screen.height < 480 * 800)
	            // 400 kbps, height 320 (width resized)
	        else 
	            // 1000 kbps, height 320 (width resized)
	    }
	    else if (Nfr.Platform.isPad()) {
	        if (screen.width * screen.height < 1024 * 768)
	            // 400 kbps, height 576 (width resized)
	        else
	            // 1000 kbps, height 576 (width resized)
	    }
	    else
	        // 1500 kbps, width 720p (height resized)
	};
				

Backward compatibility adds complexity

What does the customer say?

  • It works on all relevant platforms
  • It streams smoothly on mobile devices, and over mobile connections
  • Loading time over mobile connection
  • All kommunikasjon med den tyske leverandøren har gått på epost og dette har stort sett gått greit.

    Bjørn Holta, seniorrådgiver/webredaktør forskningsradet.no

Where to learn more?

Robert Reinhardt

?

Presentation available at:

arild.github.com/fagdag_aug2012