H.264 / H.265 decoding in DaVinci Resolve

內容

Let’s take a closer look at “edit-unfriendly” codecs by delving into the concept of the “Group of Pictures” (GOP) structure. The GOP structure represents a compressive technique that is predominantly utilized in codecs like H.264 and MPEG-4. While it successfully achieves impressive data compression and is widely implemented for streaming and data storage, GOP can bring forth numerous challenges when it comes to video editing, particularly within professional editing software like DaVinci Resolve. Here’s a more detailed look:

WHAT IS GOP?

The Group of Pictures (GOP) structure is a method that involves grouping frames together, typically involving one “I-frame” (intra-coded picture) followed by multiple “P” (predicted picture) and “B” (bi-directional predicted picture) frames. The I-frame contains complete image data, while P and B frames store only the differential data, referring back to previous I-frames or forward to subsequent frames for the information required to decode them. While this methodology achieves substantial compression, the inherent dependencies between frames can invoke complexities during editing.

DIFFICULTIES IN EDITING

  1. **File Access Issues:
    **The interconnectedness of frames within a GOP can induce challenges right from the inception of editing. Editing software, when trying to access and process individual frames, must decode not only the target frame but also its reference frames within the GOP. Consequently, the frame interdependencies can restrict software from quickly and easily opening or manipulating the file.
  2. **Stuttering:
    **Real-time playback is an essential aspect of the video editing process, enabling editors to preview edits and effects immediately. However, due to the reliance of P and B frames on their surrounding counterparts within the GOP, swift and accurate decoding becomes critical. If editing software struggles with this, it can lead to stuttering or juddering during playback, hampering the editor’s ability to accurately assess changes.
  3. **Decoding Issues:
    **The requirement to decode multiple interlinked frames to access and visualize a single frame presents not only an increase in computational load but also a risk of decoding errors. If any issues or inefficiencies occur during the decoding process, they can manifest as playback issues or visual artifacts, potentially disrupting the editing workflow and compromising the quality of the output.

DaVinci Resolve Studio brings forth capabilities for hardware decoding of H.264 and H.265 media, albeit with certain limitations and dependencies. Not all types of H.264 and H.265 media are supported, and aside from the codec itself, factors like bit depth (8-bit, 10-bit) and chroma subsampling (4:2:0, 4:2:2, 4:4:4) come into play. Moreover, your computer’s GPU plays a crucial role, influencing whether hardware decoding can be leveraged effectively or not. Here is an overview of H.264 decoding support in DaVinci Resolve Studio 17.4:

For H.265, 8-bit 4:2:0 and 10-bit 4:2:0 seem to work well. But for 4:2:2 / 4:4:4 you have to be lucky to have the right GPU/CPU for DaVinci Resolve Studio to take advantage of hardware decoding.

The proxy workflow, while beneficial for smoother editing, may present issues, specifically in the rendering stage of the post-production process. The primary concern lies in the need to render using the original files, not the proxy versions. Here’s a clear explanation:

When transitioning back from proxy files to the original H.264 GOP files, these original files need to be decoded for rendering. The decoding process relies on understanding and correctly interpreting the dependencies between frames in the GOP structure. However, this decoding is influenced by a multitude of factors including the capabilities of the hardware, efficiency of the software, and the complexity of the video itself.

CONVERT TO DNxHR

In contrast, converting original files to a format like DNxHR that handles each frame independently, rather than in groups, could alleviate these issues. This can offer more efficient editing and smoother implementation of effects and transitions, all while preserving the high-quality visual details of the original files.

I suggest converting H.264/H.265 files into a codec that is suitable for editing, such as DNxHR. Several tools are available for transcoding your footage, and I will provide a step-by-step guide using “Shutter Encoder“, a free tool designed specifically for video conversion.

Step 1 = Browse and choose your H.264/H.265 file.Step 2 = Choose function and select DNxHR.Step 3 = Choose HQX for 12-bit 4:2:2 Broadcast-quality.

Step 4 = Start function.

CODEC

DNxHR is a lossy-compressed video data format developed by Avid. Initially designed as an “intermediate format” for video editing in post-production, DNxHR has now become widely utilized across the entire production process. Unlike DNxHD, DNxHR supports resolutions of 4k and beyond, offering increased flexibility. Below is a list of various quality settings available for transcoding your acquired media:DNxHR LB – 8-bit 4:2:2 – Low BandwidthDNxHR SQ – 8-bit 4:2:2 – Standard Quality DNxHR HQ – 8-bit 4:2:2 – High QualityDNxHR HQX – 12-bit 4:2:2 – 4K Broadcast-quality delivery

DNxHR 444 – 12-bit 4:4:4 – Cinema-quality delivery

總結
The article discusses the challenges of using "edit-unfriendly" codecs, particularly focusing on the Group of Pictures (GOP) structure found in H.264 and MPEG-4 codecs. The GOP structure groups frames, with one I-frame containing complete data and P/B frames storing only differential data. This interdependence complicates video editing, especially in software like DaVinci Resolve. Key issues include file access difficulties, stuttering during playback, and decoding errors, which can disrupt the editing workflow. While DaVinci Resolve supports hardware decoding for H.264 and H.265, limitations exist based on codec type and hardware capabilities. The article suggests converting H.264/H.265 files to DNxHR, a codec that allows for independent frame handling, thus improving editing efficiency and quality. It provides a step-by-step guide for using Shutter Encoder to convert files to DNxHR, which supports high-quality resolutions and is designed for post-production editing. Overall, transitioning to DNxHR can alleviate the complexities associated with GOP structures, enabling smoother editing processes.