Constant Framerate Ignored using VideoToolbox

HandBrake for Mac 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
encoder_111
Posts: 15
Joined: Sun May 05, 2024 9:42 am

Constant Framerate Ignored using VideoToolbox

Post by encoder_111 »

Description of problem or question:
When using VideoToolbox as the Encoder with the Framerate set to "Same as Source" with "Constant Framerate" checked, the resulting file opened in Media Info shows the "Frame rate mode" line as being "Variable", showing Min and Max framerates. The two are imperceptably different during playback at 23.974fps and 23.981fps while the overall framerate is listed as 23.876 which is what the source file is listed as in Media Info.

Changing the encoder to x265 results in a file with "Constant" in Media Info, but I need to use VTB for speed.

Is this expected behavior for VTB or possible a bug in Media Info?

Steps to reproduce the problem (If Applicable):




HandBrake version (e.g., 1.0.0):
Using 1.7.3. Holding off on 1.8+ until the option to exclude DV is available.



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



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

Code: Select all

HandBrake Activity Log for Session: 2024-09-05T04:53:01Z
Handbrake Version: 1.7.3 (2024021100)
Resident Evil (2002) - 4K.mp4
Preset: 4K UHD (Modified)
[00:53:01] macgui: fr.handbrake.HandBrakeXPCService scanning specifically for title: 1
[00:53:01] CPU: Unknown
[00:53:01]  - logical processor count: 16
[00:53:01] hb_scan: path=/Volumes/Glyph 2/Encodes/Source/Resident Evil (2002) - 4K.mkv, title_index=1
Input #0, matroska,webm, from '/Volumes/Glyph 2/Encodes/Source/Resident Evil (2002) - 4K.mkv':
  Metadata:
    title           : Resident Evil - Deluxe Edition
    encoder         : libmakemkv v1.17.7 (1.3.10/1.5.2) darwin(x64-release)
    creation_time   : 2024-09-01T22:40:49.000000Z
  Duration: 01:40:31.03, start: 0.000000, bitrate: 72745 kb/s
  Chapters:
    Chapter #0:0: start 0.000000, end 502.585417
      Metadata:
        title           : Chapter 01
    Chapter #0:1: start 502.585417, end 660.409750
      Metadata:
        title           : Chapter 02
    Chapter #0:2: start 660.409750, end 1149.898750
      Metadata:
        title           : Chapter 03
    Chapter #0:3: start 1149.898750, end 1428.969208
      Metadata:
        title           : Chapter 04
    Chapter #0:4: start 1428.969208, end 1762.343917
      Metadata:
        title           : Chapter 05
    Chapter #0:5: start 1762.343917, end 2271.102167
      Metadata:
        title           : Chapter 06
    Chapter #0:6: start 2271.102167, end 2474.346875
      Metadata:
        title           : Chapter 07
    Chapter #0:7: start 2474.346875, end 2831.829000
      Metadata:
        title           : Chapter 08
    Chapter #0:8: start 2831.829000, end 3136.591792
      Metadata:
        title           : Chapter 09
    Chapter #0:9: start 3136.591792, end 3647.977667
      Metadata:
        title           : Chapter 10
    Chapter #0:10: start 3647.977667, end 4115.778333
      Metadata:
        title           : Chapter 11
    Chapter #0:11: start 4115.778333, end 4325.070750
      Metadata:
        title           : Chapter 12
    Chapter #0:12: start 4325.070750, end 4713.667292
      Metadata:
        title           : Chapter 13
    Chapter #0:13: start 4713.667292, end 5062.307250
      Metadata:
        title           : Chapter 14
    Chapter #0:14: start 5062.307250, end 5415.910500
      Metadata:
        title           : Chapter 15
    Chapter #0:15: start 5415.910500, end 6031.029333
      Metadata:
        title           : Chapter 16
  Stream #0:0(eng): Video: hevc (Main 10), yuv420p10le(tv, bt2020nc/bt2020/smpte2084), 3840x2160 [SAR 1:1 DAR 16:9], 23.98 fps, 23.98 tbr, 1k tbn
    Metadata:
      BPS-eng         : 64502155
      DURATION-eng    : 01:40:31.025000000
      NUMBER_OF_FRAMES-eng: 144600
      NUMBER_OF_BYTES-eng: 48626763984
      SOURCE_ID-eng   : 001011
      _STATISTICS_WRITING_APP-eng: MakeMKV v1.17.7 darwin(x64-release)
      _STATISTICS_WRITING_DATE_UTC-eng: 2024-09-01 22:40:49
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES SOURCE_ID
    Side data:
      DOVI configuration record: version: 1.0, profile: 7, level: 6, rpu flag: 1, el flag: 1, bl flag: 1, compatibility id: 6
  Stream #0:1(eng): Audio: truehd (Dolby TrueHD + Dolby Atmos), 48000 Hz, 7.1, s32 (24 bit) (default)
    Metadata:
      title           : Surround 7.1
      BPS-eng         : 3567069
      DURATION-eng    : 01:40:31.025000000
      NUMBER_OF_FRAMES-eng: 7237230
      NUMBER_OF_BYTES-eng: 2689135440
      SOURCE_ID-eng   : 001100
      _STATISTICS_WRITING_APP-eng: MakeMKV v1.17.7 darwin(x64-release)
      _STATISTICS_WRITING_DATE_UTC-eng: 2024-09-01 22:40:49
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES SOURCE_ID
  Stream #0:2(eng): Audio: ac3, 48000 Hz, 5.1(side), fltp, 640 kb/s
    Metadata:
      title           : Surround 5.1
      BPS-eng         : 640000
      DURATION-eng    : 01:40:31.040000000
      NUMBER_OF_FRAMES-eng: 188470
      NUMBER_OF_BYTES-eng: 482483200
      SOURCE_ID-eng   : 001100
      _STATISTICS_WRITING_APP-eng: MakeMKV v1.17.7 darwin(x64-release)
      _STATISTICS_WRITING_DATE_UTC-eng: 2024-09-01 22:40:49
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES SOURCE_ID
  Stream #0:3(eng): Audio: dts (DTS-HD MA), 48000 Hz, 5.1(side), s16p
    Metadata:
      title           : Surround 5.1
      BPS-eng         : 2470754
      DURATION-eng    : 01:40:31.029333333
      NUMBER_OF_FRAMES-eng: 565409
      NUMBER_OF_BYTES-eng: 1862649096
      SOURCE_ID-eng   : 001101
      _STATISTICS_WRITING_APP-eng: MakeMKV v1.17.7 darwin(x64-release)
      _STATISTICS_WRITING_DATE_UTC-eng: 2024-09-01 22:40:49
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES SOURCE_ID
  Stream #0:4(eng): Audio: dts (DTS), 48000 Hz, 5.1(side), fltp, 1536 kb/s
    Metadata:
      title           : Surround 5.1
      BPS-eng         : 1509000
      DURATION-eng    : 01:40:31.029333333
      NUMBER_OF_FRAMES-eng: 565409
      NUMBER_OF_BYTES-eng: 1137602908
      SOURCE_ID-eng   : 001101
      _STATISTICS_WRITING_APP-eng: MakeMKV v1.17.7 darwin(x64-release)
      _STATISTICS_WRITING_DATE_UTC-eng: 2024-09-01 22:40:49
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES SOURCE_ID
  Stream #0:5(eng): Subtitle: hdmv_pgs_subtitle
    Metadata:
      BPS-eng         : 24071
      DURATION-eng    : 01:40:07.939437500
      NUMBER_OF_FRAMES-eng: 2292
      NUMBER_OF_BYTES-eng: 18077496
      SOURCE_ID-eng   : 0012A0
      _STATISTICS_WRITING_APP-eng: MakeMKV v1.17.7 darwin(x64-release)
      _STATISTICS_WRITING_DATE_UTC-eng: 2024-09-01 22:40:49
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES SOURCE_ID
  Stream #0:6(eng): Subtitle: hdmv_pgs_subtitle
    Metadata:
      BPS-eng         : 18781
      DURATION-eng    : 01:31:03.437145833
      NUMBER_OF_FRAMES-eng: 1450
      NUMBER_OF_BYTES-eng: 12826239
      SOURCE_ID-eng   : 0012A1
      _STATISTICS_WRITING_APP-eng: MakeMKV v1.17.7 darwin(x64-release)
      _STATISTICS_WRITING_DATE_UTC-eng: 2024-09-01 22:40:49
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES SOURCE_ID
[00:53:01] scan: decoding previews for title 1
[00:53:01] scan: audio 0x1: truehd, rate=48000Hz, bitrate=1 English (Dolby TrueHD + Dolby Atmos, 7.1 ch)
[00:53:01] scan: audio 0x2: ac3, rate=48000Hz, bitrate=640000 English (AC3, 5.1 ch, 640 kbps)
[00:53:01] scan: audio 0x3: dca, rate=48000Hz, bitrate=1 English (DTS-HD MA, 5.1 ch)
[00:53:01] scan: audio 0x4: dca, rate=48000Hz, bitrate=1536000 English (DTS, 5.1 ch, 1536 kbps)
[00:53:01] using container PAR 1:1
[00:53:01] scan: 10 previews, 3840x2160, 23.976 fps, autocrop = 42/42/0/0, aspect 16:9, PAR 1:1, color profile: 9-16-9, chroma location: topleft
[00:53:01] scan: mastering display metadata: r(0.7080,0.2920) g(0.1700,0.7970) b(0.1310 0.0460) wp(0.3127, 0.3290) min_luminance=0.005000, max_luminance=4000.000000
[00:53:01] scan: content light level: max_cll=4215, max_fall=3241
[00:53:01] scan: dolby vision configuration record: version: 1.0, profile: 7, level: 6, rpu flag: 1, el flag: 1, bl flag: 1, compatibility id: 6
[00:53:01] scan: supported video decoders: avcodec hwaccel
[00:53:01] libhb: scan thread found 1 valid title(s)
[00:53:01] macgui: fr.handbrake.HandBrakeXPCService scan done
[00:53:01] Starting work at: Thu Sep  5 00:53:01 2024

