Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Usage

Reply
 
Thread Tools Search this Thread Display Modes
Old 10th May 2008, 21:05   #21  |  Link
mikeytown2
Resize Abuser
 
mikeytown2's Avatar
 
Join Date: Apr 2005
Location: Seattle, WA
Posts: 623
KenBurnsEffect() Changes:
  • Fixed a minor bug with the total frame count. (Thanks Gavino)




Quote:
Originally Posted by Dreassica View Post
No as in it cant be properly ivtced/fieldmatched as it has shit frames etc. I just selected a few good frames, used photoshop to append them to a panoramic view picture. Successfully did one such frame the manual way using allot of croppings to 640x480 shifting an x number of pixels. Just too timeconsuming, and I thought maybe this scripts could do it much faster and easier.
I understand what your mean. I think hand picking frames and putting them together with hugin is your fastest option. What you suggested would be an interesting way of fixing very bad sources when the movement is a static pan. I would follow the scanned image tutorial, it should be faster then photoshop.
http://hugin.sourceforge.net/tutorials/scans/en.shtml
mikeytown2 is offline   Reply With Quote
Old 10th May 2008, 21:09   #22  |  Link
Dreassica
Registered User
 
Join Date: May 2002
Posts: 384
Quote:
Originally Posted by mikeytown2 View Post
KenBurnsEffect() Changes:
  • Fixed a minor bug with the total frame count. (Thanks Gavino)






I understand what your mean. I think hand picking frames and putting them together with hugin is your fastest option. What you suggested would be an interesting way of fixing very bad sources when the movement is a static pan. I would follow the scanned image tutorial, it should be faster then photoshop.
http://hugin.sourceforge.net/tutorials/scans/en.shtml
it's not really the process of combining a few frames to make a panoramic picture that's timeconsuming for me, but manually doing crops etc to recreate all fames that is, thought an automated wayt using oen of your scripts could simplify that.
Dreassica is offline   Reply With Quote
Old 10th May 2008, 21:32   #23  |  Link
mikeytown2
Resize Abuser
 
mikeytown2's Avatar
 
Join Date: Apr 2005
Location: Seattle, WA
Posts: 623
Quote:
Originally Posted by Dreassica View Post
it's not really the process of combining a few frames to make a panoramic picture that's timeconsuming for me, but manually doing crops etc to recreate all fames that is, thought an automated wayt using oen of your scripts could simplify that.
Could you upload one of your stitched panoramic pictures? http://imageshack.us/

And also upload the clip that it came from? http://www.megaupload.com/

And then we can go from there
mikeytown2 is offline   Reply With Quote
Old 10th May 2008, 22:05   #24  |  Link
Dreassica
Registered User
 
Join Date: May 2002
Posts: 384
Don't have access to my usual pc for a few days, so i can't provide samples. I do still know characteristics of the last scene i worked on.
a sidepanscene of 144 frames, framerate 23.976, panoramic picture is 1504x480, and every framestep is 6 pixels x 144.
Dreassica is offline   Reply With Quote
Old 10th May 2008, 22:20   #25  |  Link
mikeytown2
Resize Abuser
 
mikeytown2's Avatar
 
Join Date: Apr 2005
Location: Seattle, WA
Posts: 623
Quote:
Originally Posted by Dreassica View Post
Don't have access to my usual pc for a few days, so i can't provide samples. I do still know characteristics of the last scene i worked on.
a sidepanscene of 144 frames, framerate 23.976, panoramic picture is 1504x480, and every framestep is 6 pixels x 144.
This pans left to right. replace colorbars with your image, and it should work.
Code:
colorbars().trim(0,143).BilinearResize(1504,480)

KenBurnsEffect(last, 0,0, 720,0,   784,0, 1504,0,  720,480, IgnoreAR=1)
Same as this
Code:
colorbars().trim(0,143).BilinearResize(1504,480)

KenBurnsEffect(last, 0,0, 0,480,   784,0, 784,480,  720,480, IgnoreAR=1)
Left to right, then right to left
Code:
X = colorbars().trim(0,143).BilinearResize(1504,480)

KenBurnsEffect(x, 0,0, 0,480,   784,0, 784,480,  720,480, IgnoreAR=1)
last + KenBurnsEffect(x, 784,0, 784,480,  0,0, 0,480, 720,480, IgnoreAR=1)

Last edited by mikeytown2; 10th May 2008 at 22:29.
mikeytown2 is offline   Reply With Quote
Old 10th May 2008, 22:35   #26  |  Link
Dreassica
Registered User
 
