View Full Version : vsfieldkit: functions for working with interlaced content
JustinTArthur
17th April 2022, 09:33
Been processing old home VHSes and DVDs lately and needed some things I hadn't seen in the VapourSynth community yet.
Documentation (http://vsfieldkit.justinarthur.com/) | Source Code (https://github.com/JustinTArthur/vsfieldkit)
Some notable functions:
vsfieldkit.group_by_combed
vsfieldkit.group_by_field_order
vsfieldkit.resample_as_progressive
vsfieldkit.scan_interlaced
JustinTArthur
17th April 2022, 09:45
scan_interlaced is where I've spent most of my time. It's a frame doubler that draws interlaced fields like an interlaced scan display would, with optional phosphor decay simulation. It was inspired by Juha Jeronen's Phosphor deinterlacer for VLC media player.
https://jta-code.s3.amazonaws.com/vsfieldkit/examples/storage_vs_display-10hz-wide-90.webp
Slowed from 59.94 to 10 fps. See how much smoother the right-side looks.
scan_interlaced reference (http://vsfieldkit.justinarthur.com/en/latest/usage.html#vsfieldkit.scan_interlaced) and deep dive (http://vsfieldkit.justinarthur.com/en/latest/scan_interlaced_deep_dive.html) from the docs.
mikewando
1st May 2022, 07:27
Wow scan_interlaced looks super cool! I really like the deep dive too, both content and format. I've been considering writing some words about ways of handling telecined content and may take some inspiration.
I've been using FrameEval for the example situation presented for vsfieldkit.group_by_combed. I imagine it's about the same performance either way, but maybe worth testing/noting if one way has advantages over the other.
def filter_combed_only(n, f, filter, no_filter):
return filter if f.props['_Combed'] == 1 else no_filter
no_filter = ...
filter = ...
clip = no_filter.std.FrameEval(functools.partial(filter_combed_only, filter=filter, no_filter=no_filter), prop_src=no_filter)
JustinTArthur
1st May 2022, 08:31
Wow scan_interlaced looks super cool! I really like the deep dive too, both content and format.
Thanks for taking a look!
I've been using FrameEval for the example situation presented for vsfieldkit.group_by_combed.
What you're doing with FrameEval is in many ways better than group_by_combed. I'd recommend keeping it for your use-case. FrameEval is better here because it works in line with VapourSynth's way of doing things: stacking filters behind the scenes in a non-blocking way until frames are requested, e.g. by vspipe.
vsfieldkit.group_by_combed requests frames itself, forcing your filter stack to process content from the source all the way through your filters so far, blocking until it gets those frames. This makes for an elegant programming experience given there are no callbacks involved, but it's rarely faster.
All that said, here are some things it is good for:
Cutting and splicing. FrameEval doesn't have much for cutting or pulling out contiguous sub-clips of frames.
Introducing new frames. If field matching failed because a segment contains native 60i and you actually want to splice in bob-doubled frames from that into your otherwise de-telecined frames, you can do that with group_by_combed.
Writing a Python script for outputting analysis instead of frames.
I should definitely point more to FrameEval and ModifyFrames in the docs for those funcs and explain the use-cases a bit.
vBulletin® v3.8.11, Copyright ©2000-2025, vBulletin Solutions Inc.