Is it possible to encode an MPEG2 video containing only I-frames?

General questions or discussion about HandBrake, Video and/or audio transcoding, trends etc.
Post Reply
dr0
Posts: 5
Joined: Mon Dec 21, 2020 11:52 pm

Is it possible to encode an MPEG2 video containing only I-frames?

Post by dr0 »

Description of problem or question: I use HandBrake to convert source footage that is going to be edited on an older (and much slower than my main rig) laptop. I'd be glad to use HandBrake's [Production Proxy 540p] to create proxie files for this laptop, but unfortunately, while having a great scrubbing performance, those files have aspect ratio and visual artifacting in video editing software that is being used on that laptop. MPEG2 QP1, on the contrary, works without any visual problems in that laptop's NLE software, but it has worse scrubbing performance, as it contains mostly of P-frames, instead of I-frames. I-frames are inserted every 10 seconds or so by default. See a short (1m12s) comparison video I made here: https://youtu.be/WceHDKwTvNg
Adobe Premiere Pro CS6, that I use on my main computer, has an option to create preview files, that are called "I-Frame Only MPEG" and while not being technically completely I-frame based, as they actually contain two P-frames inbetween each I-frame, that is still much closer to what I need.

MediaInfo of "I-Frame Only MPEG" from Pr Pro CS6

Code: Select all

General
Complete name                            : D:\Data\Transcodes\MPEG I-ONLY\premiere_preview.mpeg
Format                                   : MPEG-PS
File size                                : 9.34 MiB
Duration                                 : 2 s 503 ms
Overall bit rate mode                    : Constant
Overall bit rate                         : 31.3 Mb/s

Video
ID                                       : 224 (0xE0)
Format                                   : MPEG Video
Format version                           : Version 2
Format profile                           : High@High
Format settings, BVOP                    : No
Format settings, Matrix                  : Default
Format settings, GOP                     : N=3
Duration                                 : 2 s 503 ms
Bit rate mode                            : Constant
Bit rate                                 : 30.7 Mb/s
Maximum bit rate                         : 31.1 Mb/s
Width                                    : 1 920 pixels
Height                                   : 1 080 pixels
Display aspect ratio                     : 16:9
Frame rate                               : 29.970 (30000/1001) FPS
Standard                                 : NTSC
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Progressive
Compression mode                         : Lossy
Bits/(Pixel*Frame)                       : 0.494
Time code of first frame                 : 00:00:00;00
Time code source                         : Group of pictures header
GOP, Open/Closed                         : Closed
Stream size                              : 9.16 MiB (98%)
Color primaries                          : BT.709

With all that said, I have two questions:
1) Is it possible to control the distance between I-frames in HandBrake for MPEG2 video in order to create files similar to PrPro's "I-Frame Only MPEG"?
2) Is it possible to create with HandBrake MPEG2 files that would actually have no P and B frames and consist of only I-frames?




HandBrake version: 1.2.2




Operating system and version: Windows 7 Ultimate x64




HandBrake Activity Log

Code: Select all

HandBrake 1.2.2 (2019022300)
OS: Microsoft Windows NT 6.1.7601 Service Pack 1
CPU: Intel(R) Core(TM) i7-3770 CPU @ 3.40GHz
Ram: 32712 MB, 
GPU Information:
  NVIDIA GeForce GTX 1050 Ti - 27.21.14.5730
Screen: 1920x1080
Temp Dir: C:\Users\dr0\AppData\Local\Temp\
Install Dir: D:\Software\MEDIA-Edit\HandBrake
Data Dir: C:\Users\dr0\AppData\Roaming\HandBrake

-------------------------------------------


# Starting Encode ...

