Dolby
  • Up and Running
  • Amazon Web Services
  • Sources
  • Hybrik JSON
  • Basic Transcode Task
  • GOP Control
  • Connections Array
  • User Data
  • Watch Folders
  • Timecode
  • Thumbnail Image Extraction
  • Conditional Actions
  • Video Filters
  • Audio Filters
  • Working with Audio
  • Task Modifiers
  • Package Task
  • Analysis & Quality Control
  • Dolby Technologies
  • Additional Tasks
  • Hybrik Versions
  • QC Player
  • Machine Performance Analysis

    Setting the Group of Pictures (GOP) Structure

    When defining encoding parameters for long GOP codecs that use i, b, and p frames you may wish to specify what your GOP looks like. There are a few parameters in Hybrik’s video object that may be used to achieve a specific GOP structure.

    Common Controls

    Setting a Regular GOP

    More details can be found for each of these settings on our Video API page:

    • idr_interval
      • This is the easiest way to control your GOP interval. By specifying one or more of the following you can tell the encoder at what frequency you want to insert an IDR frame:
        • frames
          • Set an IDR frame exactly every N frames
        • seconds
          • Set an IDR frame exactly every N seconds
        • min_sec
          • Set an IDR frame at least every N seconds, defining the minimum number of seconds per GOP (can be combined with max_sec)
        • max_sec
          • Set an IDR frame at most every N seconds, defining the maximum number of seconds per GOP (can be combined with min_sec)
        • min_frames
          • Set an IDR frame at least every N frames, defining the minimum number of frames per GOP (can be combined with max_frames)
        • max_frames
          • Set an IDR frame at most every N frames, defining the maximum number of frames per GOP (can be combined with min_frames)

    Forcing Specific Keyframes

    • forced_keyframes
      • Forced keyframes provides a way to insert i/idr frames in specific places. This can be useful for Digital Ad Insertion (DAI). You can insert frames in specific locations using the following options:
      • Note: Forced Keyframes requires a minimum encoder_version of hybrik_3.4_8bit
        • frames
          • Specify an array of frame numbers for key frame insertion
        • times_sec
          • Specify an array of times in seconds for key frame insertions
        • timecodes
          • Specify an array of timecodes for key frame insertions

    Other GOP Controls

    • use_scene_detection
      • Scene detection gives the codec some agency to insert IDR frames when it detects significant differences. This can be used in combination with forced_keyframes and idr_interval.
    • max_bframes
      • This controls the maximum number of B frames that occur between I and P frames
    • refs
      • This controls how many decoded frames a single frame may refer to for each macroblock
    • use_closed_gop
      • This tells the encoder not to go beyond the bounds of the current GOP for any reference frames

    Example Usage

    Inside of a video element of our transcode task, we can specify the above paramters. Here are a few simple examples, all contained within the sample job a the bottom of this page.

    Every 2 Seconds

    "video": {
        "codec": "h264",
        "width": 1280,
        "height": 720,
        "bitrate_kb": 1000,
        "use_scene_detection": false,
        "idr_interval": {
            "seconds": 2
        }
    },
    

    With a 24fps source, the resulting GOP will have a regular interval every 48 frames as seen here (visuals courtesy of Switch player):

    idr_interval_2_secs.jpg

    Every 12 Frames

    "video": {
        "codec": "h264",
        "width": 1280,
        "height": 720,
        "bitrate_kb": 1000,
        "use_scene_detection": false,
        "idr_interval": {
            "frames": 12
        }
    },
    

    With a 24fps source, the resulting GOP will have a regular interval every 12 frames as seen here (visuals courtesy of Switch player):

    idr_interval_12_frames.jpg

    Every 4 Seconds with Scene Detection

    "video": {
        "codec": "h264",
        "width": 1280,
        "height": 720,
        "bitrate_kb": 1000,
        "use_scene_detection": true,
        "idr_interval": {
            "seconds": 4
        }
    },
    

    With a 24fps source, the resulting GOP will have a regular interval every 96 frames and additional frames inserted by scene change detection as seen here (visuals courtesy of Switch player):

    scene_detection.jpg

    Forced Keyframes

    This job inserts keyframes at frames 8, 12, 16, and 24. This is not a practical example but demonstrates the usefulness when you need to insert keyframes at exact points.

    "video": {
        "codec": "h264",
        "width": 1280,
        "height": 720,
        "bitrate_kb": 1000,
        "use_scene_detection": true,
        "forced_keyframes": {
            "frames": [
                8,
                12,
                16,
                24
            ]
        }
    },
    

    The resulting GOP will have keyframes at frames 8, 12, 16, and 24 as seen here (visuals courtesy of Switch player):

    forced_keyframes_8_12_16_24.jpg

    Example

    • This is an example job with several GOP manipulations