[00:53:01] 1 job(s) to process
[00:53:01] macgui: fr.handbrake.HandBrakeXPCService started encoding Resident Evil (2002) - 4K.mp4
[00:53:01] macgui: fr.handbrake.HandBrakeXPCService with preset 4K UHD (Modified)
[00:53:01] Starting Task: Encoding Pass
[00:53:01] job configuration:
[00:53:01]  * source
[00:53:01]    + /Volumes/Glyph 2/Encodes/Source/Resident Evil (2002) - 4K.mkv
[00:53:01]    + title 1, chapter(s) 1 to 1
[00:53:01]    + container: matroska,webm
[00:53:01]    + data rate: 72745 kbps
[00:53:01]  * destination
[00:53:01]    + /Volumes/Glyph 2/Encodes/Converted/Resident Evil (2002) - 4K.mp4
[00:53:01]    + container: MPEG-4 (libavformat)
[00:53:01]      + optimized for HTTP streaming (fast start)
[00:53:01]  * video track
[00:53:01]    + decoder: hevc 10-bit hwaccel (p010le, (null))
[00:53:01]    + filters
[00:53:01]      + Framerate Shaper (mode=1:rate=27000000/1126125)
[00:53:01]        + frame rate: 23.976 fps -> constant 23.976 fps
[00:53:01]      + Crop and Scale (width=3840:height=2076:crop-top=42:crop-bottom=42:crop-left=0:crop-right=0)
[00:53:01]        + source: 3840 * 2160, crop (42/42/0/0): 3840 * 2076, scale: 3840 * 2076
[00:53:01]    + Output geometry
[00:53:01]      + storage dimensions: 3840 x 2076
[00:53:01]      + pixel aspect ratio: 1 : 1
[00:53:01]      + display dimensions: 3840 x 2076
[00:53:01]    + encoder: H.265 10-bit (VideoToolbox)
[00:53:01]      + preset:  quality
[00:53:01]      + options: keyint=24:bframes=3
[00:53:01]      + profile: auto
[00:53:01]      + level:   auto
[00:53:01]      + bitrate: 30000 kbps, pass: 0
[00:53:01]      + color profile: 9-16-9
[00:53:01]      + chroma location: topleft
[00:53:01]      + mastering display metadata: r(0.7080,0.2920) g(0.1700,0.7970) b(0.1310 0.0460) wp(0.3127, 0.3290) min_luminance=0.005000, max_luminance=4000.000000
[00:53:01]      + content light level: max_cll=4215, max_fall=3241
[00:53:01]  * audio track 1
[00:53:01]    + name: Surround 7.1
[00:53:01]    + decoder: English (Dolby TrueHD + Dolby Atmos, 7.1 ch) (track 1, id 0x1)
[00:53:01]      + samplerate: 48000 Hz
[00:53:01]    + mixdown: 7.1 Channels
[00:53:01]    + encoder: AAC (Apple AudioToolbox)
[00:53:01]      + bitrate: 960 kbps, samplerate: 48000 Hz
[00:53:01] sync: expecting 12049 video frames
[00:53:01] encvt_Init: encoding with output bitrate 30000 Kbps
[00:53:01] encvt_Init: com.apple.videotoolbox.videoencoder.ave.hevc
[00:53:01] sync: first pts audio 0x1 is 0
[00:53:02] sync: first pts video is 0
[00:53:02] sync: "Chapter 1" (1) at frame 1 time 0
[00:55:22] reader: end of chapter 1 (media 1) reached at media chapter 2
[00:55:22] reader: done. 1 scr changes
[00:55:23] sync: "Chapter 2" (2) at frame 12052 time 45244027
[00:55:23] work: average encoding speed for job is 85.228966 fps
[00:55:23] vfr: 12054 frames output, 0 dropped and 2 duped for CFR/PFR
[00:55:23] vfr: lost time: 0 (0 frames)
[00:55:23] vfr: gained time: 0 (0 frames) (0 not accounted for)
[00:55:24] truehd-decoder done: 603215 frames, 0 decoder errors
[00:55:24] hevc-decoder done: 12052 frames, 0 decoder errors
[00:55:24] sync: got 12052 frames, 12049 expected
[00:55:24] sync: framerate min 7.937 fps, max 23.976 fps, avg 23.972 fps
[00:55:25] mux: track 0, 12054 frames, 1789569806 bytes, 28476.37 kbps, fifo 512
[00:55:25] mux: track 1, 23566 frames, 71192832 bytes, 1132.85 kbps, fifo 1024
[00:55:25] Finished work at: Thu Sep  5 00:55:25 2024

