Sunday, June 17, 2012

Compression 102

In my previous post I went over how visual disparities are introduced to videos from different codecs and their relative effects on the image quality. However I completely missed discussing what to do when faced with needing to input your own numbers and how these many variables can affect the image quality and file size. In Compression 101 I merely used the Adobe Media Encoders .mov quality slider for setting my compression ratios and as what’s been well proven by this class, for some reason most people prefer Final Cut Pro X which lacks most of the quality controls that was covered previously.

Along with covering a more precise method of compression via custom bitrates I will also cover some special situations in which specific codecs and settings should be used. Part #0 Data Compression for dummies I’m going to give this my best effort to explain common Computer file terminology as it pertains to video and media storage.
RAW
-No compression, no formatting, pure data. This isn’t talked about much in amateur Video but is common in professional video.
Lossless
-Lossless compression is the ideal compression scenario. When Losslessly encoded, the content has been perfectly preserved and can be recalled an infinite number of items identically while still being a smaller file size than its RAW uncompressed form.
Lossy
-Lossy compression is what you see daily in your digital life. Television stations, Radio, MP3 and YouTube all utilize a lossy compression system. In lossy compression small portions of data are chucked in order to smooth out the bit stream to allow for greater compression.
Container
-A Container is a blanket format that can contain a number of codecs. Container formats will specify what codecs are supported and their manner of encoding and decoding. Typically they will have support for multiple codecs. An example of this would be .mov which is capable of storing around 32 different codecs.
Codec
-A Codec is a set of instructions (algorithms) that are used to encode and decode data held within a container. MP3 is a container and a codec, but Apple Quick Time Pro is just a codec and is stored in a .mov container.
Part #1 Video Encoder settings
Progressive VS Interlaced
-this ones the most commonly known by people outside of the technological side of video production, however it’s also the least understood for some oddity. Simply put, the P in 720p stands for progressive frames. This means that each frame is rendered entirely and contains the most data/lines of information per frame. The i in 1080i stands for Interlaced. In this situation the displayed image is still a full 1080 vertical pixels, but all frames are all half the stated resolution because the displayed image is derived from two fields of separate data that are alternately updated. Only half of the image (1 field) is of the new frame, the second displayed field comes from the previous field update.
There are 2 fields displayed at all times in i mode and only 1 field displayed in P mode to display a single image. P gives a cleaner image due to the whole image being derived from the same data set.
Constant Bit Rates
-the simplest of all data sorting methods is called “Constant Bit Rate” and just as it says, it’s a constant bit rate. Under this sequencing method, a still image of white is allocated the same data space as an epic clash of light sabers would be.
-Pros
Most reliable (not everything supports variable bit rates) Least likely to flood delivery bandwidth (you won’t have spikes of data requests, instead a constant even flow) Guaranteed quality (what you set is what you get)
-Cons
Oldest Least image quality per byte of data (a blank shot eats the same amount of data as an action shot)
Variable Bit Rates
-as the name implies, “Variable Bit Rate" encoded video has a bit rate that varies. Under this sequencing method, the image is assessed via an extra encode pass to determine its amount of change. From there the encoder will alter the amount of data allocated to the scene according to its amount of change. A shot with a lot of change will be allocated a larger chunk of data space than a shot that is relatively calm and unchanging.
An additional aspect of variable bit rate encoding is the option of 1 pass or 2 pass. This is merely another level of quality control to the encoder. 1 pass will analyze the image once and then begin encoding while 2 pass will check the data twice and average the results before encoding the images. My recommendation is to always use 2 pass encoding, as it won’t increase the file size and can produce better images than 1 pass.
1 pass
-Only a single analysis pass is completed before encoding the video
2 Pass
-Two analysis checks are conducted on the image before encoding the video. File size is the same. Only con is a longer encoding time.
Part #2 Conditional compression
Stop Motion Animation
When compressing stop motion animation directly from a video editor, where a single frame of animation can span more than a single video field (frame), always check “optimize still images” if the codec supports it. This will tell the encoder to check for static imagery that spans more than one field and to then skip updating the subsequent fields it spans over. For example, if a still image has a duration of 2 seconds in a file set to 30 fps, the encoder will generate one 2 second frame instead of 60 frames at 1/30 of a second each. (adobe.com)
That’s it for this entry.

5 comments:

  1. I think I am a dummie when it comes to compression, especially since I come to class with the biggest files. This was really helpful, especially the definition part - you did a great way of explaining it. For my final project I will try and use this information and hopefully come to class with an HD compressed video.

    ReplyDelete
    Replies
    1. Well, personally going big isn't that bad. it’s easier to downgrade the quality than it is to do the opposite and in an ideal situation you had the better files. (better to have ridiculous quality than no quality)

      Will be interesting to see what file size you come in with for the final.

      Delete
  2. I appreciate you writing a blog to go with your presentation. Writing is often hard to follow, but you gave us a visual that we can now go back and connect to your text. I find that the courses here do not touch on compression when that can make or break a piece as presentation is everything. I had one question, can I compress straight from final cut? Or do I need to use a separate software like you did today?

    ReplyDelete
    Replies
    1. You can compress directly out of Final Cut its just a little buried because Apple be leaves that people shouldn't see anything "nerdy". its a good strategy, looks clean and for the most part does what most people want.

      What I was using was Adobe Media Encoder. it comes with all Adobe sweet’s and has direct integration with most adobe programs. i can compress either in the specific program or export the project to compress in the encoder.

      Fine Cut can do a similar trick with an apple compressor (don’t know the name) that the teacher briefly mentioned a month ago. If you had asked this in class I or some one else could of probably been able to show it.

      Delete
    2. To control the compression format in FCP X:

      share>export media
      from here you can use the H264 video codec, but it won't give you the fine control that Andrew demonstrated in class.

      share>send to compressor
      will take the file to the program called "compressor," which is fairly similar to what Andrew used in the class. It will allow for fine-tuning, and you can easily set it up to execute many different compressions on one file at once.

      Delete