[01:58:37] hb_init: starting libhb thread
[01:58:37] 1 job(s) to process
[01:58:37] json job:
{
  "Audio": {
    "AudioList": [
      {
        "Bitrate": 192,
        "DRC": 0.0,
        "Encoder": "ac3",
        "Gain": 0.0,
        "Mixdown": 4,
        "NormalizeMixLevel": false,
        "Samplerate": 0,
        "Track": 0,
        "DitherMethod": 0
      }
    ],
    "CopyMask": [
      "copy:aac",
      "copy:mp3"
    ],
    "FallbackEncoder": "ac3"
  },
  "Destination": {
    "ChapterList": [],
    "ChapterMarkers": false,
    "AlignAVStart": false,
    "File": "D:\\Data\\Transcodes\\WideSunsetCamera-CQP1.mp4",
    "Mp4Options": {
      "IpodAtom": false,
      "Mp4Optimize": false
    },
    "Mux": "mp4"
  },
  "Filters": {
    "FilterList": [
      {
        "ID": 11,
        "Settings": {
          "crop-bottom": "0",
          "crop-left": "0",
          "crop-right": "0",
          "crop-top": "0",
          "height": "1080",
          "width": "1920"
        }
      },
      {
        "ID": 6,
        "Settings": {
          "mode": "1"
        }
      }
    ]
  },
  "PAR": {
    "Num": 1,
    "Den": 1
  },
  "Metadata": {},
  "SequenceID": 0,
  "Source": {
    "Angle": 1,
    "Range": {
      "Type": "chapter",
      "Start": 1,
      "End": 1
    },
    "Title": 1,
    "Path": "D:\\Data\\Stock Footage\\Justin Odisho Footage Pack\\WideSunsetCamera.MP4"
  },
  "Subtitle": {
    "Search": {
      "Burn": false,
      "Default": false,
      "Enable": false,
      "Forced": false
    },
    "SubtitleList": []
  },
  "Video": {
    "Encoder": "mpeg2",
    "Level": "auto",
    "TwoPass": false,
    "Turbo": false,
    "ColorMatrixCode": 0,
    "Options": "",
    "Quality": 1.0,
    "QSV": {
      "Decode": false,
      "AsyncDepth": 0
    }
  }
}
[01:58:37] CPU: Intel(R) Core(TM) i7-3770 CPU @ 3.40GHz
[01:58:37]  - Intel microarchitecture Ivy Bridge
[01:58:37]  - logical processor count: 8
[01:58:37] Intel Quick Sync Video support: no
[01:58:37] hb_scan: path=D:\Data\Stock Footage\Justin Odisho Footage Pack\WideSunsetCamera.MP4, title_index=1
udfread ERROR: ECMA 167 Volume Recognition failed
src/libbluray/disc/disc.c:323: failed opening UDF image D:\Data\Stock Footage\Justin Odisho Footage Pack\WideSunsetCamera.MP4
src/libbluray/disc/disc.c:424: error opening file BDMV\index.bdmv
src/libbluray/disc/disc.c:424: error opening file BDMV\BACKUP\index.bdmv
[01:58:37] bd: not a bd - trying as a stream/file instead
libdvdnav: Using dvdnav version 6.0.0
libdvdread: Encrypted DVD support unavailable.
libdvdread:DVDOpenFileUDF:UDFFindFile /VIDEO_TS/VIDEO_TS.IFO failed
libdvdread:DVDOpenFileUDF:UDFFindFile /VIDEO_TS/VIDEO_TS.BUP failed
libdvdread: Can't open file VIDEO_TS.IFO.
libdvdnav: vm: failed to read VIDEO_TS.IFO
[01:58:37] dvd: not a dvd - trying as a stream/file instead
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'D:\Data\Stock Footage\Justin Odisho Footage Pack\WideSunsetCamera.MP4':
  Metadata:
    major_brand     : qt
    minor_version   : 0
    compatible_brands: qt
    creation_time   : 2018-06-10T21:29:54.000000Z
  Duration: 00:01:00.00, start: 0.000000, bitrate: 31738 kb/s
    Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuvj420p(pc, bt709), 1920x1080 [SAR 1:1 DAR 16:9], 29949 kb/s, 29.96 fps, 29.97 tbr, 30k tbn, 60k tbc (default)
    Metadata:
      creation_time   : 2018-06-10T21:29:54.000000Z
      handler_name    : Core Media Video
      timecode        : 11:33:48;21
    Stream #0:1(eng): Audio: pcm_s16le (lpcm / 0x6D63706C), 48000 Hz, stereo, s16, 1536 kb/s (default)
    Metadata:
      creation_time   : 2018-06-10T21:29:54.000000Z
      handler_name    : Core Media Audio
      timecode        : 11:33:48;21
    Stream #0:2(eng): Data: none (tmcd / 0x64636D74), 0 kb/s (default)
    Metadata:
      creation_time   : 2018-06-10T21:29:54.000000Z
      handler_name    : Core Media Time Code
      timecode        : 11:33:48;21
