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
Register FAQ Calendar Today's Posts Search

Reply
 
Thread Tools Search this Thread Display Modes
Old 19th August 2013, 05:32   #1  |  Link
pbreak
Registered User
 
Join Date: Nov 2011
Posts: 13
Width and Num

Hi

I'd like to change the Num generator based on the width of the video, how can i make this script work?

Code:
Width <= 1200 ? Eval("""
S = V.SVSuper("{rc:false,gpu:1, scale:{up:2, down:2}}")
A = S.SVAnalyse("{main:{coarse:{distance:-1, bad:{SAD:20}}},penalty:{pzero:1,pnbour:1000}}, refine:[{thsad:20}]}")
V.SVSmoothFps(S, A, "{rate:{num:50000,den:1001,abs:true},algo:21, mask:{area:30,cover:100,area_sharp:1.0},scene:{blend:false,mode:0,limits:{blocks:100}}}", url=URL, mt=100)
GetMTMode(false) > 0 ? distributor()
"""): last
Width > 1200 ? Eval("""
S = V.SVSuper("{rc:false,gpu:1, scale:{up:2, down:2}}")
A = S.SVAnalyse("{main:{coarse:{distance:-1, bad:{SAD:20}}},penalty:{pzero:1,pnbour:1000}}, refine:[{thsad:20}]}")
V.SVSmoothFps(S, A, "{rate:{num:60000,den:1001,abs:true},algo:21, mask:{area:30,cover:100,area_sharp:1.0},scene:{blend:false,mode:0,limits:{blocks:100}}}", url=URL, mt=100)
GetMTMode(false) > 0 ? distributor()
"""): last
I added V = V.Width, and i get an error saying there is ":" missing, so i change ": last" and i put after "distributor()" ... but nothing seems to work.


Thanks
pbreak is offline   Reply With Quote
Old 19th August 2013, 09:40   #2  |  Link
wonkey_monkey
Formerly davidh*****
 
wonkey_monkey's Avatar
 
Join Date: Jan 2004
Posts: 2,496
Quote:
I added V = V.Width
Do you mean you added:

Code:
Width = V.Width
?

I got the same error about a missing :, but only when I didn't have SVPflow installed - after that I got other errors about OpenCL so I didn't investigate much further.

Doing two exclusive tests on Width seems a bit wasteful - you could just do:

Code:
Width > 1200 ? Eval("""...""") : Eval("""...""")
But as the only thing changing is the num: in SVSmoothFps, why not try just setting a string based on the width and build the rest of your script around that? (unless of course this is just an example and you're planning on doing something much more complicated...)

Off the top of my head, and not tested due to lack of plugins:

Code:
mynum = V.width <= 1200 ? "50000" : "60000"

S = V.SVSuper("{rc:false,gpu:1, scale:{up:2, down:2}}")
A = S.SVAnalyse("{main:{coarse:{distance:-1, bad:{SAD:20}}},penalty:{pzero:1,pnbour:1000}}, refine:[{thsad:20}]}")
V.SVSmoothFps(S, A, "{rate:{num:" + mynum + ",den:1001,abs:true},algo:21, mask:{area:30,cover:100,area_sharp:1.0},scene:{blend:false,mode:0,limits:{blocks:100}}}", url=URL, mt=100)
GetMTMode(false) > 0 ? distributor() : last
David

Last edited by wonkey_monkey; 19th August 2013 at 12:21. Reason: fixed as per Gavino's post below
wonkey_monkey is offline   Reply With Quote
Old 19th August 2013, 09:47   #3  |  Link
Gavino
Avisynth language lover
 
Join Date: Dec 2007
Location: Spain
Posts: 3,431
You can simplify the code to this:
Code:
num = Width <= 1200 ? 50000 : 60000
S = V.SVSuper("{rc:false,gpu:1, scale:{up:2, down:2}}")
A = S.SVAnalyse("{main:{coarse:{distance:-1, bad:{SAD:20}}},penalty:{pzero:1,pnbour:1000}}, refine:[{thsad:20}]}")
V.SVSmoothFps(S, A, "{rate:{num:"+String(num)+",den:1001,abs:true},algo:21, mask:{area:30,cover:100,area_sharp:1.0},scene:{blend:false,mode:0,limits:{blocks:100}}}", url=URL, mt=100)
GetMTMode(false) > 0 ? distributor() : last
EDIT: Ah, davidhorman beat me to it, but his final line is wrong - should be
GetMTMode(false) > 0 ? distributor() : last
__________________
GScript and GRunT - complex Avisynth scripting made easier
Gavino is offline   Reply With Quote
Old 19th August 2013, 13:20   #4  |  Link
pbreak
Registered User
 
Join Date: Nov 2011
Posts: 13
davidhorman and Gavino

Thank you guys, you're awesome.
It's working.
pbreak is offline   Reply With Quote
Reply


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 13:19.


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