… for Codecs & Media

Tip #907: Why Can’t I Subclip H.264 Media?

Larry Jordan – LarryJordan.com

Extracting media from compressed files almost always requires recompression.

I-frame (top) vs. GOP compression. Edits can only be made on the green I-frames.

Topic $TipTopic

I got an email recently from a reader asking for a way to export subclips from an H.264 video without recompressing it, because he didn’t want to lose any image quality.

The problem is that this can’t be done. Here’s why.

In an ideal world, each frame in a video should be self-contained. This is called I-frame compression and is illustrated by the top line in the screen shot.

The benefit to I-frame compression is that each frame is fully self-contained, high-quality and very efficient to edit. The disadvantage is that the media files are very large. ProRes, GoPro Cineform and DNx are all I-frame formats.

However, many cameras, to save storage space and stay within the technical bandwidth of MicroSD camera cards, compress the media using GOP (pronounced “gop”) compression (the bottom line in the screen shot). H.264 and HEVC, use this format.

NOTE: Not all GOP groups are 15 frames, some use 7 frames or other frame counts. However, the overall concept is the same.

What a GOP group does is store a complete image on the first frame of the group, then only record the changes for each group of pixels, essentially as a text file, for each frame that follows in the group.

The benefit to GOP compression is that the media files are very small. But, in order to display an image the computer needs to find the I-frame at the start of the group, then calculate the changes for each succeeding frame until it gets to the frame you want to display. This additional calculation is why we describe this format as “inefficient.”

Every GOP clip MUST start with an I-frame. If I wanted to extract a portion of a GOP-compressed clip, say starting at frame 10, I would need to first, recreate an I-frame for frame 10, then rebuild the entire GOP structure during export for the rest of the clip. That means re-compressing the entire clip to rebuild the GOP structure.

This is why recompressing already compressed GOP media tends to look bad; the computer needs to rebuild and recompress every frame to recreate the GOP structure.

This is also the reason that working with I-frame media is faster with overall higher image quality, because the CPU needs to work far less to calculate and display images.


Please rate the helpfulness of this tip.

Click on a star to rate it!

… for Codecs & Media

Tip #919: What is a Macroblock?

Larry Jordan – LarryJordan.com

H.264 compression tracks macroblocks rather than pixels to create smaller files.

Topic $TipTopic

Macroblocks are at the heart of MPEG and H.264 video compression. But, what is a Macroblock?

In order to get the smallest possible files when compressing into H.264, the image is divided into “macroblocks.” (HEVC uses something similar, called a “coding tree unit.”)

Wikipedia describes a macroblock as typically consisting of 16×16 pixels, which forms a processing unit in image and video compression formats based on linear block transforms, typically the discrete cosine transform (DCT). (DCT is used in JPEG, MPEG and H.264 compression.)

A macroblock is divided further into transform blocks. Transform blocks have a fixed size of 8×8 samples. In the YCbCr color space with 4:2:0 chroma subsampling, a 16×16 macroblock consists of 16×16 luma (Y) samples and 8×8 chroma (Cb and Cr) samples. These samples are split into four Y blocks, one Cb block and one Cr block.

The reason macroblocks are important is that when media is encoded, the compression tracks the location of each macroblock from one frame to the next, rather than the full pixel data. This reduces the size of the file significantly, but at the cost of a loss of color information.


Please rate the helpfulness of this tip.

Click on a star to rate it!

… for Codecs & Media

Tip #920: What is the AV1 Codec?

Larry Jordan – LarryJordan.com

AV1 will be a format we see used increasingly for web-based media.

Topic $TipTopic

AOMedia Video 1 (AV1) is an open, royalty-free video coding format designed for video transmissions over the Internet. It was developed as a successor to VP9 by the Alliance for Open Media (AOMedia).

The Alliance for Open Media (AOMedia) is a non-profit industry consortium for the development of open, royalty-free technology for multimedia delivery headquartered in Wakefield, Massachusetts. It adopts the principles of the development of open web standards for the creation of video standards that can serve as royalty-free alternatives to the hitherto dominant standards of the Moving Picture Experts Group (MPEG).

The governing members are Amazon, Apple, ARM, Cisco, Facebook, Google, IBM, Intel, Microsoft, Mozilla, Netflix, Nvidia, Samsung Electronics and Tencent. Its first project was to develop AV1, a new open video codec and format as a successor to VP9 and a royalty-free alternative to HEVC, which uses elements from Daala, Thor, and VP10.

The Alliance announced, on January 8, 2019, the release of a validated version 1.0.0 with Errata 1 of the specification. However, the spec still needs to be translated into shipping products.

