View Full Version : 1080i to 480i: Speed-up script
dvwannab
12th April 2007, 03:14
All,
I recently did a 1080i file to 480i using this script:
LoadPlugin("C:\Program Files\avisynth 2.5\plugins\tdeint.dll")
mpeg2source("f:\1workfolder\working\disc1\game.d2v")
TDeint(mode=1,type=1)
converttoyuy2()
bicubicresize(704,480)
addborders(8,0,8,0)
assumetff()
separatefields().selectevery(4,0,3).weave()
It took 7 days to do a 2-hour file using CCE Basic 2.70. Is there another script or changes I can tweak in current script to speed up the encode process? If I can at least cut that encode time in half, I can live with that.
Thanks.
R3Z
12th April 2007, 04:10
I think whats making it take so long is that its being deinterlaced at the 1080 resolution.
You could simply use;
mpeg2source("f:\1workfolder\working\disc1\game.d2v")
ReduceBy2()
Lanczos4Resize(704,480) # Lanczos4 (Sharp)
addborders(8,0,8,0)
Edit: Just to explain, ReduceBy2 from my understanding will deinterlace interlaced material as a side effect, essentially cutting out a deinterlace step.
scharfis_brain
12th April 2007, 05:52
LoadCPlugin("yadif.dll")
mpeg2source("f:\1workfolder\working\disc1\game.d2v")
bicubicresize(704,height)
yadif(mode=1)
converttoyuy2()
bicubicresize(width,480)
addborders(8,0,8,0)
assumetff()
separatefields().selectevery(4,0,3).weave()
ChiDragon
12th April 2007, 10:01
Why not ConvertToYUY2 after the resize? Should be faster to resize in YV12 and faster to convert at lower res, no?
manono
12th April 2007, 13:12
It took 7 days to do a 2-hour file using CCE Basic 2.70.
Encode first to a lossless AVI, and then serve that into CCE. Depending on how many passes you usually run, the timesavings could be significant.
scharfis_brain
12th April 2007, 13:20
Why not ConvertToYUY2 after the resize? Should be faster to resize in YV12 and faster to convert at lower res, no?
Converting YV12 to YUY2 before vertical downsizing yields into much better detailed chroma. The speed gain by placing it after the downsize isn't that much...
dvwannab
12th April 2007, 19:22
It took 7 days to do a 2-hour file using CCE Basic 2.70.
Encode first to a lossless AVI, and then serve that into CCE. Depending on how many passes you usually run, the timesavings could be significant.
manono, I will definitely take into consideration as an option. I want to see how this Yadif works though.
LoadCPlugin("yadif.dll")
mpeg2source("f:\1workfolder\working\disc1\game.d2v")
bicubicresize(704,height)
yadif(mode=1)
converttoyuy2()
bicubicresize(width,480)
addborders(8,0,8,0)
assumetff()
separatefields().selectevery(4,0,3).weave()
Ok, Scarfis_brain, work with me here, as I am not God's greatest gift to the world of Avisynth. Yadif is new to me. Do I need a particular version of Avisynth? Do I copy and paste the dll in the system32 folder? What else do I need to know, MVTools latest, etc?
gzarkadas
12th April 2007, 19:40
...Yadif is new to me...What else do I need to know...
The Yadif thread is here (http://forum.doom9.org/showthread.php?t=124284).
dvwannab
12th April 2007, 20:12
thanks for the link gzarkadas. Didnt help much, as I have not a clue what they were talking about. Unfortunately, if you dont speak the language of the everyday scripter, these kinds of discussions goes totally over ones head.
I will do a quick test with yadif and if I get loading errors I will just have to use manono's suggestion above.
scharfis_brain
12th April 2007, 20:32
- copy yadif.dll into any folder you like to collect your avisynth plugins into. (I prefer C:\x\ cause it is fast to type ;) )
So I load yadif this way:
LoadCPlugin("c:\x\yadif.dll")
(Mind the C between Load and Plugin!)
if this is not successful you may try
Load_Stdcall_plugin("c:\x\yadif.dll")
dvwannab
12th April 2007, 20:45
Okay, now that I can understand :D Real simple. Many thanks.
dvwannab
13th April 2007, 06:05
It is working much faster than Tdeint. Thanks Scharfis. I only needed to update to avisynth 2.5.7 and everything worked fine. A 1hr 15min 1080i is about completed using a 2-pass CCE Basic encode after about 13 hours on a 2 GHz, P4, 512MB RAM, WinXP SP2 laptop.
dvwannab
14th April 2007, 16:05
Just an update with the same script. I did another encode 1080i to 480i last night, this time on my desktop. The clip was 1hr 14 min and did a 2-pass with CCE Basic 2.70. This time the encode was much faster and took only 8.5 hours to complete and looks every bit as good as TDeint. Yadif is my new deinterlacer :thanks:
scharfis_brain
14th April 2007, 16:28
even with tdeint you'd had a comparable speedup.
This is caused by the separated resize.
horizontal downsize before deinterlacing
vertical downsize after deinterlacing
this saves the deinterlacer from processing unneeded pixels.
anyways, yadif has more secure motionmasking than tdeint() or securebob() but lacks good interpolation techniques.
But the latter one isn't that bad, cause you'*re downsizing by a fair amount so the errors made by its interpolation aren't visible.
BlueCup
15th April 2007, 07:52
SeparateFields()
XXXresize(720,240)
Weave()
scharfis_brain's blood pressure just went up.
scharfis_brain
15th April 2007, 08:41
if you like alotta stairstepping in your formerly HD videos, have fun .
Alain2
15th April 2007, 20:03
Guys, sorry for a probably stupid question, but as I don't know the answer..:
When you resize only one dimension (here for instance bicubicresize(704,height) is horizontally only), the resizer algorithm is never taking into acount the nieighboors in the other dimension ? (here the vertical neighboors of the interpolated pixel ?) Is this always the case for all the standard resizers ? (linear, bicubic, spline, lanczos)
davidhorman
15th April 2007, 21:10
The functions go to zero on the vertical neighbours if there is no vertical displacement in the resampling - in other words, yes :)
In theory, you may lose a very small amount of detail from rounding errors by resizing twice, but you'd never notice it.
David
Leak
15th April 2007, 21:18
In theory, you may lose a very small amount of detail from rounding errors by resizing twice, but you'd never notice it.
Unless I'm totally wrong you'd never notice it because AviSynth's built in resizers always work in 2 passes, i.e. one direction followed by the other... :D
np: Star You Star Me - Loveletter (Simple Things)
scharfis_brain
15th April 2007, 21:47
yep. that's the reason, why one can split up resizing that way!
theoretical there should be NO difference in speed between these two lines:
input.anyresize(x,input.height).anyresize(x,y)
input.anyresize(x,y)
davidhorman
15th April 2007, 22:16
theoretical there should be NO difference in speed between these two lines:
input.anyresize(x,input.width).anyresize(x,y)
input.anyresize(x,y)
Hmm... I think you'd have to work hard to write a resizer that showed no speed difference in those two cases... or did you mean quality?
David
Leak
15th April 2007, 22:34
Hmm... I think you'd have to work hard to write a resizer that showed no speed difference in those two cases... or did you mean quality?
No, he meant the first line was what AviSynth does internally; if one dimension stays the same it's resize is not even executed.
So except for a extremely tiny overhead by having to execute two script functions instead of one, the speed (and the result) should be the same.
BlueCup
15th April 2007, 23:40
http://img412.imageshack.us/img412/3723/010000om8.jpg
http://img412.imageshack.us/img412/8956/020000eh3.jpg
One example is yadif(mode=1) and the other is Bob().SelectEven().xxxresize(). They both look the same to me.
if you like alotta stairstepping in your formerly HD videos, have fun .
I'll have samples posted of that once I do the final test of outputting to TV.
EDIT: 1440x1088 material
ChiDragon
16th April 2007, 00:06
The tiny lines on the collar look eeeever so slightly sharper in the first pic to me, but my eyes could be playing tricks... Like scharfis_brain said you're downsizing by so much that differences between interpolation methods get thrown out.
BlueCup
16th April 2007, 04:37
Bob().SelectEven() is faster and can be used then. I also didn't say which is which in the examples.
scharfis_brain
16th April 2007, 05:33
please re-read your own post that you claimed to raise my blood pressure. There you nothing told about bob.
BlueCup
16th April 2007, 07:37
Yes I know, this was what I had done first with deinterlacing. I'll get to the SeparateFields() comparison. Haven't had a chance to output the footage to the TV. My first post was a poke at you but after doing minor tests on here, I want to see for sure. Don't worry you know your stuff very well, I'm not doubting that.
The images I posted do make me want to do more tests comparing deinterlacers though.
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.