Unable to create a destination mp4 file with video constant frame rate

HandBrake for Windows support
Forum rules
An Activity Log is required for support requests. Please read How-to get an activity log? for details on how and why this should be provided.
Post Reply
rusticity
Posts: 2
Joined: Sat Feb 04, 2023 6:04 pm

Unable to create a destination mp4 file with video constant frame rate

Post by rusticity »

Description of problem or question:

Source file has a resolution of 1920x1080 and a video constant frame rate of 23.976 fps (based on details provided by MediaInfo v22.12)
Destination file has a resolution of 1280x720 and a video VARIABLE frame rate of 23.976 fps

Note that I did specify CONSTANT frame rate in Video

Summary: The problem with Handbrake is it is unable to produce a destination file with video constant frame.

Steps to reproduce the problem (If Applicable):

https://thumbs2.imgbox.com/ac/0d/rdQ5u1qM_t.png

https://thumbs2.imgbox.com/d1/0f/YCjAVYQV_t.png

https://thumbs2.imgbox.com/ba/fd/YOTCvFzk_t.png

https://thumbs2.imgbox.com/e2/33/wHzXHgBv_t.png

https://thumbs2.imgbox.com/58/9f/u7LoXitU_t.png

HandBrake version (e.g., 1.0.0):

Handbrake 1.6.1 (HandBrake-1.6.1-x86_64-Win_GUI.exe)

Operating system and version (e.g., Ubuntu 16.04 LTS, macOS 10.13 High Sierra, Windows 10 Creators Update):

Microsoft Windows 11 build 22621.1105

HandBrake Activity Log ***required*** (see How-to get an activity log)

Code: Select all


HandBrake 1.6.1 (2023012300)
OS: Microsoft Windows NT 10.0.22621.0
CPU: 12th Gen Intel(R) Core(TM) i7-1255U
Ram: 24260 MB, 
GPU Information:
  Intel(R) Iris(R) Xe Graphics - 31.0.101.3301
Screen: 1920x1200
Temp Dir: C:\Users\Caleb\AppData\Local\Temp\
Install Dir: C:\Program Files\HandBrake\
Data Dir: C:\Users\Caleb\AppData\Roaming\HandBrake

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

 # Starting Encode ...