In developing this open-source codec, the emphasis was on the encoding mechanism and making sure the codec was free of legal constraints. Consequently, the early version of AV1 was orders of magnitude slower than existing HEVC encoders. Much of the development effort was consequently shifted towards maturing the reference encoder; i.e. making it faster. In March 2019, it was reported that the speed of the reference encoder had improved greatly and was within the same order of magnitude as encoders for other common formats.

YouTube and Vimeo are already rolling out AV1. Netflix starting using AV1 in February, 2020. Facebook, Twitch and iQIYI are also rolling out support.

The format is also supported by:

  • Firefox
  • Google Chrome
  • Opera
  • Microsoft Edge
  • VLC Media Player
  • FFmpeg
  • Bitmovin
  • Handbrake
  • and others

Here’s the link for more information.


Please rate the helpfulness of this tip.

Click on a star to rate it!

… for Codecs & Media

Tip #903: A Caution About Frame Rate Conversions

Larry Jordan – LarryJordan.com

The highest image quality occurs when media is played at its source frame rate.

Topic $TipTopic

During this last week, I’ve gotten more emails than usual about frame rate conversions. Some of the concerns are software related; for example, there may be a problem with Compressor converting 24 fps material to 25 fps.

However, the bulk of my email centered on jitter caused by the conversion.

It is important to stress two key points:

  1. The web does not care about the frame rate of your media. The web plays anything. There’s no benefit to changing rates.
  2. The best image quality is ALWAYS when media is played back at the frame rate it was shot. As much as possible, shoot the frame rate you need to deliver.

Converting from 24 to 48, 59.94 to 29.97 or 60 to 30 is smooth and easy; every other frame is dropped or each frame is doubled. But converting 24 to 25, or 30 to 25 or 29.97 to 24 is a recipe for stutter and jitter.

To decrease your stress, before you start shooting, carefully think about the frame rate you need to deliver – or potentially might need to deliver – then shoot that rate. (And, remember, again, that the web doesn’t care about frame rates. So don’t convert media for the web.)


Please rate the helpfulness of this tip.

Click on a star to rate it!

… for Codecs & Media

Tip #904: Why You Should Avoid HDV

Larry Jordan – LarryJordan.com

Where possible, avoid using HDV to maximize image quality.

Topic $TipTopic

HDV was one of the first, if not THE first, consumer-grade HD video format. As such, it was an eye-opening opportunity to discover the benefits of HD.

However, compared to media formats today, HDV has three serious limitations:

  • First, most HDV material is interlaced. While this plays acceptably on TV monitors, it looks awful on the web. This is because TVs are designed to display interlaced media, while the web is designed for progressive.
  • Second, unlike all digital media today, HDV uses rectangular pixels which are stretched to fill the frame, rather than square pixels. This means that an HDV image won’t look as sharp as digital images today.
  • Third, HDV records half the color information compared to most modern cameras. (And one-quarter the color of high-end cameras.)

NOTE: The only way to get rid of interlacing is to remove every other line of video, thus cutting vertical image resolution in half. Then, existing lines are either duplicated or guessed at using various methods of image interpolation.

So, if you are given the option to shoot or convert media into HDV, be very cautious before you agree. There are very few situations today where this makes sense.

EXTRA CREDIT

If you have existing HDV material, consider getting it transcoded to ProRes 422. While not required, you do need to start thinking about how to preserve and convert your older media assets, especially if you plan to edit them in the future.


Please rate the helpfulness of this tip.

Click on a star to rate it!

… for Codecs & Media

Tip #905: What’s a Media “Container?”

Larry Jordan – LarryJordan.com

Containers simplify storing different media types in one place.

Topic $TipTopic

QuickTime, MXF, WAV and MPEG-4 are all media containers. But, what’s a container and why is it used?

Wikipedia: “A container format (informally, sometimes called a wrapper) belongs to a class of computer files that exist to allow multiple data streams to be embedded into a single file, usually along with metadata for identifying and further detailing those streams.”

Because a media file can have different attributes based on whether it holds audio, video, timecode, captions or other media information, it becomes easier to store each of these elements in its own file, then store all these different components in a single container.

An analogy is a file folder holding different sheets of paper. Each paper could be written in a different language, but unified by being contained in that single folder.

Wikipedia: “Container format parts have various names: “chunks” as in RIFF and PNG, “atoms” in QuickTime/MP4, “packets” in MPEG-TS (from the communications term), and “segments” in JPEG. The main content of a chunk is called the “data” or “payload”. Most container formats have chunks in sequence, each with a header, while TIFF instead stores offsets. Modular chunks make it easy to recover other chunks in case of file corruption or dropped frames or bit slip, while offsets result in framing errors in cases of bit slip.”