Join Date: May 2002
Posts: 384
tested it on a custom made picture, seemed to work as intended, only thing is, output resolution should be 640x480 not 720x480.Also, no way to do this without rgb32 conversion?
Dreassica is offline   Reply With Quote
Old 10th May 2008, 23:12   #27  |  Link
mikeytown2
Resize Abuser
 
mikeytown2's Avatar
 
Join Date: Apr 2005
Location: Seattle, WA
Posts: 623
KenBurnsEffect() Changes:
  • Fixed small error in the error code, now displays the correct info.
  • Matched Input of new ZoomBox()

ZoomBox() Changes:
  • Reorder inputs so it matches KBE() more


Quote:
Originally Posted by Dreassica View Post
tested it on a custom made picture, seemed to work as intended, only thing is, output resolution should be 640x480 not 720x480.Also, no way to do this without rgb32 conversion?
zoom.dll requires rgb32, because there is no zooming only panning you can use my ZoomBox and animate it to get your desired effect. If there is zooming it still works, but the result can be ugly sometimes (limitations of Animate).

This example is more generalized, so it might be harder to follow.
Code:
WidthFinal = 640
HeightFinal = 480
X = colorbars().trim(0,143).BilinearResize(1504,480)

KenBurnsEffect(x, 0,0, 0,HeightFinal,   width(x)-WidthFinal,0, width(x)-WidthFinal,HeightFinal,  WidthFinal,HeightFinal, IgnoreAR=1)
last + KenBurnsEffect(x, width(x)-WidthFinal,0, width(x)-WidthFinal,HeightFinal,  0,0, 0,HeightFinal, WidthFinal,HeightFinal, IgnoreAR=1)
last.ConvertToYV12()

x = x.ConvertToYV12()
last + Animate(0, x.framecount()-1, "ZoomBox", x, 0.0,0.0,  0.0,Float(HeightFinal), WidthFinal, HeightFinal,1,     x, Float(width(x)-WidthFinal),0.0, Float(width(x)-WidthFinal),Float(HeightFinal), WidthFinal, HeightFinal,1)
last + Animate(0, x.framecount()-1, "ZoomBox", x, Float(width(x)-WidthFinal),0.0, Float(width(x)-WidthFinal),Float(HeightFinal), WidthFinal, HeightFinal,1,    x, 0.0,0.0,  0.0,Float(HeightFinal), WidthFinal, HeightFinal,1)
I use floats whenever i use Animate, because it reduces the rounding errors. You also need to Re-copy/Paste KenBurnsEffect() and ZoomBox() for this latest example to work. You will notice that ZoomBox is faster and has the potential for a sharper image when compared to zoom.dll, only downside is Animate messes up when zooming; that is why i use zoom.dll, it works every time. zoom.dll also has sub-pixel accuracy, which ZoomBox does not have.

Last edited by mikeytown2; 10th May 2008 at 23:22.
mikeytown2 is offline   Reply With Quote
Old 11th May 2008, 00:02   #28  |  Link
Dreassica
Registered User
 
Join Date: May 2002
Posts: 384
Well, I won't need zoom because all the scenes I want to fix are strictly pans.
Dreassica is offline   Reply With Quote
Old 11th May 2008, 01:47   #29  |  Link
mikeytown2
Resize Abuser
 
mikeytown2's Avatar
 
Join Date: Apr 2005
Location: Seattle, WA
Posts: 623
KenBurnsEffect() Changes:
  • Will work with any color space if useZoomBox=2.
ZoomBox() Changes:
  • Added SubPixel Accuracy

Dreassica I made another change, KenBurnsEffect will now accept any colorspace if you set useZoomBox=2.

Here is your example again, with the latest changes
Code:
WidthFinal = 640
HeightFinal = 480
x = colorbars().trim(0,143).BilinearResize(1504,480).ConvertToYV12()

KenBurnsEffect(x, 0,0, 0,HeightFinal,   width(x)-WidthFinal,0, width(x)-WidthFinal,HeightFinal,  WidthFinal,HeightFinal, IgnoreAR=1, useZoomBox=2)
last + KenBurnsEffect(x, width(x)-WidthFinal,0, width(x)-WidthFinal,HeightFinal,  0,0, 0,HeightFinal, WidthFinal,HeightFinal, IgnoreAR=1, useZoomBox=2)
Once again Re-copy/Paste KenBurnsEffect() and ZoomBox()

Last edited by mikeytown2; 11th May 2008 at 02:32.
mikeytown2 is offline   Reply With Quote
Old 11th May 2008, 21:13   #30  |  Link
Dreassica
Registered User
 
Join Date: May 2002
Posts: 384
A simple Animate(0,143,"Crop", 864,0,640,480, 0,0,640,480) seems to do the job just fine it seems. Guess I was thinking way too complicated.
Dreassica is offline   Reply With Quote
Old 11th May 2008, 23:09   #31  |  Link
Gavino
Avisynth language lover
 