[19:36:00] base preset: Custom - 720p - constant framerate 23.976 (Modified)
[19:36:00] Remote Process started with Process ID: 10204 using port: 8037. Max Allowed Instances: 1
[19:36:01] Worker: Starting HandBrake Engine ...
[19:36:01] Worker: Starting Web Server on port 8037 ...
[19:36:01] Worker: Disconnected worker monitoring enabled!
[19:36:01] Compile-time hardening features are enabled
[19:36:02] qsv: is available on this system
[19:36:02] vcn: not available on this system
Cannot load nvEncodeAPI64.dll
[19:36:02] hb_init: starting libhb thread
[19:36:02] Starting work at: Fri Feb 03 19:36:02 2023
[19:36:02] 1 job(s) to process
[19:36:02] json job:
{
  "Audio": {
    "AudioList": [
      {
        "Bitrate": 160,
        "DRC": 0,
        "Encoder": "av_aac",
        "Gain": 0,
        "Mixdown": 4,
        "NormalizeMixLevel": false,
        "Samplerate": 0,
        "Track": 0,
        "DitherMethod": 0
      }
    ],
    "CopyMask": [
      "copy:aac"
    ]
  },
  "Destination": {
    "ChapterList": [],
    "ChapterMarkers": false,
    "AlignAVStart": true,
    "File": "D:\Test\It's A Beautiful World.mp4",
    "Mp4Options": {
      "IpodAtom": false,
      "Mp4Optimize": false
    },
    "Mux": "av_mp4"
  },
  "Filters": {
    "FilterList": [
      {
        "ID": 4,
        "Settings": {
          "mode": "7"
        }
      },
      {
        "ID": 3,
        "Settings": {
          "block-height": "16",
          "block-thresh": "40",
          "block-width": "16",
          "filter-mode": "2",
          "mode": "3",
          "motion-thresh": "1",
          "spatial-metric": "2",
          "spatial-thresh": "1"
        }
      },
      {
        "ID": 14,
        "Settings": {
          "crop-bottom": "0",
          "crop-left": "0",
          "crop-right": "0",
          "crop-top": "0",
          "height": "720",
          "width": "1280"
        }
      },
      {
        "ID": 7,
        "Settings": {
          "mode": "1",
          "rate": "27000000/1126125"
        }
      }
    ]
  },
  "PAR": {
    "Num": 1,
    "Den": 1
  },
  "Metadata": {
    "Comment": "It's A Beautiful World",
    "Name": "It's A Beautiful World"
  },
  "SequenceID": 0,
  "Source": {
    "Angle": 1,
    "Range": {
      "Type": "chapter",
      "Start": 1,
      "End": 1
    },
    "Title": 1,
    "Path": "D:\Test\It's A Beautiful World.mp4"
  },
  "Subtitle": {
    "Search": {
      "Burn": true,
      "Default": false,
      "Enable": true,
      "Forced": true
    },
    "SubtitleList": []
  },
  "Video": {
    "Encoder": "qsv_h265",
    "Level": "auto",
    "TwoPass": false,
    "Turbo": false,
    "ColorMatrixCode": 0,
    "Options": "lowpower=1",
    "Preset": "balanced",
    "Profile": "auto",
    "Quality": 22,
    "QSV": {
      "Decode": true
    },
    "HardwareDecode": 0
  }
}
[19:36:02] CPU: 12th Gen Intel(R) Core(TM) i7-1255U
[19:36:02]  - Intel microarchitecture Alder Lake performance hybrid architecture
[19:36:02]  - logical processor count: 12
[19:36:02] Intel Quick Sync Video support: yes, gpu list: 0
[19:36:02] Intel Quick Sync Video integrated adapter with index 0
[19:36:02] Impl mfx-gen library path: C:\Windows\System32\DriverStore\FileRepository\iigd_dch.inf_amd64_22025955949136f8\libmfx64-gen.dll
[19:36:02]  - Intel Media SDK hardware: API 2.7 (minimum: 1.3)
[19:36:02]  - Decode support:  h264 hevc (8bit: yes, 10bit: yes) av1 (8bit: yes, 10bit: yes)
[19:36:02]  - H.264 encoder: yes
[19:36:02]     - preferred implementation: hardware (1) via D3D11
[19:36:02]     - capabilities (hardware):  lowpower breftype icq vsinfo chromalocinfo opt1 opt2+mbbrc+extbrc+trellis+repeatpps+ib_adapt+nmpslice
[19:36:02]  - H.265 encoder: yes (8bit: yes, 10bit: yes)
[19:36:02]     - preferred implementation: hardware (1) via D3D11
[19:36:02]     - capabilities (hardware):  lowpower bpyramid icq vsinfo masteringinfo cllinfo opt1
[19:36:02]  - AV1 encoder: no
[19:36:02] hb_scan: path=D:\Test\It's A Beautiful World.mp4, title_index=1
udfread ERROR: ECMA 167 Volume Recognition failed
src/libbluray/disc/disc.c:333: failed opening UDF image D:\Test\It's A Beautiful World.mp4
src/libbluray/disc/disc.c:437: error opening file BDMV\index.bdmv
src/libbluray/disc/disc.c:437: error opening file BDMV\BACKUP\index.bdmv
[19:36:02] bd: not a bd - trying as a stream/file instead
libdvdread: Encrypted DVD support unavailable.
libdvdreadlibdvdread: DVDOpenFileUDF:UDFFindFile /VIDEO_TS/VIDEO_TS.IFO failed
: Can't open file VIDEO_TS.IFO.
libdvdnav: vm: vm: failed to read VIDEO_TS.IFO
[19:36:02] dvd: not a dvd - trying as a stream/file instead
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'D:\Test\It's A Beautiful World.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2mp41
    creation_time   : 2022-04-23T06:54:45.000000Z
    title           : It's A Beautiful World
    encoder         : Lavf58.20.100
    comment         : It's A Beautiful World
  Duration: 00:44:05.61, start: 0.000000, bitrate: 2230 kb/s
  Stream #0:0[0x1](und): Video: hevc (Main 10) (hev1 / 0x31766568), yuv420p10le(tv), 1920x1080 [SAR 1:1 DAR 16:9], 1999 kb/s, 23.98 fps, 23.98 tbr, 24k tbn (default)
    Metadata:
      creation_time   : 2022-04-23T06:54:45.000000Z
      handler_name    : VideoHandler
      vendor_id       : [0][0][0][0]
  Stream #0:1[0x2](eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, 5.1, fltp, 224 kb/s (default)
    Metadata:
      creation_time   : 2022-04-23T06:54:45.000000Z
      handler_name    : SoundHandler
      vendor_id       : [0][0][0][0]