[00:55:25] libhb: work result = 0

encoder_111
Posts: 15
Joined: Sun May 05, 2024 9:42 am

Re: Constant Framerate Ignored using VideoToolbox

Post by encoder_111 »

Edit : Overall framerate of output file is 23.976fps
encoder_111
Posts: 15
Joined: Sun May 05, 2024 9:42 am

Re: Constant Framerate Ignored using VideoToolbox

Post by encoder_111 »

Edit 2 : Changing the output framerate manually from "Same as Source" to 23.976fps ( NTSC Film ) to match the source still produces a file with "Variable" listed in MediaInfo. Strangely, manually setting the output to 24fps shows "Constant" in MediaInfo but no longer matches the source.
User avatar
Ritsuka
HandBrake Team
Posts: 1732
Joined: Fri Jan 12, 2007 11:29 am

Re: Constant Framerate Ignored using VideoToolbox

Post by Ritsuka »

It's not ignored, it's because the NTSC Framerate can't be represented correctly when using the 90000 timescale HandBrake 1.7.3 uses, so there is a small jitter in every frame duration. It won't make any difference, aside from broken software like Adobe Premiere.

Anyway, the latest version of HandBrake already uses a different timescale for NTSC, so all you have to do is update the latest HandBrake version.
encoder_111
Posts: 15
Joined: Sun May 05, 2024 9:42 am

Re: Constant Framerate Ignored using VideoToolbox

Post by encoder_111 »

Good to know I'm not going crazy. On the Dolby Vision updates with 1.8.2, I still don't see a way to exclude it to produce a generic HDR file. I can't remember if this is even necessary or if its compatible with non DV TVs and boxes.
encoder_111
Posts: 15
Joined: Sun May 05, 2024 9:42 am

Re: Constant Framerate Ignored using VideoToolbox

Post by encoder_111 »

Sorry for so many posts, but just to confirm, this is specific to pre HB 1.8 and only with VTB?
User avatar
Ritsuka
HandBrake Team
Posts: 1732
Joined: Fri Jan 12, 2007 11:29 am

Re: Constant Framerate Ignored using VideoToolbox

Post by Ritsuka »

No it's not specific to VTB. TVs that don't support Dolby Vision will fall back to HDR.
Post Reply