Join Date: Dec 2007
Location: Spain
Posts: 3,418
Quote:
Originally Posted by Dreassica View Post
A simple Animate(0,143,"Crop", 864,0,640,480, 0,0,640,480) seems to do the job just fine it seems. Guess I was thinking way too complicated.
I had to laugh when I saw this. You mean you've managed to reduce about 300 lines of script code to just one?
Surely that's against the spirit of this thread?

There's a lesson here for all of us who have been following this thread - the simple approach is usually the best. To be fair, your requirements were also simpler - pure panning without zooming.

Regarding your solution, if you find the movement jerky, it can be made smoother by using the subpixel cropping feature of the resizers, instead of simple Crop, ie
Code:
Animate(0,143,"Lanczos4Resize",640,480, 864.0,0.0, 640,480, 640,480, 0.0,0.0, 640,480)
(note decimal points are necessary)

@mikeytown2: your latest version seems to allow only zoombox=2, is this intentional?
Gavino is offline   Reply With Quote
Old 12th May 2008, 03:03   #32  |  Link
mikeytown2
Resize Abuser
 
mikeytown2's Avatar
 
Join Date: Apr 2005
Location: Seattle, WA
Posts: 623
Quote:
Originally Posted by Gavino View Post
I had to laugh when I saw this. You mean you've managed to reduce about 300 lines of script code to just one?
Surely that's against the spirit of this thread?

There's a lesson here for all of us who have been following this thread - the simple approach is usually the best. To be fair, your requirements were also simpler - pure panning without zooming.

Regarding your solution, if you find the movement jerky, it can be made smoother by using the subpixel cropping feature of the resizers, instead of simple Crop, ie
Code:
Animate(0,143,"Lanczos4Resize",640,480, 864.0,0.0, 640,480, 640,480, 0.0,0.0, 640,480)
(note decimal points are necessary)

@mikeytown2: your latest version seems to allow only zoombox=2, is this intentional?
Yes, what was requested is quite simple! The majority of the code in KBE() is to translate the requested input into something that zoom.dll can use. If you follow the processes inside the function when zoombox=2, with the above example, the only thing that is done is a crop.

Only allowing zoombox=2 was a bug, i commented out the one check that keeps doing that. I can't seem to make it work, i want to check that if they use the cubic option, zoombox should equal 1 or 0, not 2. I also thought the nop() would make this other line not execute, but it still returned.
Code:
#short circuit function, return here if only using zoombox
Return (useZoomBox==2) ? cAlt :nop()
This is now at the bottom, thus no short circuit.

As for using a resize to do the crop, i didn't realize that it can take a float as input!
http://avisynth.org/mediawiki/Resize
I'm going to try to get my ZoomBox code to use this.


KenBurnsEffect() Updated

Last edited by mikeytown2; 12th May 2008 at 10:08.
mikeytown2 is offline   Reply With Quote
Old 12th May 2008, 10:13   #33  |  Link
mikeytown2
Resize Abuser
 
mikeytown2's Avatar
 
Join Date: Apr 2005
Location: Seattle, WA
Posts: 623
Updated KenBurnsEffect() & ZoomBox()

Quote:
Originally Posted by mikeytown2 View Post
As for using a resize to do the crop, i didn't realize that it can take a float as input!
http://avisynth.org/mediawiki/Resize
I'm going to try to get my ZoomBox code to use this.
Got it!

Both Code bases have been updated. ZoomBox quality went through the roof! I highly recommend setting useZoomBox=2 when ever using KenBurnsEffect().
mikeytown2 is offline   Reply With Quote
Old 12th May 2008, 10:39   #34  |  Link
Gavino
Avisynth language lover
 