[01:58:37] scan: decoding previews for title 1
[01:58:37] scan: audio 0x1: pcm_s16le, rate=48000Hz, bitrate=1536000 English (pcm_s16le) (2.0 ch)
[01:58:37] scan: 10 previews, 1920x1080, 30.200 fps, autocrop = 0/0/0/0, aspect 16:9, PAR 1:1
[01:58:37] scan: supported video decoders: avcodec qsv
[01:58:37] libhb: scan thread found 1 valid title(s)
[01:58:37] starting job
[01:58:37] job configuration:
[01:58:37]  * source
[01:58:37]    + D:\Data\Stock Footage\Justin Odisho Footage Pack\WideSunsetCamera.MP4
[01:58:37]    + title 1, chapter(s) 1 to 1
[01:58:37]    + container: mov,mp4,m4a,3gp,3g2,mj2
[01:58:37]    + data rate: 31738 kbps
[01:58:37]  * destination
[01:58:37]    + D:\Data\Transcodes\WideSunsetCamera-CQP1.mp4
[01:58:37]    + container: MPEG-4 (libavformat)
[01:58:37]  * video track
[01:58:37]    + decoder: h264
[01:58:37]      + bitrate 29949 kbps
[01:58:37]    + filters
[01:58:37]      + Framerate Shaper (mode=1)
[01:58:37]        + frame rate: 30.200 fps -> constant 30.200 fps
[01:58:37]      + Crop and Scale (width=1920:height=1080:crop-top=0:crop-bottom=0:crop-left=0:crop-right=0)
[01:58:37]        + source: 1920 * 1080, crop (0/0/0/0): 1920 * 1080, scale: 1920 * 1080
[01:58:37]    + Output geometry
[01:58:37]      + storage dimensions: 1920 x 1080
[01:58:37]      + pixel aspect ratio: 1 : 1
[01:58:37]      + display dimensions: 1920 x 1080
[01:58:37]    + encoder: MPEG-2 (libavcodec)
[01:58:37]      + quality: 1.00 (QP)
[01:58:37]      + color profile: 1-1-1
[01:58:37]  * audio track 1
[01:58:37]    + decoder: English (pcm_s16le) (2.0 ch) (track 1, id 0x1)
[01:58:37]      + bitrate: 1536 kbps, samplerate: 48000 Hz
[01:58:37]    + mixdown: Stereo
[01:58:37]    + dither: none
[01:58:37]    + encoder: AC3 (libavcodec)
[01:58:37]      + bitrate: 192 kbps, samplerate: 48000 Hz
[01:58:37] sync: expecting 1812 video frames
[01:58:37] encavcodecInit: MPEG-2 encoder
[01:58:37] encavcodec: framerate 13500000 / 447019 is not supported. Using 30 / 1.
[01:58:37] encavcodec: encoding at constant quantizer 118
[01:58:37] encavcodec: encoding with stored aspect 1/1
[01:58:38] sync: first pts video is 0
[01:58:38] sync: Chapter 1 at frame 15 time 41721
[01:58:38] sync: first pts audio 0x1 is 42042
[01:58:51] reader: done. 1 scr changes
[01:58:51] work: average encoding speed for job is 133.516861 fps
[01:58:51] vfr: 1825 frames output, 0 dropped and 13 duped for CFR/PFR
[01:58:51] vfr: lost time: 0 (0 frames)
[01:58:51] vfr: gained time: 0 (0 frames) (0 not accounted for)
[01:58:51] pcm_s16le-decoder done: 2876 frames, 0 decoder errors
[01:58:51] h264-decoder done: 1812 frames, 0 decoder errors
[01:58:51] sync: got 1812 frames, 1812 expected
[01:58:51] sync: framerate min 29.970 fps, max 30.201 fps, avg 29.976 fps
[01:58:51] mux: track 0, 1825 frames, 56976700 bytes, 7538.66 kbps, fifo 512
[01:58:51] mux: track 1, 1874 frames, 1439232 bytes, 190.43 kbps, fifo 512
[01:58:51] libhb: work result = 0

