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()
.denoise()
.basic()
.source_match()
.lossless()
.sharpen()
.back_blend()
.sharpen_limit()
.final()
.motion_blur()
.process()
)
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. will capture more source detail and reduce oversharpening / haloing.
Methods:
-
apply_back_blend
– -
apply_basic
– -
apply_denoise
– -
apply_final
– -
apply_lossless
– -
apply_motion_blur
– -
apply_noise_restore
– -
apply_prefilter
– -
apply_sharpen
– -
apply_sharpen_limit
– -
apply_source_match
– -
back_blend
–Configure parameters for the back_blend stage.
-
basic
–Configure parameters for the basic stage.
-
binomial_degrain
– -
denoise
–Configure parameters for the denoise stage.
-
final
–Configure parameters for the final stage.
-
lossless
–Configure parameter for the lossless stage.
-
mask_shimmer
–Compare processed clip with reference clip,
-
motion_blur
–Configure parameters for the motion blur stage.
-
prefilter
–Configure parameters for the prefilter stage.
-
process
–Start the deinterlacing process.
-
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.
-
draft
(ConstantFormatVideoNode
) –Draft processed clip, used as a base for prefiltering & denoising.
-
field
– -
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
217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 |
|
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.
apply_back_blend ¶
apply_back_blend(flt: VideoNode, src: VideoNode) -> ConstantFormatVideoNode
Source code
843 844 845 846 847 848 849 |
|
apply_basic ¶
apply_basic() -> None
Source code
705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 |
|
apply_denoise ¶
apply_denoise() -> None
Source code
646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 |
|
apply_final ¶
apply_final() -> None
Source code
877 878 879 880 881 882 883 884 885 886 887 888 889 |
|
apply_lossless ¶
apply_lossless(flt: VideoNode) -> ConstantFormatVideoNode
Source code
787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 |
|
apply_motion_blur ¶
apply_motion_blur() -> None
Source code
891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 |
|
apply_noise_restore ¶
apply_noise_restore(
clip: VideoNode, restore: float = 0.0
) -> ConstantFormatVideoNode
Source code
869 870 871 872 873 874 875 |
|
apply_prefilter ¶
apply_prefilter() -> None
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 636 637 638 639 640 641 642 643 644 |
|
apply_sharpen ¶
apply_sharpen(clip: VideoNode) -> ConstantFormatVideoNode
Source code
808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 |
|
apply_sharpen_limit ¶
apply_sharpen_limit(clip: VideoNode) -> ConstantFormatVideoNode
Source code
851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 |
|
apply_source_match ¶
apply_source_match(clip: VideoNode) -> ConstantFormatVideoNode
Source code
743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 |
|
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
416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 |
|
basic ¶
basic(
*,
tr: int = 2,
thsad: int | tuple[int, int] = 640,
bobber: Interpolater = Nnedi3(nsize=1, nns=4, qual=2, pscrn=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
¶Interpolater
, default:Nnedi3(nsize=1, nns=4, qual=2, pscrn=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 binomial_degrain.
-
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 mask_shimmer.
Source code
307 308 309 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 |
|
binomial_degrain ¶
binomial_degrain(clip: VideoNode, tr: int) -> ConstantFormatVideoNode
Source code
572 573 574 575 576 577 578 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 |
|
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
274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 |
|
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
) –Arguments passed to mask_shimmer.
Source code
462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 |
|
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
371 372 373 374 375 376 377 378 379 380 381 382 383 384 |
|
mask_shimmer ¶
mask_shimmer(
flt: VideoNode,
src: VideoNode,
threshold: int | float = 1,
erosion_distance: int = 4,
over_dilation: int = 0,
) -> ConstantFormatVideoNode
Compare processed clip with reference clip, only allow thin, horizontal areas of difference, i.e. bob shimmer fixes.
Parameters:
-
flt
¶VideoNode
) –Processed clip to perform masking on.
-
src
¶VideoNode
) –Unprocessed clip to restore from.
-
threshold
¶int | float
, default:1
) –Threshold of change to perform masking.
-
erosion_distance
¶int
, default:4
) –How much to deflate then reflate to remove thin areas.
-
over_dilation
¶int
, default:0
) –Extra inflation to ensure areas to restore back are fully caught.
Source code
513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 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 559 560 561 562 563 564 565 566 567 568 569 570 |
|
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
489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 |
|
prefilter ¶
prefilter(
*,
tr: int = 2,
sc_threshold: float | None | Literal[False] = None,
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 | None | Literal[False]
, default:None
) –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
) –Arguments passed to mask_shimmer.
Source code
241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 |
|
process ¶
process(
*,
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)
) -> ConstantFormatVideoNode
Start the deinterlacing process.
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.
Returns:
-
ConstantFormatVideoNode
–Deinterlaced clip.
Source code
914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 |
|
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
386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 |
|
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
434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 |
|
source_match ¶
source_match(
*,
tr: int = 1,
bobber: Interpolater | 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
¶Interpolater | 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 binomial_degrain.
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 |
|