View
214
Download
2
Embed Size (px)
Citation preview
Video Streaming in FlashVideo Streaming in Flash
CSCI 4220 – Network ProgrammingCSCI 4220 – Network Programming
Kacper HarabaszKacper Harabasz
ChallengesChallenges
• Video’s major problem is compression, which leads to many proprietary formats.
• Today’s major players are Microsoft, Real, Apple’s QuickTime, and now Flash.
Why Choose Flash?Why Choose Flash?
• Other players can require video drivers on top of their players. For example DivX.
• Flash circumvents this by converting stream able media to its own format, which is better compressed and optimized for streaming, although at a loss to quality.
• It is really easy. Adobe has done most of the work for you.
Streaming in FlashStreaming in Flash
• Flash is Vector, not Bitmap based.• Images are represented as a set of points
and geometric figures, as opposed to pixels.
• Adobe is the ‘leader’ in both markets, with Photoshop (bitmap), Illustrator (vector), Director Suite (vector).
• Free alternates are The Gimp (bitmap) and Inkscape (vector).
Streaming in FlashStreaming in Flash
• Thanks to this vector representation, Flash can save considerable space over other formats.
• This is done by storing the representation of an image in the first frame of animation, and than having each successive frame hold information on how the vector changes.
• The actual codec belongs to Sorenson Media, and the product is called Sorenson Squeeze.
• Most other formats stream on a per pixel basis. Each pixel that changes from frame to frame must be sent in the stream.
Progressive DownloadProgressive Download
• Flash Player caches the media as it is downloaded from the destination. This is a very convincing imitation of streaming. Some Limitations are:– It cannot be used for live events, only stored video
files. – It is less efficient than true streaming. – It cannot automatically adjust for the end user's
connection speed. – It is not secure, the video file is saved on the end
user's computer. – The end user cannot jump ahead to a later part of the
video until it has downloaded.
Flash Media ServerFlash Media Server
• In Adobe’s own words, “The product is server based software which runs media applications developed for it with the Flash authoring tool.”
• Works by opening a "persistent connection" between the server and client. In a normal server/client relationship the client sends periodic requests to the server as required. With a persistent connection the server and client are in constant, controlled contact.
• Handles Bandwidth detection, Player detection (flash version), Dynamic buffering, basically everything that usually gives network programmers a headache.
Case Study - YouTubeCase Study - YouTube
• Developed by Steve Chen, Chad Hurley, and Jawed Karim, while working at PayPal.
• Needed a way to post a video online after a party. At that time, there was no easy way to do it.
How is it done?How is it done?
• When a user uploads a video to YouTube, an ‘agent’ processes the upload to produce a .flv (Flash Video File) using Adobe’s Video Encoder. Also, a still image is captured to represent the clip during search results and previews.
• A short 10-12 char, randomly generated string serves as the ‘key’ for the media.
How is it done?How is it done?
• Flash Player and Flash Media Server• Player embedded into webpage.• The embed calls a url, which is re-written
to hit a script that converts the ‘key’ to the location of the media on the Flash Media Server. A new url is constructed, and the script forwards the original embed call to a Flash Player with the location of the media on the Flash Media Server.
How is it done?How is it done?
• Now that it is correctly referencing the media, the Flash Player and Flash Media Server interact to stream the media. This is true streaming.
• Flash provides the classes that handle this interaction for the programmer.
Creating a PlayerCreating a Player
• Demonstration of a Progressive Download Streamer (Hey, Flash Media Server isn’t cheap!)
• Short Introduction to the Flash Environment.
• Explanation of Code.