[19:36:02] scan: decoding previews for title 1
[19:36:02] scan: audio 0x1: aac, rate=48000Hz, bitrate=224000 English (AAC LC) (5.1 ch) (224 kbps)
[19:36:03] scan: 10 previews, 1920x1080, 23.976 fps, autocrop = 0/0/0/0, aspect 16:9, PAR 1:1, color profile: 1-1-1, chroma location: left
[19:36:03] scan: supported video decoders: avcodec qsv
[19:36:03] libhb: scan thread found 1 valid title(s)
[19:36:03] qsv: integrated qsv adapter with index 0 has been selected
[19:36:03] Skipping subtitle scan.  No suitable subtitle tracks.
[19:36:03] Starting Task: Encoding Pass
[19:36:03] work: track 1, dithering not supported by codec
[19:36:03] job configuration:
[19:36:03]  * source
[19:36:03]    + D:\Test\It's A Beautiful World.mp4
[19:36:03]    + title 1, chapter(s) 1 to 1
[19:36:03]    + container: mov,mp4,m4a,3gp,3g2,mj2
[19:36:03]    + data rate: 2230 kbps
[19:36:03]  * destination
[19:36:03]    + D:\Test\It's A Beautiful World 720p.mp4
[19:36:03]    + container: MPEG-4 (libavformat)
[19:36:03]      + align initial A/V stream timestamps
[19:36:03]  * video track
[19:36:03]    + decoder: hevc_qsv 10-bit (yuv420p10le)
[19:36:03]      + bitrate 1999 kbps
[19:36:03]    + filters
[19:36:03]      + Comb Detect (mode=3:spatial-metric=2:motion-thresh=1:spatial-thresh=1:filter-mode=2:block-thresh=40:block-width=16:block-height=16)
[19:36:03]      + Decomb (mode=39)
[19:36:03]      + Framerate Shaper (mode=1:rate=27000000/1126125)
[19:36:03]        + frame rate: 23.976 fps -> constant 23.976 fps
[19:36:03]      + Crop and Scale (width=1280:height=720:crop-top=0:crop-bottom=0:crop-left=0:crop-right=0)
[19:36:03]        + source: 1920 * 1080, crop (0/0/0/0): 1920 * 1080, scale: 1280 * 720
[19:36:03]      + Format (format=nv12)
[19:36:03]    + Output geometry
[19:36:03]      + storage dimensions: 1280 x 720
[19:36:03]      + pixel aspect ratio: 1 : 1
[19:36:03]      + display dimensions: 1280 x 720
[19:36:03]    + encoder: H.265 (Intel Media SDK)
[19:36:03]      + preset:  balanced
[19:36:03]      + options: lowpower=1
[19:36:03]      + profile: auto
[19:36:03]      + level:   auto
[19:36:03]      + quality: 22.00 (ICQ)
[19:36:03]      + color profile: 1-1-1
[19:36:03]      + chroma location: left
[19:36:03]  * audio track 1
[19:36:03]    + decoder: English (AAC LC) (5.1 ch) (224 kbps) (track 1, id 0x1)
[19:36:03]      + bitrate: 224 kbps, samplerate: 48000 Hz
[19:36:03]    + mixdown: Stereo
[19:36:03]    + encoder: AAC (libavcodec)
[19:36:03]      + bitrate: 160 kbps, samplerate: 48000 Hz
[19:36:03] sync: expecting 63431 video frames
[19:36:03] encqsvInit: using encode-only (LowPower) path
[19:36:03] encqsvInit: H.265/HEVC Main profile @ level 4.0
[19:36:03] encqsvInit: TargetUsage 4 AsyncDepth 6
[19:36:03] encqsvInit: GopRefDist 8 GopPicSize 24 NumRefFrame 4 IdrInterval 0
[19:36:03] encqsvInit: BFramesMax 7 BRefType pyramid
[19:36:03] encqsvInit: RateControlMethod ICQ ICQQuality 22
[19:36:04] sync: first pts video is 0
[19:36:04] sync: Chapter 1 at frame 1 time 0
[19:36:04] sync: first pts audio 0x1 is 0
[19:36:04] qsv_enc_init: using 'hardware (1) via D3D11' implementation, API: 2.7
[19:59:17] reader: done. 1 scr changes
[19:59:17] work: average encoding speed for job is 45.463882 fps
[19:59:17] comb detect: heavy 647 | light 1418 | uncombed 61365 | total 63430
[19:59:17] decomb: deinterlaced 647 | blended 1418 | unfiltered 61365 | total 63430
[19:59:17] vfr: 63430 frames output, 0 dropped and 0 duped for CFR/PFR
[19:59:17] vfr: lost time: 0 (0 frames)
[19:59:17] vfr: gained time: 0 (0 frames) (0 not accounted for)
[19:59:18] aac-decoder done: 124011 frames, 0 decoder errors
[19:59:18] hevc_qsv-decoder done: 63430 frames, 0 decoder errors
[19:59:18] sync: got 63430 frames, 63431 expected
[19:59:18] sync: framerate min 23.976 fps, max 23.976 fps, avg 23.976 fps
[19:59:18] mux: track 0, 63430 frames, 489012678 bytes, 1478.72 kbps, fifo 4096
[19:59:18] mux: track 1, 124012 frames, 53133813 bytes, 160.67 kbps, fifo 8192
[19:59:18] Finished work at: Fri Feb 03 19:59:18 2023
[19:59:18] libhb: work result = 0

 # Job Completed!