Here are two links to learn more: Wikipedia and Mozilla


Please rate the helpfulness of this tip.

Click on a star to rate it!

… for Codecs & Media

Tip #882: What is Resolution?

Larry Jordan – LarryJordan.com

DPI is irrelevant for digital media. The key setting is total pixels across & down.

The New Image menu in Photoshop.

Topic $TipTopic

When you create a new image in Photoshop, one of the parameters you need to set is Resolution. But, is resolution even relevant for digital media?

The short answer is: No.

Resolution is a print term that defines – for a fixed size image – how many pixels fit into a given space.

Digital media is the opposite. The number of pixels is fixed, but the size of the shape – the monitor – varies widely.

When creating images for the web, we have standardized on a resolution setting of 72. NOT because this is an accurate setting, it isn’t. Rather it’s to remind us to look only at total pixels across by total pixels down.

These are the pixels that will be spread to fit whatever sized monitor / frame they are displayed in.

EXTRA CREDIT

When creating images for the web or video, RGB 8-bit is the best and most compatible choice.


Please rate the helpfulness of this tip.

Click on a star to rate it!

… for Codecs & Media

Tip #883: Don’t Turn Your Hard Disk Into a Camera

Larry Jordan – LarryJordan.com

Don’t panic. This problem is easy to fix. Just pay attention.

Image courtesy of pexels.com.

Topic $TipTopic

Warning! Don’t turn your hard disk into a camera. I was reminded of this today with an email from Jon G. who wrote:

“Sorry to bother as this is probably obvious but it surprised me at first….

“When I went to import from an external drive, FCP saw the entire drive as a camera, not an external device! And started to load all 5,000 plus items individually, not good.”

Agreed. The first time you see this, it can be VERY scary!

This happens when you copy the folders from a camera card directly to your hard disk without putting them into their own containing folder.

If this happens to you, create a new folder on your hard disk and move all the camera card folders into that separate folder.

NOTE: To make sure you find them all, mount a camera card to your computer and use that as a guide to indicate which folders you need to find and move.

Here’s a tutorial from my website that describes this process in more detail.


Please rate the helpfulness of this tip.

Click on a star to rate it!

… for Codecs & Media

Tip #884: Include Transparency in HEVC Video

Larry Jordan – LarryJordan.com

HEVC supports transparency, if you know how to create it.

Be sure to check Preserve Transparency when creating an HEVC movie.

Topic $TipTopic

Dan D. found a way to make much smaller files with alpha channels using the HEVC codec. This is a process that Apple introduced just  last year, and it’s only supported on devices running iOS 13, tvOS 13, or macOS Catalina; or later.

The can be used for any video created in any Mac application that includes transparency. Here’s how:

  • Go to System Preferences > Keyboard. Click the Services category on the left, then enable Encode Selected Video Files on the right.
  • From any video application, export a project that contains transparency directly using the ProRes 4444 codec.
  • In the Finder, right-click the resulting .mov and select Services > Encode Selected Video Files.
  • Wait a few seconds for the next menu in the screen shot to appear.
  • Choose HEVC from the menu and pick the frame size that matches your project. Click the check box that says Preserve Transparency.

The resulting movie will be much smaller and retain the transparency information. This technique will work for any video that contains transparency, but requires macOS Catalina or later.

Here’s a tutorial from my website that describes this in more detail.


Please rate the helpfulness of this tip.

Click on a star to rate it!

… for Codecs & Media

Tip #863: What HDMI 2.1 Means for 8K and HDR

Larry Jordan – LarryJordan.com

The new HDMI standard supports future image quality growth.

Image courtesy of TV Technology.

Topic $TipTopic

The folks at TV Technology released an article on “What HDMI 2.1 Could Mean for 8K, HDR” This is an excerpt.

James Carter and Henry St. Leger write:

What is HDMI 2.1? The new standard for HDMI was confirmed back in November, 2017, but has yet to trickle down into mass-market television hardware. When it does, though, it will mark a big step for both the AV industry and home viewers wanting to get the most of their TV series, films, broadcast, and games consoles.

When High Definition Multimedia Interface (or HDMI) first arrived on the scene, everyone rejoiced at no longer having to use bulky SCART connectors, or those confusing component video cables, ever again. Instead, HDMI offered high definition video with a connector that was just a little bigger than a standard USB plug.

…The headline feature here is support for 8K content at 60 fps, but there are also a number of minor features that add up to a much more capable standard such as support for Variable Refresh Rates, Dynamic HDR, and Quick Media Switching, which should make it faster than ever to change between the devices attached to your television.

Here’s the link to the full article.


Please rate the helpfulness of this tip.

Click on a star to rate it!