# Encode Completed ...

musicvid
Veteran User
Posts: 3817
Joined: Sat Jun 27, 2009 1:19 am

Re: Is it possible to encode an MPEG2 video containing only I-frames?

Post by musicvid »

All-Intra MPEG-2 is usually formatted as XAVC, with which Handbrake has nothing in common.
dr0
Posts: 5
Joined: Mon Dec 21, 2020 11:52 pm

Re: Is it possible to encode an MPEG2 video containing only I-frames?

Post by dr0 »

musicvid wrote: Sun Dec 27, 2020 1:34 am All-Intra MPEG-2 is usually formatted as XAVC, with which Handbrake has nothing in common.
I'm no expert, otherwise, I wouldn't be asking questions on forums, but isn't XAVC MPEG-4?

Anyway, is there a way to somehow control the distance between I-frames for MPEG2 in HandBrake? Maybe, command line parameters?
This section of HandBrake documentation says that they are using ffmpeg for MPEG-2. I looked here for options to manually control the number of I-frames, but there are very few options, none of which seem to affect I-frames.
musicvid
Veteran User
Posts: 3817
Joined: Sat Jun 27, 2009 1:19 am

Re: Is it possible to encode an MPEG2 video containing only I-frames?

Post by musicvid »

Sorry, I don't encode MPEG-2 in Handbrake. I assume it's a normal 15-frame GOP.
I was mistaken about the format. HDCAM is intraframe.
rollin_eng
Veteran User
Posts: 3693
Joined: Wed May 04, 2011 11:06 pm

Re: Is it possible to encode an MPEG2 video containing only I-frames?

Post by rollin_eng »

As you can see in the documentation it’s really only there for testing.
dr0
Posts: 5
Joined: Mon Dec 21, 2020 11:52 pm

Re: Is it possible to encode an MPEG2 video containing only I-frames?

Post by dr0 »

I was able to create a true I-frame only MPEG2 video in Premiere Pro / Media Encoder with the following settings:
Image

Code: Select all

General
Complete name                            : m-frames-1_n-frames-1_CBR100.mpg
Format                                   : MPEG-PS
File size                                : 1.63 GiB
Duration                                 : 2 min 17 s
Overall bit rate mode                    : Constant
Overall bit rate                         : 102 Mb/s

Video
ID                                       : 224 (0xE0)
Format                                   : MPEG Video
Format version                           : Version 2
Format profile                           : High@High
Format settings, BVOP                    : No
Format settings, Matrix                  : Default
Format settings, GOP                     : N=1
Duration                                 : 2 min 17 s
Bit rate mode                            : Constant
Bit rate                                 : 100.0 Mb/s
Width                                    : 1 920 pixels
Height                                   : 1 080 pixels
Display aspect ratio                     : 16:9
Frame rate                               : 29.970 (30000/1001) FPS
Standard                                 : NTSC
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Progressive
Compression mode                         : Lossy
Bits/(Pixel*Frame)                       : 1.609
Time code of first frame                 : 00:00:00:00
Time code source                         : Group of pictures header
GOP, Open/Closed                         : Closed
Stream size                              : 1.59 GiB (98%)
Color primaries                          : BT.709
Transfer characteristics                 : BT.709
Matrix coefficients                      : BT.709

Audio
ID                                       : 192 (0xC0)
Format                                   : MPEG Audio
Format version                           : Version 1
Format profile                           : Layer 2
Duration                                 : 2 min 17 s
Bit rate mode                            : Constant
Bit rate                                 : 384 kb/s
Channel(s)                               : 2 channels
Sampling rate                            : 48.0 kHz
Frame rate                               : 41.667 FPS (1152 SPF)
Compression mode                         : Lossy
Stream size                              : 6.30 MiB (0%)
I still keep wondering if it's possible to do in HandBrake?
musicvid
Veteran User
Posts: 3817
Joined: Sat Jun 27, 2009 1:19 am

Re: Is it possible to encode an MPEG2 video containing only I-frames?

Post by musicvid »

I still keep wondering if it's possible to do in HandBrake?
Wrong tool for the job. You have Premiere, and Davinci Resolve is free.
Post Reply