qtgmc ¶
Classes:
-
QTempGaussMC
–Quasi Temporal Gaussian Motion Compensated (QTGMC)
QTempGaussMC ¶
QTempGaussMC(
clip: VideoNode,
input_type: InputType = INTERLACE,
tff: FieldBasedT | bool | None = None,
)
Bases: vs_object
Quasi Temporal Gaussian Motion Compensated (QTGMC)
A very high quality deinterlacer with a range of features for both quality and convenience. These include extensive noise processing capabilities, support for repair of progressive material, precision source matching, shutter speed simulation, etc.
Originally based on TempGaussMC by Didée.
Basic usage
deinterlace = (
QTempGaussMC(clip)
.prefilter()
.analyze()
.denoise()
.basic()
.source_match()
.lossless()
.sharpen()
.back_blend()
.sharpen_limit()
.final()
.motion_blur()
.deinterlace()
)
Parameters:
-
clip
¶VideoNode
) –Clip to process.
-
input_type
¶InputType
, default:INTERLACE
) –Indicates processing routine.
-
tff
¶FieldBasedT | bool | None
, default:None
) –Field order of the clip.
Classes:
-
BackBlendMode
–When to back blend (blurred) difference between pre & post sharpened clip.
-
InputType
–Processing routine to use for the input.
-
LosslessMode
–When to put exact source fields into result & clean any artefacts.
-
NoiseDeintMode
–When noise is taken from interlaced source, how to 'deinterlace' it before restoring.
-
NoiseProcessMode
–How to handle processing noise in the source.
-
SearchPostProcess
–Prefiltering to apply in order to assist with motion search.
-
SharpLimitMode
–How to limit and when to apply re-sharpening of the clip.
-
SharpMode
–How to re-sharpen the clip after temporally blurring.
-
SourceMatchMode
–Creates higher fidelity output with extra processing.
Methods:
-
analyze
–Configure parameters for the motion analysis stage.
-
back_blend
–Configure parameters for the back_blend stage.
-
basic
–Configure parameters for the basic stage.
-
deinterlace
–Start the deinterlacing process.
-
denoise
–Configure parameters for the denoise stage.
-
final
–Configure parameters for the final stage.
-
lossless
–Configure parameter for the lossless stage.
-
motion_blur
–Configure parameters for the motion blur stage.
-
prefilter
–Configure parameters for the prefilter stage.
-
sharpen
–Configure parameters for the sharpen stage.
-
sharpen_limit
–Configure parameters for the sharpen_limit stage.
-
source_match
–Configure parameters for the source_match stage.
Attributes:
-
basic_output
(ConstantFormatVideoNode
) –Output of the basic stage.
-
bobbed
(ConstantFormatVideoNode
) –High quality bobbed clip, initial spatial interpolation.
-
clip
(ConstantFormatVideoNode
) –Clip to process.
-
denoise_output
(ConstantFormatVideoNode
) –Output of the denoise stage.
-
double_rate
– -
draft
(ConstantFormatVideoNode
) –Draft processed clip, used as a base for prefiltering & denoising.
-
final_output
(ConstantFormatVideoNode
) –Output of the final stage.
-
input_type
– -
motion_blur_output
(ConstantFormatVideoNode
) –Output of the motion blur stage.
-
noise
(ConstantFormatVideoNode
) –Extracted noise when noise processing is enabled.
-
prefilter_output
(ConstantFormatVideoNode
) –Output of the prefilter stage.
-
tff
–
Source code
310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 |
|
bobbed instance-attribute
¶
bobbed: ConstantFormatVideoNode
High quality bobbed clip, initial spatial interpolation.
denoise_output instance-attribute
¶
denoise_output: ConstantFormatVideoNode
Output of the denoise stage.
draft instance-attribute
¶
draft: ConstantFormatVideoNode
Draft processed clip, used as a base for prefiltering & denoising.
motion_blur_output instance-attribute
¶
motion_blur_output: ConstantFormatVideoNode
Output of the motion blur stage.
noise instance-attribute
¶
noise: ConstantFormatVideoNode
Extracted noise when noise processing is enabled.
prefilter_output instance-attribute
¶
prefilter_output: ConstantFormatVideoNode
Output of the prefilter stage.
BackBlendMode ¶
Bases: CustomIntEnum
When to back blend (blurred) difference between pre & post sharpened clip.
Attributes:
-
BOTH
–Perform back-blending both before and after sharpness limiting.
-
NONE
–No back-blending.
-
POSTLIMIT
–Perform back-blending after sharpness limiting.
-
PRELIMIT
–Perform back-blending prior to sharpness limiting.
BOTH class-attribute
instance-attribute
¶
BOTH = 3
Perform back-blending both before and after sharpness limiting.
POSTLIMIT class-attribute
instance-attribute
¶
POSTLIMIT = 2
Perform back-blending after sharpness limiting.
PRELIMIT class-attribute
instance-attribute
¶
PRELIMIT = 1
Perform back-blending prior to sharpness limiting.
InputType ¶
Bases: CustomIntEnum
Processing routine to use for the input.
Attributes:
-
INTERLACE
–Deinterlace interlaced input.
-
PROGRESSIVE
–Deshimmer general progressive material that contains less severe problems.
-
REPAIR
–Repair badly deinterlaced material with considerable horizontal artefacts.
LosslessMode ¶
Bases: CustomIntEnum
When to put exact source fields into result & clean any artefacts.
Attributes:
-
NONE
–Do not restore source fields.
-
POSTSMOOTH
–Restore source fields after final temporal smooth. True lossless but less stable.
-
PRESHARPEN
–Restore source fields prior to re-sharpening. Not exactly lossless.
NoiseDeintMode ¶
Bases: CustomIntEnum
When noise is taken from interlaced source, how to 'deinterlace' it before restoring.
Attributes:
NoiseProcessMode ¶
Bases: CustomIntEnum
How to handle processing noise in the source.
Attributes:
SearchPostProcess ¶
Bases: CustomIntEnum
Prefiltering to apply in order to assist with motion search.
Attributes:
-
GAUSSBLUR
–Gaussian blur.
-
GAUSSBLUR_EDGESOFTEN
–Gaussian blur & edge softening.
-
NONE
–No post-processing.
SharpLimitMode ¶
Bases: CustomIntEnum
How to limit and when to apply re-sharpening of the clip.
Attributes:
-
NONE
–No sharpness limiting.
-
SPATIAL_POSTSMOOTH
–Spatial sharpness limiting after the final stage.
-
SPATIAL_PRESMOOTH
–Spatial sharpness limiting prior to final stage.
-
TEMPORAL_POSTSMOOTH
–Temporal sharpness limiting after the final stage.
-
TEMPORAL_PRESMOOTH
–Temporal sharpness limiting prior to final stage.
SPATIAL_POSTSMOOTH class-attribute
instance-attribute
¶
SPATIAL_POSTSMOOTH = 3
Spatial sharpness limiting after the final stage.
SPATIAL_PRESMOOTH class-attribute
instance-attribute
¶
SPATIAL_PRESMOOTH = 1
Spatial sharpness limiting prior to final stage.
TEMPORAL_POSTSMOOTH class-attribute
instance-attribute
¶
TEMPORAL_POSTSMOOTH = 4
Temporal sharpness limiting after the final stage.
TEMPORAL_PRESMOOTH class-attribute
instance-attribute
¶
TEMPORAL_PRESMOOTH = 2
Temporal sharpness limiting prior to final stage.
SharpMode ¶
Bases: CustomIntEnum
How to re-sharpen the clip after temporally blurring.
Attributes:
-
NONE
–No re-sharpening.
-
UNSHARP
–Re-sharpening using unsharpening.
-
UNSHARP_MINMAX
–Re-sharpening using unsharpening clamped to the local 3x3 min/max average.
UNSHARP_MINMAX class-attribute
instance-attribute
¶
UNSHARP_MINMAX = 2
Re-sharpening using unsharpening clamped to the local 3x3 min/max average.
SourceMatchMode ¶
Bases: CustomIntEnum
Creates higher fidelity output with extra processing. Will capture more source detail and reduce oversharpening / haloing.
Attributes:
-
BASIC
–Conservative halfway stage that rarely introduces artefacts.
-
NONE
–No source match processing.
-
REFINED
–Restores almost exact source detail but is sensitive to noise & can introduce occasional aliasing.
-
TWICE_REFINED
–Restores almost exact source detail.
BASIC class-attribute
instance-attribute
¶
BASIC = 1
Conservative halfway stage that rarely introduces artefacts.
REFINED class-attribute
instance-attribute
¶
REFINED = 2
Restores almost exact source detail but is sensitive to noise & can introduce occasional aliasing.
TWICE_REFINED class-attribute
instance-attribute
¶
TWICE_REFINED = 3
Restores almost exact source detail.
analyze ¶
analyze(
*,
force_tr: int = 1,
preset: MVToolsPreset = HQ_SAD,
blksize: int | tuple[int, int] = 16,
refine: int = 1,
thsad_recalc: int | None = None,
thscd: int | tuple[int | None, int | float | None] | None = (180, 38.5)
) -> Self
Configure parameters for the motion analysis stage.
Parameters:
-
force_tr
¶int
, default:1
) –Always analyze motion to at least this, even if otherwise unnecessary.
-
preset
¶MVToolsPreset
, default:HQ_SAD
) –MVTools preset defining base values for the MVTools object.
-
blksize
¶int | tuple[int, int]
, default:16
) –Size of a block. Larger blocks are less sensitive to noise, are faster, but also less accurate.
-
refine
¶int
, default:1
) –Number of times to recalculate motion vectors with halved block size.
-
thsad_recalc
¶int | None
, default:None
) –Only bad quality new vectors with a SAD above this will be re-estimated by search. thsad value is scaled to 8x8 block size.
-
thscd
¶int | tuple[int | None, int | float | None] | None
, default:(180, 38.5)
) –Scene change detection thresholds: - First value: SAD threshold for considering a block changed between frames. - Second value: Percentage of changed blocks needed to trigger a scene change.
Source code
376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 |
|
back_blend ¶
back_blend(*, mode: BackBlendMode = BOTH, sigma: float = 1.4) -> Self
Configure parameters for the back_blend stage.
Parameters:
-
mode
¶BackBlendMode
, default:BOTH
) –Specifies at which stage to perform back-blending.
-
sigma
¶float
, default:1.4
) –Gaussian blur sigma.
Source code
560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 |
|
basic ¶
basic(
*,
tr: int = 2,
thsad: int | tuple[int, int] = 640,
bobber: Deinterlacer = NNEDI3(nsize=1),
noise_restore: float = 0.0,
degrain_args: KwargsT | None = None,
mask_args: KwargsT | None | Literal[False] = None,
mask_shimmer_args: KwargsT | None = KwargsT(erosion_distance=0)
) -> Self
Configure parameters for the basic stage.
Parameters:
-
tr
¶int
, default:2
) –Temporal radius of the motion compensated binomial smooth.
-
thsad
¶int | tuple[int, int]
, default:640
) –Thsad of the motion compensated binomial smooth.
-
bobber
¶Deinterlacer
, default:NNEDI3(nsize=1)
) –Bobber to use for initial spatial interpolation.
-
noise_restore
¶float
, default:0.0
) –How much noise to restore after this stage.
-
degrain_args
¶KwargsT | None
, default:None
) –Arguments passed to the binomial_degrain call.
-
mask_args
¶KwargsT | None | Literal[False]
, default:None
) –Arguments passed to MVTools.mask for InputType.REPAIR.
-
mask_shimmer_args
¶KwargsT | None
, default:KwargsT(erosion_distance=0)
) –Arguments passed to the mask_shimmer call.
Source code
447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 |
|
deinterlace ¶
deinterlace() -> ConstantFormatVideoNode
Start the deinterlacing process.
Returns:
-
ConstantFormatVideoNode
–Deinterlaced clip.
Source code
1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 |
|
denoise ¶
denoise(
*,
tr: int = 2,
func: _DenoiseFuncTr | VSFunctionKwArgs[VideoNode, VideoNode] = partial(
denoise, sigma=8
),
mode: NoiseProcessMode = IDENTIFY,
deint: NoiseDeintMode = GENERATE,
stabilize: tuple[float, float] | Literal[False] = (0.6, 0.2),
func_comp_args: KwargsT | None = None,
stabilize_comp_args: KwargsT | None = None
) -> Self
Configure parameters for the denoise stage.
Parameters:
-
tr
¶int
, default:2
) –Temporal radius of the denoising function & it's motion compensation.
-
func
¶_DenoiseFuncTr | VSFunctionKwArgs[VideoNode, VideoNode]
, default:partial(denoise, sigma=8)
) –Denoising function to use.
-
mode
¶NoiseProcessMode
, default:IDENTIFY
) –Noise handling method to use.
-
deint
¶NoiseDeintMode
, default:GENERATE
) –Noise deinterlacing method to use.
-
stabilize
¶tuple[float, float] | Literal[False]
, default:(0.6, 0.2)
) –Weights to use when blending source noise with compensated noise.
-
func_comp_args
¶KwargsT | None
, default:None
) –Arguments passed to MVTools.compensate for denoising.
-
stabilize_comp_args
¶KwargsT | None
, default:None
) –Arguments passed to MVTools.compensate for stabilization.
Source code
411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 |
|
final ¶
final(
*,
tr: int = 3,
thsad: int | tuple[int, int] = 256,
noise_restore: float = 0.0,
degrain_args: KwargsT | None = None,
mask_shimmer_args: KwargsT | None = None
) -> Self
Configure parameters for the final stage.
Parameters:
-
tr
¶int
, default:3
) –Temporal radius of the motion compensated smooth.
-
thsad
¶int | tuple[int, int]
, default:256
) –Thsad of the motion compensated smooth.
-
noise_restore
¶float
, default:0.0
) –How much noise to restore after this stage.
-
degrain_args
¶KwargsT | None
, default:None
) –Arguments passed to MVTools.degrain.
-
mask_shimmer_args
¶KwargsT | None
, default:None
) –mask_shimmer_args: Arguments passed to the mask_shimmer call.
Source code
609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 |
|
lossless ¶
lossless(*, mode: LosslessMode = NONE) -> Self
Configure parameter for the lossless stage.
Parameters:
-
mode
¶LosslessMode
, default:NONE
) –Specifies at which stage to re-weave the original fields.
Source code
513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 |
|
motion_blur ¶
motion_blur(
*,
shutter_angle: tuple[int | float, int | float] = (180, 180),
fps_divisor: int = 1,
blur_args: KwargsT | None = None,
mask_args: KwargsT | None | Literal[False] = KwargsT(ml=4)
) -> Self
Configure parameters for the motion blur stage.
Parameters:
-
shutter_angle
¶tuple[int | float, int | float]
, default:(180, 180)
) –Tuple containing the source and output shutter angle. Will apply motion blur if they do not match.
-
fps_divisor
¶int
, default:1
) –Factor by which to reduce framerate.
-
blur_args
¶KwargsT | None
, default:None
) –Arguments passed to MVTools.flow_blur.
-
mask_args
¶KwargsT | None | Literal[False]
, default:KwargsT(ml=4)
) –Arguments passed to MVTools.mask.
Source code
637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 |
|
prefilter ¶
prefilter(
*,
tr: int = 2,
sc_threshold: float | Literal[False] = 0.1,
postprocess: SearchPostProcess = GAUSSBLUR_EDGESOFTEN,
strength: tuple[float, float] = (1.9, 0.1),
limit: tuple[int | float, int | float, int | float] = (3, 7, 2),
range_expansion_args: KwargsT | None | Literal[False] = None,
mask_shimmer_args: KwargsT | None = None
) -> Self
Configure parameters for the prefilter stage.
Parameters:
-
tr
¶int
, default:2
) –Radius of the initial temporal binomial smooth.
-
sc_threshold
¶float | Literal[False]
, default:0.1
) –Threshold for scene changes, disables sc detection if False.
-
postprocess
¶SearchPostProcess
, default:GAUSSBLUR_EDGESOFTEN
) –Post-processing routine to use.
-
strength
¶tuple[float, float]
, default:(1.9, 0.1)
) –Tuple containing gaussian blur sigma & blend weight of the blur.
-
limit
¶tuple[int | float, int | float, int | float]
, default:(3, 7, 2)
) –3-step limiting thresholds for the gaussian blur post-processing.
-
range_expansion_args
¶KwargsT | None | Literal[False]
, default:None
) –Arguments passed to prefilter_to_full_range.
-
mask_shimmer_args
¶KwargsT | None
, default:None
) –mask_shimmer_args: Arguments passed to the mask_shimmer call.
Source code
341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 |
|
sharpen ¶
sharpen(
*,
mode: SharpMode | None = None,
strength: float = 1.0,
clamp: int | float | tuple[int | float, int | float] = 1,
thin: float = 0.0
) -> Self
Configure parameters for the sharpen stage.
Parameters:
-
mode
¶SharpMode | None
, default:None
) –Specifies the type of sharpening to use.
-
strength
¶float
, default:1.0
) –Sharpening strength.
-
clamp
¶int | float | tuple[int | float, int | float]
, default:1
) –Clamp the sharpening strength of SharpMode.UNSHARP_MINMAX to the min/max average plus/minus this.
-
thin
¶float
, default:0.0
) –How much to vertically thin edges.
Source code
529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 |
|
sharpen_limit ¶
sharpen_limit(
*,
mode: SharpLimitMode | None = None,
radius: int = 3,
clamp: int | float | tuple[int | float, int | float] = 0,
comp_args: KwargsT | None = None
) -> Self
Configure parameters for the sharpen_limit stage.
Parameters:
-
mode
¶SharpLimitMode | None
, default:None
) –Specifies type of limiting & at which stage to perform it.
-
radius
¶int
, default:3
) –Radius of sharpness limiting.
-
clamp
¶int | float | tuple[int | float, int | float]
, default:0
) –How much undershoot/overshoot to allow.
-
comp_args
¶KwargsT | None
, default:None
) –Arguments passed to MVTools.compensate for temporal limiting.
Source code
579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 |
|
source_match ¶
source_match(
*,
tr: int = 1,
bobber: Deinterlacer | None = None,
mode: SourceMatchMode = NONE,
similarity: float = 0.5,
enhance: float = 0.5,
degrain_args: KwargsT | None = None
) -> Self
Configure parameters for the source_match stage.
Parameters:
-
tr
¶int
, default:1
) –Temporal radius of the refinement motion compensated binomial smooth.
-
bobber
¶Deinterlacer | None
, default:None
) –Bobber to use for refined spatial interpolation.
-
mode
¶SourceMatchMode
, default:NONE
) –Specifies number of refinement steps to perform.
-
similarity
¶float
, default:0.5
) –Temporal similarity of the error created by smoothing.
-
enhance
¶float
, default:0.5
) –Sharpening strength prior to source match refinement.
-
degrain_args
¶KwargsT | None
, default:None
) –Arguments passed to the binomial_degrain call.
Source code
482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 |
|