Upcoming SlideShare
×

# Encoding For the Web Encoding for the Web

543 views

Published on

1 Like
Statistics
Notes
• Full Name
Comment goes here.

Are you sure you want to Yes No
• Be the first to comment

Views
Total views
543
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
14
0
Likes
1
Embeds 0
No embeds

No notes for slide

### Encoding For the Web Encoding for the Web

1. 1. Encoding For the Web
2. 2. Encoding for the Web <ul><li>Target bit rate – knowing the connection speeds </li></ul><ul><li>Balancing audio vs. video bit rate </li></ul><ul><li>Image size </li></ul><ul><li>Frame rate </li></ul><ul><li>I - frames </li></ul>
3. 3. Firstly what is video? <ul><li>A sequence of still images displayed many times a second </li></ul><ul><li>The brain interprets the rapid changes and moving images are created. </li></ul><ul><li>15 frames per second and above is meant to create smooth motion </li></ul><ul><li>PAL (UK) video uses 25 interlaced frames per second </li></ul><ul><li>NTSC (USA) video uses 30 interlaced frames per second </li></ul>
4. 5. Interlaced Scanning <ul><li>The image is made up of 625 individual lines and therefore the TV set draws 15,625 lines per second (625x25) </li></ul>The term horizontal retrace is used to refer to the beam moving back to the left at the end of each line, while the term vertical retrace refers to its movement from bottom to top.
5. 6. Interlaced Scanning <ul><li>Half of the 625 lines are drawn first. This is called field 1. </li></ul><ul><li>The first field draws is called the odd field as it draws the odd numbers 1,3,5,7, etc </li></ul><ul><li>The second half of the lines are called field 2 and this draws the even numbered lines 2,4,6,8 etc </li></ul><ul><li>This is also called 50i recording, for 50 interlaced images per second. </li></ul><ul><li>Field 1 and Field 2 = 1 Frame </li></ul>
6. 7. Progressive Scan – what computers use and therefore streaming files to! <ul><li>A progressive scan draws each of the scan lines one after another in numerical order e.g. 1,2,3….625 </li></ul><ul><li>This gives a sharper image that an interlaced image. </li></ul><ul><li>This is called 25p recording. </li></ul><ul><li>There are no fields in a progressive scan just a single frame. </li></ul>
7. 8. What are you seeing on a TV? <ul><li>PAL and NTSC </li></ul><ul><ul><li>25fps and 29.97 fps </li></ul></ul><ul><li>Interlaced and Progressive Pictures </li></ul>
8. 9. How is a streaming file structured? <ul><li>Normal video is made up from 25 frames complete frames per second. </li></ul><ul><li>When encoded to a streaming format it is made up from I-frames (key frames) and difference frames (delta). </li></ul><ul><li>The only real frames are the I-frames. The difference frames are predicted based upon complex algorithms which analysed the I frame for change. </li></ul>
9. 10. Basic Encoding of a Streaming Media file Encoder Input - video Encoder Output Some I frames, lots of difference frames
10. 11. A Normal Video File Encoded to MPEG MPEG-2 uses 2 or 3 I frames every second. Streaming uses 1 every 300 frames (12 seconds!)
11. 12. A Streaming File Note the distance between the I frames. 300 frames is quite common between the two.
12. 13. Decisions to make for Unicast Streaming to Prepare a file for professional encoding <ul><li>Know your target audience </li></ul><ul><li>Understand the client connection speed this will determine what </li></ul><ul><ul><li>Image size will you select </li></ul></ul><ul><ul><li>What frame rate </li></ul></ul><ul><ul><li>What codec </li></ul></ul><ul><ul><li>How much bandwidth will you give to the entire file so how will you spilt this between video and audio content? </li></ul></ul><ul><ul><li>What pre-processing techniques could be deployed? </li></ul></ul>
13. 14. Allocating Bandwidth Making a decision on how much space you give to each component is very important over all connection speeds. Low bandwidth connections like 56Kb modems usually give the audio around 30% to 40% of the total bandwidth. Consumer tests have shown that as long as the audio is constant and clear the viewer is satisfied with the experience even if the picture keeps breaking up. It is possible during the encoding to specify which is most important, the video or the audio.
14. 15. Cropping and High Quality Scaling <ul><li>Video has edges that you cannot see on a TV but a computer sees the entire frame. </li></ul><ul><li>Video runs at 720x576. Scale it to 320x240 and you have already removed half the pixels without any filtering. </li></ul><ul><li>Crop and Scale source video to eliminate the black edges and &quot;garbled&quot; edge pixels. </li></ul><ul><li>If the view is just a talking head you can crop out all the unimportant information. </li></ul>
15. 16. Pre-processing <ul><li>Generally only used when encoding down not have to be real time. </li></ul><ul><li>Why pre-process? </li></ul><ul><ul><li>Filtering further reduces bandwidth </li></ul></ul><ul><ul><li>Reducing/adding keyframes? </li></ul></ul><ul><ul><ul><li>Why? </li></ul></ul></ul><ul><ul><ul><li>What do they do? </li></ul></ul></ul><ul><ul><ul><li>How many in a sequence? </li></ul></ul></ul><ul><ul><li>Structure of a file in reference to streaming </li></ul></ul><ul><ul><ul><li>Information frames and delta frames. </li></ul></ul></ul>
16. 17. Pre-Processing Techniques <ul><li>De-interlacing </li></ul><ul><li>Field Dominance change </li></ul><ul><li>Inverse Telecine </li></ul><ul><li>2D Filters </li></ul><ul><ul><li>Blurs </li></ul></ul><ul><ul><li>Adaptive noise Reduction </li></ul></ul>
17. 18. De-Interlacing – Various Techniques <ul><li>Process of removing a field of video – prepares the video for a progressive viewing and sharpens the image up. </li></ul><ul><li>Blending the two fields together – what issues could this raise? </li></ul><ul><li>Adaptive deinterlace </li></ul><ul><ul><li>Analyses the video to selectively interlace the parts of the video which are moving and leaves the still shots. This results in higher quality video stream in areas of motion. </li></ul></ul><ul><ul><li>This also helps to average the noise in the picture. </li></ul></ul>
18. 19. 3:2 Pull Down and Inverse Telecine <ul><li>3:2 pulldown converts NTSC into PAL or into film frame rates. 5 or 6 frames are dropped every second. </li></ul><ul><li>Inverse Telecine </li></ul><ul><ul><li>Used to increase a frame rate from film (24fps) or Pal (25) to NTSC (30). </li></ul></ul><ul><ul><li>It works by adding frames to compensate for the difference. </li></ul></ul>
19. 20. Blurs <ul><li>Use to clean up a noisy picture by blurring the noise into the image. </li></ul><ul><li>A low pass filter is applied to the entire image. </li></ul><ul><li>This colours are reduced but detail is lost. </li></ul><ul><li>You alter the radius of the blur the amount can be altered. </li></ul><ul><li>Not effective to use unless on a progressive image. </li></ul><ul><li>The amount of colours have been reduced slightly which will makes encoding easier. Why? As the images lends its self to thing like RLE encoding better. </li></ul>
20. 21. Run Length Encoding <ul><li>Run-length encoding Bitmapped graphics files are typically larger than they need to be. </li></ul><ul><li>Run-length encoding is a compression technique that reduces file sizes, especially for black-and-white or cartoon-style line art graphics. </li></ul><ul><li>It works by replacing &quot;runs&quot; of three or more with the same color with a single character. The more runs there are, and the longer the run sequence, the greater the compression. </li></ul>
21. 22. Run Length Encoding <ul><li>Consider a screen containing plain black text on a solid white background. There will be many long runs of white pixels in the blank space, and many short runs of black pixels within the text. Let us take a hypothetical single scan line, with B representing a black pixel and W representing white: </li></ul><ul><ul><li>WWWWWWWWWWWWBWWWWWWWWWWWWBBBWWWWWWWWWWWWWWWWWWWWWWWWBWWWWWWWWWWWWWW </li></ul></ul><ul><li>If we apply a simple run-length code to the above hypothetical scan line, we get the following: </li></ul><ul><ul><li>12WB12W3B24WB14W </li></ul></ul><ul><li>Interpret this as twelve W's, one B, twelve W's, three B's, etc. The run-length code represents the original 67 characters in only 16. </li></ul><ul><li>It is this theory that is applied after the Zig Zag scan in the encoding process. </li></ul><ul><li>Therefore, run-length encoding replaces strings of repeated characters (or other units of data) with a single character and a count </li></ul>
22. 23. Run Length Encoding <ul><li>Simplistic example: </li></ul><ul><ul><li>Given the 20 character data string: </li></ul></ul><ul><ul><li>oooeiiiippuuuutddddd </li></ul></ul><ul><ul><li>This could be re-coded as: </li></ul></ul><ul><ul><li>o3ei4ppu4td5 </li></ul></ul><ul><ul><li>which has only 12 characters </li></ul></ul><ul><ul><li>Compression rate: </li></ul></ul>
23. 24. Run Length Encoding (contd.) <ul><li>Give a simple RLE representation for the following data string: </li></ul><ul><ul><li>ggggguujjiiiQQQn </li></ul></ul><ul><li>What should the answer be? </li></ul><ul><ul><li>g5uujji3q3n </li></ul></ul><ul><li>Compression ratio is (16-11)/16=0.31 or 31% </li></ul><ul><li>Why does it look only replace runs or 3 or more with a letter and a count? </li></ul>
24. 25. Sharpening <ul><li>This improves the image by subjectively refocusing the image. </li></ul><ul><li>The edges of objects are amplified by an unsharp mask algorithm. </li></ul><ul><li>Whereby a high-pass filter is applied and added back onto the original. </li></ul><ul><li>This can be very important when streaming over low bandwidth connections. </li></ul><ul><li>Offering the client an acceptable image quality is the key thing. Streaming over low bandwidth is all about making the images the best you can whilst applying heavily compression. </li></ul><ul><li>The control is via two parts. A radius sharper that controls the sharpening pixel to pixel and then also the percentage of the sharpened image that is overlaid on the original image. </li></ul>Before After
25. 26. Adaptive Noise Reduction <ul><li>Noise wastes precious bits. But it is also not present throughout the entire image. This is where this filter comes in. </li></ul><ul><li>Blur applies the low pass filter across the entire image, while Adaptive Noise Reduction only applies it to flat areas, so edges aren't affected. It's better to apply the latter unless you're looking for a softer focus effect. </li></ul><ul><li>It also selectively blurs some pixels while sharpening others, resulting in output that compresses well but retains sharp edges. </li></ul><ul><li>You can remove single stray pixels either alone in, or in combination with, a flat field filter. </li></ul><ul><li>You can also customize the filter characteristics as shown in the figure. Here you can specify how flat an area needs to be </li></ul><ul><li>If you have serious noise artefacts in your video, experiment with these settings -- otherwise it's faster to use the preset filters . </li></ul>
26. 27. VBR v CBR <ul><li>Live streaming uses CBR only at present. </li></ul><ul><li>DVD mainly uses VBR (in pro work) </li></ul><ul><li>- 3 to 9Mbps is average </li></ul><ul><li>What is CBR (constant bit rate)? </li></ul><ul><li>What is VBR (variable bit rate)? </li></ul><ul><li>VBR also used for multiplexing digital satellites. </li></ul><ul><ul><li>e.g. Borrowing bandwidth from other channels. </li></ul></ul>
27. 28. Practical <ul><li>Show how to edit the codec choice in Windows Media Encoder </li></ul><ul><li>Cropping </li></ul><ul><li>Show Video on Encoding </li></ul>
28. 29. Digital rights management <ul><li>Digital rights management (DRM) is the umbrella term referring to any of several technologies used to enforce pre-defined policies controlling access to software, music, movies, or other digital data. </li></ul><ul><li>In more technical terms, DRM handles the description, layering, analysis, valuation, trading and monitoring of the rights held over a digital work. </li></ul>
29. 30. Digital rights management <ul><li>The term is often confused with copy protection and technical protection measures (TPM). </li></ul><ul><li>These two terms refer to technologies that control and/or restrict the use and access of digital media content on electronic devices with such technologies installed. </li></ul><ul><li>There are technical measures that could be used not to restrict use or access, such as to monitor use in order to record rights of a content consumer </li></ul><ul><li>Some digital media content publishers claim DRM technologies are necessary to prevent revenue loss due to illegal duplication of their copyrighted works. However, others argue that transferring control of the use of media from consumers to a consolidated media industry will lead to loss of existing user rights and stifle innovation in software and cultural productions. </li></ul>
30. 31. DRM <ul><li>As the name implies, it applies only to digital media (and analog media that was at one point digital). </li></ul><ul><li>Digital media have gained in popularity over analog media both because of technical advantages associated with their production, reproduction, and manipulation, and also because they are sometimes of higher perceptual quality than their analog counterparts. </li></ul><ul><li>Since the advent of personal computers , digital media files have become easy to copy an unlimited number of times without any degradation in the quality of subsequent copies. </li></ul><ul><li>Many analog media lose quality with each copy generation, and often even during normal use. </li></ul><ul><li>The popularity of the Internet and file sharing tools have made the distribution of copyrighted digital media files simple. </li></ul>
31. 32. DRM <ul><li>The availability of multiple perfect copies of copyrighted materials is perceived by much of the media industry as a threat to its viability and profitability, particularly within the music and movie industries. </li></ul><ul><li>Digital media publishers typically have business models that rely on their ability to collect a fee for each copy made of a digital work, and sometimes even for each performance of said work. </li></ul><ul><li>DRM was designed for digital media publishers as a means to allow them to control any duplication and dissemination of their content. </li></ul>
32. 33. DRM <ul><li>DRM is vulnerable to an additional class of attacks due to its need to be run on tamper-resistant hardware (DRM systems that do not run on tamper-resistant hardware cannot ever be theoretically secure since digital content can be copied on a hardware level). </li></ul><ul><li>The case for DRM is that without a strong system in place to ensure only paying consumers can access media, piracy will run rampant and cut drastically into profits for producers and distributors. With declining sales, so the argument goes, creative input will also drop and the overall quality of media produced will decline. </li></ul>
33. 34. CSS DRM <ul><li>One of the first and most widely contested DRM systems was the Content Scrambling System (CSS) used to encode DVD movie files. </li></ul><ul><li>This system was developed by the DVD Consortium as a tool to influence hardware manufacturers to produce only systems which didn’t include certain features. </li></ul><ul><li>By releasing the encryption key for CSS only to hardware manufacturers who agreed not to include features such as digital-out, which would allow a movie to be copied easily, the DVD Consortium was essentially able to dictate hardware policy for the DVD industry. </li></ul>
34. 35. DRM <ul><li>While DRM is most frequently used for movies, it is gaining more widespread use in other media as well. Audio files purchased through many online stores, such as Apple’s iTunes Store, have various DRM schemes built in to limit the number of devices they may be played on. </li></ul><ul><li>Many producers of eBooks are using a similar implementation of DRM to limit how many computers a book may be viewed on, and even how many times it may be viewed. </li></ul>
35. 36. Flaws of DRM <ul><li>Physical protection : using external dongles </li></ul><ul><li>DIVX : Required a phone line, inhibiting mobile use. </li></ul><ul><li>CSS : Restricts fair use and first purchaser rights, such as the creation of compilations or full quality reproductions for the use of children or in cars. It also prevents the user from playing CSS-encrypted DVDs on any computer platform (although this restriction can be easily circumvented). CSS is an example of certificate-based encryption. </li></ul><ul><li>Product activation : Invalidates or severely restricts a product's functionality until the product is registered with a publisher by means of a special identification (activation) code. The process often uses information about the specific configuration of the hardware on which the software runs, hashing it with the identification number specific to the product's license. </li></ul><ul><li>Digital watermarking : Allows hidden data, such as a unique disc ID, to be placed on the media. Then, the name and address of the purchaser would be taken at the location of sale, and entered into a database along with the unique media ID. </li></ul><ul><li>This does not prevent copying, but it ensures that any copies made of the media will bear the same hidden information—so if the content appeared on (for example) P2P networks, the ID number could be easily extracted and the purchaser prosecuted. This scheme is flawed primarily because authenticating the buyer as the infringing party is nearly impossible: </li></ul>