Last edited by s55 on Sat Feb 04, 2023 6:53 pm, edited 1 time in total.
Reason: Image to URLs
User avatar
s55
HandBrake Team
Posts: 10350
Joined: Sun Dec 24, 2006 1:05 pm

Re: Unable to create a destination mp4 file with video constant frame rate

Post by s55 »

Your output is Constant. Media Info will incorrectly sometimes report HandBrake CFR as VBR due to the 90khz timebase.
The output file is fine.
rusticity
Posts: 2
Joined: Sat Feb 04, 2023 6:04 pm

Re: Unable to create a destination mp4 file with video constant frame rate

Post by rusticity »

s55 wrote: Sat Feb 04, 2023 6:54 pm Your output is Constant.
Thanks for your clarification.
s55 wrote: Sat Feb 04, 2023 6:54 pmMedia Info will incorrectly sometimes report HandBrake CFR as VBR due to the 90khz timebase.
What is 90 kHz timebase? Could you provide me some URLs to understand this "90 kHz timebase" concept?

Shall I feedback to MediaInfo about the issue?
s55 wrote: Sat Feb 04, 2023 6:54 pmThe output file is fine.
Thanks once again.
User avatar
s55
HandBrake Team
Posts: 10350
Joined: Sun Dec 24, 2006 1:05 pm

Re: Unable to create a destination mp4 file with video constant frame rate

Post by s55 »

Last I heard, they don't consider it a bug in MediaInfo either.

They see the single frame jitter that a 90khz clock causes as VFR.

I'm not sure if there are any good resources that explain this in plain English but you could start here. https://en.wikipedia.org/wiki/Presentation_timestamp
User avatar
JohnAStebbins
HandBrake Team
Posts: 5712
Joined: Sat Feb 09, 2008 7:21 pm

Re: Unable to create a destination mp4 file with video constant frame rate

Post by JohnAStebbins »

Each frame duration is represented as a number of 90khz clock ticks. In the case of 23.976 fps video, each frame is 1 / 23.976 seconds or approximately 3753.753 90khz ticks. The duration of a frame can not be a fraction, so to stay in sync and true to the original source duration, some frames are represented as 3753 ticks and some as 3754 ticks. This one-tick jitter is what Mediainfo is flagging as "variable".
mduell
Veteran User
Posts: 8187
Joined: Sat Apr 21, 2007 8:54 pm

Re: Unable to create a destination mp4 file with video constant frame rate

Post by mduell »

Why not use the framerate (or 1000x framerate) as the timebase when outputting CFR?
User avatar
JohnAStebbins
HandBrake Team
Posts: 5712
Joined: Sat Feb 09, 2008 7:21 pm

Re: Unable to create a destination mp4 file with video constant frame rate

Post by JohnAStebbins »

Patches welcome :mrgreen:
Post Reply