Selur's Little Message Board
Unexpected Speed or FPS - Printable Version

+- Selur's Little Message Board (https://forum.selur.net)
+-- Forum: Hybrid - Support (https://forum.selur.net/forum-1.html)
+--- Forum: Problems & Questions (https://forum.selur.net/forum-3.html)
+--- Thread: Unexpected Speed or FPS (/thread-4076.html)



Unexpected Speed or FPS - PizzaTime - 23.04.2025

I am running into an issue where this Behind the Scenes clip I'm trying to re-encode/compress is not outputting the right speed/fps. It seems to play it back too fast. I think it could be related to the deinterlacing settings or mixed fps clips. Also, I notice that whenever I import the clip, it wants to give me a different FPS for output. Again, I don't know if this is related the the settings or a flagging issue. I have tried multiple different scenarios and none seem to work. I have attached a debug report.


RE: Unexpected Speed or FPS - Selur - 23.04.2025

Will Look at it after work. Clip seems to be soft telecine.


RE: Unexpected Speed or FPS - Selur - 23.04.2025

MediaInfo reports:
Video
Count                                    : 392
Count of stream of this kind             : 1
Kind of stream                           : Video
Kind of stream                           : Video
Stream identifier                        : 0
StreamOrder                              : 0
ID                                       : 1
ID                                       : 1
ID in the original source medium         : 4113
ID in the original source medium         : 4113 (0x1011)
Unique ID                                : 1
Format                                   : MPEG Video
Format                                   : MPEG Video
Commercial name                          : MPEG-2 Video
Format version                           : Version 2
Format profile                           : Main@High
Format settings                          : BVOP
Format settings, BVOP                    : Yes
Format settings, BVOP                    : Yes
Format settings, Matrix                  : Default
Format settings, Matrix                  : Default
Format settings, GOP                     : M=3, N=12
Internet media type                      : video/MPV
Codec ID                                 : V_MPEG2
Codec ID/Info                            : MPEG 1 or 2 Video
Codec ID/Url                             : http://ffdshow-tryout.sourceforge.net/
Duration                                 : 1137177.708333
Duration                                 : 18 min 57 s
Duration                                 : 18 min 57 s 178 ms
Duration                                 : 18 min 57 s
Duration                                 : 00:18:57.178
Duration                                 : 00:18:56:01
Duration                                 : 00:18:57.178 (00:18:56:01)
Bit rate mode                            : VBR
Bit rate mode                            : Variable
Bit rate                                 : 17805360
Bit rate                                 : 17.8 Mb/s
Maximum bit rate                         : 35000000
Maximum bit rate                         : 35.0 Mb/s
Width                                    : 1920
Width                                    : 1 920 pixels
Height                                   : 1080
Height                                   : 1 080 pixels
Sampled_Width                            : 1920
Sampled_Height                           : 1080
Pixel aspect ratio                       : 1.000
Display aspect ratio                     : 1.778
Display aspect ratio                     : 16:9
Frame rate mode                          : CFR
Frame rate mode                          : Constant
Frame rate                               : 23.976
Frame rate                               : 23.976 (24000/1001) FPS
FrameRate_Num                            : 24000
FrameRate_Den                            : 1001
Frame count                              : 27265
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Chroma subsampling                       : 4:2:0
Bit depth                                : 8
Bit depth                                : 8 bits
Scan type                                : Progressive
Scan type                                : Progressive
Compression mode                         : Lossy
Compression mode                         : Lossy
Bits/(Pixel*Frame)                       : 0.358
Delay                                    : 0
Delay                                    : 00:00:00.000
Delay                                    : 00:00:00:00
Delay                                    : 00:00:00.000 (00:00:00:00)
Delay, origin                            : Container
Delay, origin                            : Container
Delay_Original                           : 4604417
Delay_Original                           : 1 h 16 min
Delay_Original                           : 1 h 16 min 44 s 417 ms
Delay_Original                           : 1 h 16 min
Delay_Original                           : 01:16:44.417
Delay_Original                           : 01:16:39:20
Delay_Original                           : 01:16:44.417 (01:16:39:20)
Delay_Original_Settings                  : drop_frame_flag=0 / closed_gop=1 / broken_link=0
Delay_Original_DropFrame                 : No
Delay_Original_Source                    : Stream
Time code of first frame                 : 01:16:44:10
TimeCode_DropFrame                       : No
Time code source                         : Group of pictures header
GOP, Open/Closed                         : Open
GOP, Open/Closed                         : Open
GOP, Open/Closed of first frame          : Closed
GOP, Open/Closed of first frame          : Closed
Stream size                              : 2530980768
Stream size                              : 2.36 GiB (98%)
Stream size                              : 2 GiB
Stream size                              : 2.4 GiB
Stream size                              : 2.36 GiB
Stream size                              : 2.357 GiB
Stream size                              : 2.36 GiB (98%)
Proportion of this stream                : 0.98199
Language                                 : en
Language                                 : English
Language                                 : English
Language                                 : en
Language                                 : eng
Language                                 : en
Default                                  : No
Default                                  : No
Forced                                   : No
Forced                                   : No
Buffer size                              : 1222656
Original source medium                   : Blu-ray
intra_dc_precision                       : 10

Since it's file from MakeMKV, Hybrid interprets it as:
video_fps: 29.97
video_interlace: telecine (soft)
The Vapoursynth script looks fine to me:
# Imports
import vapoursynth as vs
# getting Vapoursynth core
import sys
import os
core = vs.core
# Import scripts folder
scriptPath = 'C:/Program Files/Hybrid/64bit/vsscripts'
sys.path.insert(0, os.path.abspath(scriptPath))
# loading plugins
core.std.LoadPlugin(path="C:/Program Files/Hybrid/64bit/vsfilters/SourceFilter/DGDecNV/DGDecodeNV.dll")
# Import scripts
import validate
# Source: 'G:\RIPS\test\Monty Python And The Holy Grail_t03.mkv'
# Current color space: YUV420P8, bit depth: 8, resolution: 1920x1080, frame rate: 29.97fps, scanorder: telecine (soft), yuv luminance scale: limited, matrix: 709, format: mpeg-2
# Loading G:\RIPS\test\Monty Python And The Holy Grail_t03.mkv using DGSource
# using 'softpulldown' through DGDecNV
clip = core.dgdecodenv.DGSource("F:/Hybrid Temp/SCRIPTID_:_.dgi",fieldop=1)# 23.976 fps, scanorder: progressive
# Making sure content is preceived as frame based
frame = clip.get_frame(0)
# setting color matrix to 709.
clip = core.std.SetFrameProps(clip, _Matrix=vs.MATRIX_BT709)
# setting color transfer (vs.TRANSFER_BT709), if it is not set.
if validate.transferIsInvalid(clip):
  clip = core.std.SetFrameProps(clip=clip, _Transfer=vs.TRANSFER_BT709)
# setting color primaries info (to vs.PRIMARIES_BT709), if it is not set.
if validate.primariesIsInvalid(clip):
  clip = core.std.SetFrameProps(clip=clip, _Primaries=vs.PRIMARIES_BT709)
# setting color range to TV (limited) range.
clip = core.std.SetFrameProps(clip=clip, _ColorRange=vs.RANGE_LIMITED)
# making sure frame rate is set to 23.976fps
clip = core.std.AssumeFPS(clip=clip, fpsnum=24000, fpsden=1001)
# making sure the detected scan type is set (detected: progressive)
clip = core.std.SetFrameProps(clip=clip, _FieldBased=vs.FIELD_PROGRESSIVE) # progressive
# set output frame rate to 23.976fps (progressive)
clip = core.std.AssumeFPS(clip=clip, fpsnum=24000, fpsden=1001)
# output
clip.set_output()
Since DGDecNV was used even if MakeMKV did change something and the source isn't soft telecine, but progressive, DGDecNV should output 23.976 fps progressive.

According to x264 21812 frames wre encoded which @23.976 would match a length of ~ 15min 9sec which is shorter than the length reported by MediaInfo (18 min 57 s).

=> would need the source to look further into it.
Assuming there is something wrong with the flags or MakeMKV did change something in their packaging, does the preview show combing if you overwrite the scantype to 'progressive' ?

Cu Selur


RE: Unexpected Speed or FPS - PizzaTime - 24.04.2025

(23.04.2025, 16:06)Selur Wrote: Assuming there is something wrong with the flags or MakeMKV did change something in their packaging, does the preview show combing if you overwrite the scantype to 'progressive' ?

Cu Selur

No. There is no combing. But it does play back fast just like before (fast video, but same audio playback speed). Here is a debug if that helps. I can try and cut down a sample too.

Here is a sample. It's the first 1:15 of the video.  https://www.dropbox.com/scl/fi/5o2vh0koeszesl5ne927b/test-001.mkv?rlkey=tlgp7cnkjwzdmigu3kux2en6f&st=88ny8te6&dl=0


RE: Unexpected Speed or FPS - Selur - 24.04.2025

Can you reproduce the problem with your sample? I can't. (That sample gets detected as 23.976 fps, all frames seem to be there and playback of a reencoded file seems fine)
Did you try different source filters?

Cu Selur


RE: Unexpected Speed or FPS - PizzaTime - 25.04.2025

(Yesterday, 05:25)Selur Wrote: Can you reproduce the problem with your sample? I can't. (That sample gets detected as 23.976 fps, all frames seem to be there and playback of a reencoded file seems fine)
Did you try different source filters?

Cu Selur

Oh weird. I just tried to duplicate the issue with the sample and I wasn't able to. It came out just fine. I will try to cut a larger sample and see if I can reproduce the issue with that.

Update: It's possible the issue must have been with MakeMKV or something because I keep using MKVToolNix to trim the file before I use hybrid to re-encode, and I cannot reproduce the issue from a file that was cut from MKVToolNix. So, my workaround was to trim off the last second of the video, keep the remainder, and re-encode with Hybrid; and it worked out just fine!


RE: Unexpected Speed or FPS - Selur - 25.04.2025

Remuxing with mkvtoolnix without cutting probably is fine too.