PDA

View Full Version : Resizing of interlaced meterial


speedyrazor
29th January 2016, 16:08
Hi, what is the correct method for resizing interlaced material please.
I am currently resizing using the below script, which works well for progressive material, but I would like to retain the interlacing.

Here's what I currently have for progressive stuff:

import vapoursynth as vs
core = vs.get_core(threads=4)
ret = core.lsmas.LibavSMASHSource(source=r"Movie.mov")
ret = core.fmtc.resample (clip=ret, w=720, h=576, css="444", kernel="spline36")
ret = core.fmtc.matrix (clip=ret, mats="709", matd="601")
ret = core.fmtc.resample (clip=ret, css="422")
ret = core.fmtc.bitdepth (clip=ret, bits=10)
ret.set_output()

feisty2
29th January 2016, 16:19
convolution (resizing) simply won't work on interlaced crap, resize after deinterlacing

say you just wanna do the resizing anyways, then
1. resize frame based -> nasty blending
2. resize field based (separate fields -> resize -> weave) -> field phase shift
both end up with nasty artifacts

Tormaid
29th January 2016, 16:21
Quick answer is you shouldn't. Think about it: your source has one field per vertical line of resolution. If you resize it, you'll get something like one field per 1.5 lines, which is completely non-standard, and when you deinterlace on playback you'll have what's called cross-conversion: your video will be very soft, defeating the purpose of upscaling it. You should always deinterlace before scaling, and I suppose if you need an interlaced output, convert back to that after you've preformed your resize operation. Use needi3 for the highest-quality deinterlacing.

Sent from my SM-G920V using Tapatalk

speedyrazor
29th January 2016, 17:57
So If I 'have' to end up with interlaced material, I have to de-interlace, resize, then re-interlace?
How would I re-interlace?

jackoneill
29th January 2016, 18:51
fmtc.resample claims to handle the shifting if you give it the output of SeparateFields. See the fmtconv documentation.

speedyrazor
30th January 2016, 08:07
The fmtc documentation states:

The function can resize interlaced content, but only if presented as separated, interleaved fields. It uses the _Field and _FieldBased frame properties to detect interlaced content and field parity, maintaining the correct chroma and luma relative positions. If this automatic detection is not desired, you can specify manually the interlaced and tff parameters. Simple intra-field deinterlacing (“bob”) can be achieved this way, by specifying scalev=2.

But using the below script produces a progressive output:

import vapoursynth as vs
core = vs.get_core(threads=4)
c = core.lsmas.LibavSMASHSource(source=r"Interlaced_Test.mov")
c = core.std.Trim(c, 500, 550)
c = core.std.SeparateFields (clip=c, tff=True)
c = core.fmtc.resample (clip=c, w=720, h=576, css="420", scalev=2)
c.set_output()

speedyrazor
30th January 2016, 16:21
import vapoursynth as vs
core = vs.get_core(threads=4)
ret = core.lsmas.LibavSMASHSource(source=r"Movie.mov")
ret = core.std.SeparateFields(clip=ret, tff=True)
ret = core.fmtc.resample(clip=ret, w=720, h=288, css="444", kernel="spline36", interlaced=1)
ret = core.fmtc.matrix(clip=ret, mats="709", matd="601")
ret = core.fmtc.resample(clip=ret, css="422", interlaced=1)
ret = core.fmtc.bitdepth(clip=ret, bits=10)
ret = core.std.DoubleWeave(clip=ret, tff=True)[::2]
ret.set_output()


Just tested this and works well, thanks for your time.

Kind regards.