View Full Version : Resizing 1080i High Motion Content
smokeslikeapoet
14th August 2006, 23:50
I want to transfer a 1080i Broadcast to DVD. This is a high motion auto race. I don't want to loose any motion by dropping the frame rate to 23.97. The source is interlaced, of course, so I was thinking this would be the way to go. Should I separatefields before I resize interlaced video? Would seperating the fields reduce the artifacting that can occur during resizing? Can I, or should I deinterlace to get 29.97 progressive video to put on the DVD?
#begin avs script
Mpeg2Source("k:\capture\brickyard-400\brickyard-400.d2v")
SeparateFields()
Spline36Resize(720,480)
Weave()
#eof
JMP
15th August 2006, 00:01
Yes, the only sensible way to resize interlaced material (keeping the interlace) is to separate fields, resize them separately to 1/2 target height and weave back. Therefore your resize should be (720,240).
Boulder
15th August 2006, 00:24
You get spatial misalignment if you separate the fields, resize and weave. You should use a smart bobber (TDeint(mode=1), SecureDeint or MVBob should do fine), then resize and reinterlace.
smokeslikeapoet
15th August 2006, 03:56
Sorry, Boulder, could you clarify what you mean by reinterlace. If my script looks like this what function do I use to reinterlace it:
video=Mpeg2Source("K:\Capture\brickyard\Brickyard_Fixed_cut.d2v")
audio=NicAC3Source("K:\Capture\brickyard\Brickyard_Fixed_cut.ac3")
AudioDub(video,audio)
TDeint(mode=1)
Spline36Resize(720,240)
Note video input framerate was 29.97 it is now doubled to 59.94 fps.
smokeslikeapoet
15th August 2006, 04:08
Ok I think I've got it.
video=Mpeg2Source("K:\Capture\brickyard\Brickyard_Fixed_cut.d2v")
audio=NicAC3Source("K:\Capture\brickyard\Brickyard_Fixed_cut.ac3")
AudioDub(video,audio)
TDeint(mode=1)
Spline36Resize(720,240)
AssumeFieldBased().Weave()
edit: Oops, that's wrong too because that's only half-height resolution...
Pookie
15th August 2006, 04:27
What about-
SeparateFields().SelectEven() #This gives you 1920x540 frames
BicubicResize(720,480)
29.97 fps, no mo interlace.
Trixter
15th August 2006, 04:35
You get spatial misalignment if you separate the fields, resize and weave. You should use a smart bobber (TDeint(mode=1), SecureDeint or MVBob should do fine), then resize and reinterlace.
That doesn't sound right at all. Can you clarify what you mean by "spatial misalighment"?
Mug Funky
15th August 2006, 05:19
the half pixel difference between fields gets greatly exaggerated on resizing.
what's needed is a motion-adaptive deinterlace (no need for MVbob resizing something so big to something so small... leakkernelbob will do it faster and you'll probalby not notice a difference).
to re-interlace:
...59.94i source...
assumetff().separatefields().selectevery(4,0,3).weave()
make sure to encode as top-field first, because that'll return top field first video..
smokeslikeapoet
15th August 2006, 06:10
Do I need TTF? I'm working toward an NTSC DVD which I though was BFF. I figured out that reinterlacing with selectevery through a search. I tried TDeint(mode=1), and was getting 0.5 fps with Quenc. I need to try some other deinterlacers.
I can't use LeakKernelBob() because there are dropped frames throughout the video and LeakKernelBob() requires defining the field order. The field order looks as though it swaps throughout the video.
foxyshadis
15th August 2006, 08:03
I thought simpleresize's interlaced resize took the spatial alignment into account...
smokeslikeapoet
15th August 2006, 08:27
From the READMEThese have the same paramaters as before but are designed to operate on interlaced source,
without either blending even/odd data or messing up the coordinates because of the
even/odd line offsets. Theoretically these can lose a small amount of vertical detail
or confuse a subsequent deinterlace or IVTC function but so far in my own testing I have
not found it to be a problem.
So if you intend to keep your video in interlaced form, certainly use these. And if
you are downsizing you may find that doing the InterlacedResize first before a more
costly deinterlacing step can give you a small performance advantage on other material.
But this is still experimental. YMMV.
The question is, would I need to do the resizing inside SeperateFields and Weave? Or could I skip that step?
Boulder
15th August 2006, 08:37
InterlacedResize doesn't need the SeparateFields-Weave combo. You should test it against SeparateFields()-anyresize-Weave() to see if it avoids the spatial misalignment. It should be quite visible because the difference between the source and destination resolution is so big.
smokeslikeapoet
15th August 2006, 09:28
Well SimpleResize is pretty darn fast, so I don't think I could ask for much better, one downside is that InterlacedResize doesn't take YV12 video and Quenc doesn't take YUY2 video so my script is doing 3 colorspace conversions. I'm encoding a 2'38" clip now to see how it works. It played at about half speed in Vdub so it should be a lot faster than the other deinterlacers that didn't even want to seek in Vdub.
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\SimpleResize.dll")
video=Mpeg2Source("K:\Capture\brickyard\Brickyard_Fixed_cut.d2v")
audio=NicAC3Source("K:\Capture\brickyard\Brickyard_Fixed_cut.ac3")
AudioDub(video,audio)
trim(37470,42191)
AssumeFieldBased().AssumeBFF()
# Source is BT709 HD Video, there is no agrument "interlaced"
BT709ToBT601()
# Interlaced Resize only supports YUY2
ConvertToYuY2(interlaced=true)
InterlacedResize(720,480)
# YV12 Necessary for Quenc
ConvertToYV12(interlaced=true)
smokeslikeapoet
15th August 2006, 15:56
Well I ran that 2'38" clip through Quenc and I had the bitrate set way to low for this amount of motion. So I ran it back through virtualdub compressed with huffyuv and desided it's just no good. So much noise and artifacts, I'll post a sample later. I ran the same clip again, deinterlacing with Tdeint() first then resizing and reinterlacing. It was incredibly slow for huffyuv, it would take days with huffyuv. The video was a lot better, but I used SimpleResize(w,h) for speed. I'm going to try again with Spline36Resize(720,480) and see if it will get better. I'm also going to take a look at SmoothDeinterlace() and SecureDeint().
If someone can point me to how to write a script that compares different methods side by side by stacking the video.. I can't seem to find it.
(edit)
@Pookie don't I loose motion by selecting only even fields? Or am I being stupid? I think I'm being stupid. ATSC 1080i is 30/(1000/1001)FPS, Thats 60/(1000/1001) half frames a second. There is no motion between the half frames? Would resizing be as accurate dealing with only half the horizontal resolution?
JMP
15th August 2006, 16:57
If someone can point me to how to write a script that compares different methods side by side by stacking the video.. I can't seem to find it.
Nothing simpler than that...
video=...source(...)
video1=filter1(video).filter2().filter3()...
video2=filter4(video).filter5().filter6()...
Stackhorizontal(video1,video2)
The last line can also be Stackvertical(video1,video2), or (I often use that) Interleave(video1,video2). The last one produces a clip that has alternately a frame from video1 and then the same frame from video2. Loading this into virtualdub and quickly moving forward/backward frame makes the differences "blink" nicely :)
(edit) A simpler method for a side-by-side comparison is of course firing up two instances of VirtualDub :)
Inc
15th August 2006, 16:57
Since 1920x1080i PAR1:1 gots a DAR of 1.78:1 a resizing to 720x480 makes it 1.5:1 if not encoding using a 16:9 flag.
So anamorph 640x480 = 1.778*0,75:1, means Resize 1920x1080 to 702x480 and add on each width side 9px to finally get 720x480, finally do encode as 16:9 mpeg2.
smokeslikeapoet
15th August 2006, 17:39
Thanks JMP and INC, I'll change my resize resolution and add the bars.
I just came across this nifty filter by TRBARRY, YV12InterlacedReduceBy2() (http://mywebpages.comcast.net/trbarry/Readme_YV12InterlacedReduceBy2.txt) I'm also going to try it out.
trbarry
15th August 2006, 18:40
Smokes -
YV12InterlacedReduceBy2() should reduce it to 960x544p @ 30 fps. In the newer versions of the same filter there is (IIRC) a YV12InterlacedReduceBy2At60() function to give you all 60 fps if you prefer that.
- Tom
smokeslikeapoet
16th August 2006, 14:38
I'm trying some different methods and I'm getting something all wrong. Look at the image below and you can tell the scripts above are half the actual framerate of the clips below.
(http://imageshack.us)
Here's the script:
video=Mpeg2Source("K:\Capture\brickyard\Brickyard_Fixed_cut.d2v").trim(38147,39101).BT709ToBT601()
video0=AssumeFrameBased(video).separatefields().LanczosResize(704,240).weave().Subtitle("SeparateField.Resize.Weave",align=9).info()
video1=AssumeFrameBased(video).ConvertToYuY2(interlaced=true).InterlacedResize(704,480).ConvertToYV12(interlaced=true).Subtitle("InterlacedResize",align=9).info()
video2=AssumeFrameBased(video).YV12InterlacedReduceBy2().LanczosResize(704,480).AssumeFrameBased().assumebff().separatefields().selectevery(4,0,3).weave().Subtitle("YV12InterlacedReduceBy2.Resize",align=9).info()
video3=AssumeFrameBased(video).TDeint().LanczosResize(704,480).AssumeBFF().separatefields().selectevery(4,0,3).weave().Subtitle("Tdeint.Resize",align=9).info()
StackVertical(StackHorizontal(video0, video1),StackHorizontal(video2, video3))
[IMG]http://img214.imageshack.us/img214/4777/brickyardtesttb9.th.jpg (http://img214.imageshack.us/my.php?image=brickyardtesttb9.jpg)
Boulder
16th August 2006, 14:43
Your video2 and video3 lines are messed up.
video2 doesn't need reinterlacing and in video3 you deinterlace with TDeint and this is followed by reinterlacing. In video3 you must use mode=1 in TDeint. Also in video2 you first reduce the image size to half and then use LanczosResize - why?
smokeslikeapoet
16th August 2006, 15:13
I don't know what I was thinking. I should have been using YV12InterlacedReduceby2at60(0) in the video2, separating fields before resizing to the final resolution and reinterlacing.
video=Mpeg2Source("K:\Capture\brickyard\Brickyard_Fixed_cut.d2v").trim(38147,39101).BT709ToBT601()
video0=AssumeFrameBased(video).separatefields().LanczosResize(704,240).weave().Subtitle("SeparateField.Resize.Weave",align=9).info()
video1=AssumeFrameBased(video).ConvertToYuY2(interlaced=true).InterlacedResize(704,480).ConvertToYV12(interlaced=true).Subtitle("InterlacedResize",align=9).info()
video2=AssumeFrameBased(video).YV12InterlacedReduceBy2At60(0).AssumeFrameBased().assumebff().separatefields().LanczosResize(704,240).selectevery(4,0,3).weave().Subtitle("YV12InterlacedReduceBy2.Resize",align=9).info()
video3=AssumeFrameBased(video).TDeint(mode=1).LanczosResize(704,480).AssumeBFF().separatefields().selectevery(4,0,3).weave().Subtitle("Tdeint.Resize",align=9).info()
StackVertical(StackHorizontal(video0, video1),StackHorizontal(video2, video3))
http://img209.imageshack.us/img209/2152/brickyardtestsb7.th.jpg (http://img209.imageshack.us/my.php?image=brickyardtestsb7.jpg)
Boulder
16th August 2006, 15:20
I don't think it's a good idea to resize twice, better go directly to the desired resolution. If you want to use the SeparateFields()-resize-Weave() way and avoid the spatial misalignment, see this post : http://forum.doom9.org/showthread.php?p=852845#post852845
smokeslikeapoet
16th August 2006, 16:18
Awesome, I'll check it out when I get home tonight.
scharfis_brain
16th August 2006, 20:34
For interlaced resizing the only method I recommend is
Horizontalresizing()
Bobbing()
Converttoyuy2()
VerticalResizing()
Reinterlacing()
Preferrably an motion adaptive deinterlacer with ELA or EDI interpolation like TDeint(mode=1) or SecureDeint().
So a correct 1080i to 480i should look like this:
mpeg2source("video1080i.d2v")
(last.height == 1088) ? last.crop(0,0,0,-8) : last
Bicubicresize(704, last.height)
SecureDeint()
Converttoyuy2()
Bicubicresize(last.width, 480)
Separatefields().Selectevery(4,0,3).Weave()
smokeslikeapoet
17th August 2006, 14:43
Ok here's the test script and a test file, four clips stacked 4 x 4, in one avi. If you have minute, take a look and let me know what you think. There's still two other methods I'm going to try, suggestions by Boulder and Scharfis_brain. I encoded the video with xvid at a 2 constant quality for size purposes.
https://umdrive.memphis.edu/wpearson/www/video/Brickyard-test.avi
video=Mpeg2Source("K:\Capture\brickyard\Brickyard_Fixed_cut.d2v").trim(38147,39101).BT709ToBT601()
video0=AssumeFrameBased(video).separatefields().LanczosResize(704,240).AssumeFieldBased().weave().Subtitle("SeparateField.Resize.Weave",align=9).info()
video1=AssumeFrameBased(video).ConvertToYuY2(interlaced=true).InterlacedResize(704,480).ConvertToYV12(interlaced=true).Subtitle("InterlacedResize",align=9).info()
video2=AssumeFrameBased(video).YV12InterlacedReduceBy2At60(0).AssumeFrameBased().assumebff().separatefields().LanczosResize(704,240).selectevery(4,0,3).weave().Subtitle("YV12InterlacedReduceBy2.Resize",align=9).info()
video3=AssumeFrameBased(video).TDeint(mode=1).LanczosResize(704,480).AssumeBFF().separatefields().selectevery(4,0,3).weave().Subtitle("Tdeint.Resize",align=9).info()
StackVertical(StackHorizontal(video0, video1),StackHorizontal(video2, video3))
trbarry
20th August 2006, 13:51
I was more thinking of something like the following, though I haven't tried it in this case.
- Tom
video2=YV12InterlacedReduceBy2At60(0).LanczosResize(704,480).AssumeFrameBased().assumebff().separatefields().selectevery(4,0,3).weave()
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.