Join Date: Dec 2007
Location: Spain
Posts: 3,418
Quote:
Originally Posted by mikeytown2 View Post
Only allowing zoombox=2 was a bug, i commented out the one check that keeps doing that. I can't seem to make it work, i want to check that if they use the cubic option, zoombox should equal 1 or 0, not 2.
You want to use:
Code:
Assert(!((cubic || cubicX || cubicY) && useZoomBox==2), "...")
(By the way, I wasn't getting at you personally with my earlier (ironic) comment. Having spent a lot of time following this thread, I myself had overlooked that Dreassica's needs could be met with a simple animated Crop. Sometimes it's just impossible to see the wood for the trees!)
Gavino is offline   Reply With Quote
Old 12th May 2008, 19:56   #35  |  Link
Gavino
Avisynth language lover
 
Join Date: Dec 2007
Location: Spain
Posts: 3,418
Quote:
Originally Posted by mikeytown2 View Post
Both Code bases have been updated. ZoomBox quality went through the roof!
Well done, this looks very promising.

As often happens with new releases, your latest changes have also introduced a couple of bugs:
- KBE wrong when useZoomBox=1 since using wrong clips start and end (seen more easily when in addition speed!=1, since fails completely);
- ZoomBox fails with YV12 or YUY2 since wOut is no longer defined.

There is also a minor gotcha with the new ZoomBox method: the extra parameters are not in the same place for all resizers, so have to be passed by name, which has to be taken into account when constructing the Eval string. (In fact only BicubicResize fails on this score, at least in 2.57, so it's not a showstopper).
Gavino is offline   Reply With Quote
Old 12th May 2008, 21:40   #36  |  Link
mikeytown2
Resize Abuser
 
mikeytown2's Avatar
 
Join Date: Apr 2005
Location: Seattle, WA
Posts: 623
Quote:
Originally Posted by Gavino View Post
Well done, this looks very promising.

As often happens with new releases, your latest changes have also introduced a couple of bugs:
- KBE wrong when useZoomBox=1 since using wrong clips start and end (seen more easily when in addition speed!=1, since fails completely);
- ZoomBox fails with YV12 or YUY2 since wOut is no longer defined.

There is also a minor gotcha with the new ZoomBox method: the extra parameters are not in the same place for all resizers, so have to be passed by name, which has to be taken into account when constructing the Eval string. (In fact only BicubicResize fails on this score, at least in 2.57, so it's not a showstopper).
Thanks for all your testing, all the reported bugs have been fixed. I have a question, should zoombox fix the output if its not mod 2, or should i throw a warning?
mikeytown2 is offline   Reply With Quote
Old 12th May 2008, 23:41   #37  |  Link
Gavino
Avisynth language lover
 
Join Date: Dec 2007
Location: Spain
Posts: 3,418
Quote:
Originally Posted by mikeytown2 View Post
Thanks for all your testing, all the reported bugs have been fixed. I have a question, should zoombox fix the output if its not mod 2, or should i throw a warning?
You're welcome - glad to help. Most of my 'testing' was done by just eyeballing the source code. I'm a relative newbie at video processing, but after several decades developing software, I have an eagle eye when it comes to spotting coding errors!

Personally, I would go for a warning if the output size doesn't match the colorspace requirements, since if I ask for a given size I would expect to get exactly that, rather than have it corrected.
Gavino is offline   Reply With Quote
Old 13th May 2008, 00:49   #38  |  Link
mikeytown2
Resize Abuser
 
mikeytown2's Avatar
 
Join Date: Apr 2005
Location: Seattle, WA
Posts: 623
Quote:
Originally Posted by Gavino View Post
You're welcome - glad to help. Most of my 'testing' was done by just eyeballing the source code. I'm a relative newbie at video processing, but after several decades developing software, I have an eagle eye when it comes to spotting coding errors!

Personally, I would go for a warning if the output size doesn't match the colorspace requirements, since if I ask for a given size I would expect to get exactly that, rather than have it corrected.
After looking at this, I decided to let the Resize function handle the width/height error.
http://avisynth.org/mediawiki/Filter...e_as_a_user.3F


Fixed A bug with KBE() if useZoomBox=2 and its not RGB. ZoomBox updated as well.
mikeytown2 is offline   Reply With Quote
Old 13th May 2008, 15:34   #39  |  Link
Gavino
Avisynth language lover
 
Join Date: Dec 2007
Location: Spain
Posts: 3,418
Quote:
Originally Posted by mikeytown2 View Post
Fixed A bug with KBE() if useZoomBox=2 and its not RGB. ZoomBox updated as well.
Hi, Eagle Eye here again.
In the latest ZoomBox, this line:
Code:
BoxAR = Float(x2-x1)/Float(y2-y1)
needs to come after the part that handles the cases x2=x1 or y2=y1.
Gavino is offline   Reply With Quote
Old 13th May 2008, 19:09   #40  |  Link
mikeytown2
Resize Abuser
 
mikeytown2's Avatar
 
Join Date: Apr 2005
Location: Seattle, WA
Posts: 623
Quote:
Originally Posted by Gavino View Post
Hi, Eagle Eye here again.
In the latest ZoomBox, this line:
Code:
BoxAR = Float(x2-x1)/Float(y2-y1)
needs to come after the part that handles the cases x2=x1 or y2=y1.
Thanks! ZoomBox updated.
mikeytown2 is offline   Reply With Quote
Reply

Tags
anamorphic, crop, dar, pan and scan, resize

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 20:09.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, vBulletin Solutions Inc.