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 6th November 2011, 19:34   #1501  |  Link
cretindesalpes
͡҉҉ ̵̡̢̛̗̘̙̜̝̞̟̠͇̊̋̌̍̎̏̿̿
 
cretindesalpes's Avatar
 
Join Date: Feb 2009
Location: No support in PM
Posts: 610
Vectors must have been generated with the same pel setting as the superclip used in the utility functions (MDegrain, MCompensate, etc). Anyway it should definitely output an error message instead of crashing in case of inconsistency.
__________________
dither 1.27.2 for AviSynth | avstp 1.0.3 for AviSynth development | fmtconv r19 for Vapoursynth | trimx264opt segmented encoding
cretindesalpes is offline   Reply With Quote
Old 9th November 2011, 23:37   #1502  |  Link
cretindesalpes
͡҉҉ ̵̡̢̛̗̘̙̜̝̞̟̠͇̊̋̌̍̎̏̿̿
 
cretindesalpes's Avatar
 
Join Date: Feb 2009
Location: No support in PM
Posts: 610
Quote:
Originally Posted by Boulder View Post
Seems more like there is something wrong with 32-pixel blocks. Using this script:
[...]
fv1=MAnalyse(superanalyse,blksize=32,dct=5,isb=false,delta=1)
There was no implementation for SATD with blksize > 16, the blocks were all evaluated to SAD = 0. I added an approximation in the modified MVTools 2.5.13.1 from the Dither package. I also added pel consistency checks in the functions using a superclip and one or more motion vector clips.
__________________
dither 1.27.2 for AviSynth | avstp 1.0.3 for AviSynth development | fmtconv r19 for Vapoursynth | trimx264opt segmented encoding
cretindesalpes is offline   Reply With Quote
Old 10th November 2011, 05:05   #1503  |  Link
Boulder
Pig on the wing
 
Boulder's Avatar
 
Join Date: Mar 2002
Location: Hollola, Finland
Posts: 4,483
Thanks, I'll test the new build.
__________________
And if the band you're in starts playing different tunes
I'll see you on the dark side of the Moon...
Boulder is offline   Reply With Quote
Old 11th November 2011, 04:38   #1504  |  Link
Boulder
Pig on the wing
 
Boulder's Avatar
 
Join Date: Mar 2002
Location: Hollola, Finland
Posts: 4,483
The new build seems to work fine, thanks

Do you have any plans to improve MVTools further, like making it possible to use blocksize 24? -Vit- created the plugin which could be used to scale vectors but it would be nice to have native support for something between sizes 16 and 32.
__________________
And if the band you're in starts playing different tunes
I'll see you on the dark side of the Moon...
Boulder is offline   Reply With Quote
Old 11th November 2011, 18:20   #1505  |  Link
ajp_anton
Registered User
 
ajp_anton's Avatar
 
Join Date: Aug 2006
Location: Stockholm/Helsinki
Posts: 771
I'm trying to use the motion blur effect in this plugin to convert 60fps video game footage into Youtube-friendly 30fps.
But I'm not really satisfied with the result. No matter how short I make the "time interval", the high-detailed slow-moving background gets totally blurred.

There doesn't seem to be anything wrong with the motion vectors. Is it possible to skip all vectors that are shorter than some threshold? That way I can blur any fast-moving objects, while keeping the detailed background. Or is this possible somehow with MMask?
ajp_anton is offline   Reply With Quote
Old 11th November 2011, 19:47   #1506  |  Link
-Vit-
Registered User
 
Join Date: Jul 2010
Posts: 448
QTGMC will do that kind of motion blur for you (without doing any other processing):
Code:
QTGMC( "Slower", InputType=1, fpsDivisor=2, \
       ShutterBlur=2, ShutterAngleSrc=0, ShutterAngleOut=90, SBlurLimit=6, \
       TR0=0, TR1=0, TR2=0, Rep0=0, Rep2=0, SMode=0, SLMode=0, Sbb=0, NoiseProcess=0, SourceMatch=0, Lossless=0 )
1st line selects motion analysis quality, sets progressive input and reduces to 1/2 rate (SelectEven equivalent)
2nd line is the motion blur settings. Game source likely has no blur so ShutterAngleSrc = 0, ShutterAngleOut sets output blur level (0-360), SBlurLimit does what you want, will not blur regions moving slower than this value pixels per frame
3rd line switches off everything else in QTGMC

___

Or if you want to do it yourself use MMask, basic idea below (assuming you will add a SelectEven() before or after):
Code:
clip=last
... # Calculate super clips, vectors fVec1, bVec1...
blurClip = MFlowBlur( ... )	   

BlurLimit = 6 # Blocks moving less than BlurLimit pixels per frame will not be blurred
motionMask = MMask( clip, bVec1, kind=0, ml=BlurLimit )
output = mt_merge( clip, blurClip, motionMask, U=3,V=3 )

Last edited by -Vit-; 11th November 2011 at 21:04. Reason: clarity
-Vit- is offline   Reply With Quote
Old 11th November 2011, 20:09   #1507  |  Link
gyth
Registered User
 
Join Date: Sep 2011
Posts: 86
Have you tried just SelectEven()? Many people prefer the cinematic shuttering to soap-opera smoothness.

Code:
super = MSuper()
backward_vectors = MAnalyse(super, isb = true)
forward_vectors = MAnalyse(super, isb = false)
blurred=MFlowBlur(super, backward_vectors, forward_vectors, blur=45).SelectEven()

shuttered=SelectEven()

mask=MMask(forward_vectors, kind=0, ml=10)
overlay(blurred,shuttered,mask=mask)
P.S. Which video game? Older games sometimes have blinking effects which can be more complicated to deal with.
gyth is offline   Reply With Quote
Old 11th November 2011, 21:06   #1508  |  Link
-Vit-
Registered User
 
Join Date: Jul 2010
Posts: 448
That's exactly what the QTGMC line and the manual code above does (I assumed a pre or post SelectEven in the manual approach).
-Vit- is offline   Reply With Quote
Old 12th November 2011, 05:52   #1509  |  Link
ajp_anton
Registered User
 
ajp_anton's Avatar
 
Join Date: Aug 2006
Location: Stockholm/Helsinki
Posts: 771
I've already tried merging the blurred and non-blurred images with a MMask(kind=0,...) mask, and didn't like the results.

An object moving over a non-moving background will be surrounded by zeroes in the mask. The object will be blurred within the object itself (where the mask is non-zero), but its movement over the static background won't be blurred.

(The video game is Super Smash Bros Melee. It looks horrible after a simple SelectEven because it's a very fast-moving game. Many people have liked the motion blur I've been using, but others including myself hate how it completely destroys the detailed slow-moving backgrounds)

Last edited by ajp_anton; 12th November 2011 at 05:54.
ajp_anton is offline   Reply With Quote
Old 12th November 2011, 07:29   #1510  |  Link
-Vit-
Registered User
 
Join Date: Jul 2010
Posts: 448
Perhaps combine forward and backward masks. And also the backwards mask from the previous frame and the forward mask from the next frame...? [It's the non-intuitive way round...]
Or do a MFlowBlur on the mask itself!
-Vit- is offline   Reply With Quote
Old 12th November 2011, 07:48   #1511  |  Link
gyth
Registered User
 
Join Date: Sep 2011
Posts: 86
Code:
c = last

# blur == amount of blur, percentage
# 200 - fully open shutter (doubled because of SelectEven)
# 0 - no blur (ie SelectEven)
blur = 50

# motion == what blurs
# 0 - everything blurred
# small values - small motion treated as static
# large values - only high motion treated as moving
# 255 - nothing blurred (ie SelectEven)
motion = 10

super = MSuper(c)
b_vec = MAnalyse(super, isb = true)
f_vec = MAnalyse(super, isb = false)
blurd = MFlowBlur(c, super, b_vec, f_vec, blur=blur)

# hopefully looking forward and backwards will help the problem
# you were having with occlusion
fmask = MMask(c, f_vec, kind=0, ml=motion)
bmask = MMask(c, b_vec, kind=0, ml=motion)
mask  = mt_logic(fmask, bmask, mode="or", U=3, V=3)

output = mt_merge(c, blurd, mask, U=3, V=3)

output.SelectEven()
gyth is offline   Reply With Quote
Old 12th November 2011, 14:23   #1512  |  Link
ajp_anton
Registered User
 
ajp_anton's Avatar
 
Join Date: Aug 2006
Location: Stockholm/Helsinki
Posts: 771
Combining masks doesn't work if the object moves more than its size for each frame, because then the object's mask will still be completely surrounded by zero-motion.
But also blurring the mask sounds very interesting! Will try that soon. Thanks.
ajp_anton is offline   Reply With Quote
Old 12th November 2011, 18:14   #1513  |  Link
gyth
Registered User
 
Join Date: Sep 2011
Posts: 86
Here is another option, blending to cause ghosting.
Code:
# http://ajpanton.se/ssbm/ajp_anton/TAS/
ffvideosource("DrMario_AR_13.08.mp4")

c = last.assumefps("ntsc_double")

# blur == amount of blur, percentage
# 200 - fully open shutter (doubled because of SelectEven)
# 0 - no blur (ie SelectEven)
blur = 50

# motion == what blurs
# 0 - everything blurred
# small values - small motion treated as static
# large values - only high motion treated as moving
# 255 - nothing blurred (ie SelectEven)
motion = 10

super = MSuper(c.blur(1.5))
b_vec = MAnalyse(super, isb = true)
f_vec = MAnalyse(super, isb = false)
#blurd = MFlowBlur(c, super, b_vec, f_vec, blur=blur)

blur2 = convertfps("ntsc_quad").SelectOdd()

fmask = MMask(c, f_vec, kind=0, ml=motion).trim(1,0)
bmask = MMask(c, b_vec, kind=0, ml=motion)
mask  = mt_logic(fmask, bmask, mode="or", U=3, V=3)

output = mt_merge(c, blur2, mask, U=3, V=3)

output.SelectEven()
test = stackhorizontal(c, output.selecteven.changefps(60))
gyth is offline   Reply With Quote
Old 14th November 2011, 23:27   #1514  |  Link
cretindesalpes
͡҉҉ ̵̡̢̛̗̘̙̜̝̞̟̠͇̊̋̌̍̎̏̿̿
 
cretindesalpes's Avatar
 
Join Date: Feb 2009
Location: No support in PM
Posts: 610
Quote:
Originally Posted by Boulder View Post
Do you have any plans to improve MVTools further, like making it possible to use blocksize 24?
Adding blksize=24 looks a bit complicated for now. There are zillions of lines of code to write or adapt, this would be a pretty long task. I'm currently trying to make MVTools natively multithreaded, at least the MAnalyse part, and haven't done any significant progress so far by lack of time. However I am now more familiar with the code and know more accurately what to do and how. I also almost finished writing something allowing to safely load and save the vector clips. It will be useful to test filters quickly: generate the vectors once for a given clip, then reload them during the filtering pass for quick access. The downside is the size of the vector file which is really huge, like a lossless clip.
__________________
dither 1.27.2 for AviSynth | avstp 1.0.3 for AviSynth development | fmtconv r19 for Vapoursynth | trimx264opt segmented encoding

Last edited by cretindesalpes; 14th November 2011 at 23:32.
cretindesalpes is offline   Reply With Quote
Old 15th November 2011, 01:48   #1515  |  Link
-Vit-
Registered User
 
Join Date: Jul 2010
Posts: 448
Quote:
Originally Posted by cretindesalpes View Post
I also almost finished writing something allowing to safely load and save the vector clips. It will be useful to test filters quickly: generate the vectors once for a given clip, then reload them during the filtering pass for quick access. The downside is the size of the vector file which is really huge, like a lossless clip.
I wrote a plugin for my own testing purposes to do that. It also contains my vector scaling functions, which have been extended with various esoteric modes:
MVExtras 0.21
Contains source and some instructions.

The vector storage combines as many vector clips as you want into a single encodable clip, which you then save out lossless. Read it back in as a source and you can extract the vector clips you want. Requires a lossless RGBA encoder - I only know of Lagarith. May be better to save to a custom file format, but I needed some compression and this was the quickest way. Definitely want some kind of compression for this otherwise the vector files become unusably large.

Anyway, it might be relevant to whatever you add to MVTools. You might consider adding some vector scaling functions too, they are quite useful and MVTools used to contain something similar.
-Vit- is offline   Reply With Quote
Old 15th November 2011, 08:40   #1516  |  Link
cretindesalpes
͡҉҉ ̵̡̢̛̗̘̙̜̝̞̟̠͇̊̋̌̍̎̏̿̿
 
cretindesalpes's Avatar
 
Join Date: Feb 2009
Location: No support in PM
Posts: 610
Quote:
Originally Posted by -Vit- View Post
I wrote a plugin for my own testing purposes to do that. It also contains my vector scaling functions
Oh! I was aware of the scaling function, but didn't know for the store/restore vectors. I'll definitely check how to integrate your modifications to mine.
__________________
dither 1.27.2 for AviSynth | avstp 1.0.3 for AviSynth development | fmtconv r19 for Vapoursynth | trimx264opt segmented encoding
cretindesalpes is offline   Reply With Quote
Old 15th November 2011, 18:26   #1517  |  Link
Boulder
Pig on the wing
 
Boulder's Avatar
 
Join Date: Mar 2002
Location: Hollola, Finland
Posts: 4,483
Quote:
Originally Posted by -Vit- View Post
I wrote a plugin for my own testing purposes to do that. It also contains my vector scaling functions, which have been extended with various esoteric modes:
MVExtras 0.21
Contains source and some instructions.
Have you made any extensive tests with scaled vectors? I noticed that the feature tends to produce much longer vectors, I didn't do any serious comparison yet.
__________________
And if the band you're in starts playing different tunes
I'll see you on the dark side of the Moon...
Boulder is offline   Reply With Quote
Old 15th November 2011, 19:25   #1518  |  Link
-Vit-
Registered User
 
Join Date: Jul 2010
Posts: 448
Quote:
Originally Posted by Boulder View Post
Have you made any extensive tests with scaled vectors? I noticed that the feature tends to produce much longer vectors, I didn't do any serious comparison yet.
I have tested, but not extensively (haven't had time for any serious avisynth development for months). Clearly scaled vectors analyzed from a half-sized frame will not be exactly the same as vectors measured from the full size-frame due to differences in MVAnalyze working at different blocksizes/resolutions. I find scaled vectors a little less precise, as you might expect, but I wouldn't say I've observed any artificial lengthening (the 2^ scaling is very simple in its implementation).

Can't remember which version of the vector scaling I previously released (it was not intended for release before the next QTGMC, which uses it). The version above has had a number of changes, maybe it resolves your observation.
-Vit- is offline   Reply With Quote
Old 15th November 2011, 20:28   #1519  |  Link
Boulder
Pig on the wing
 
Boulder's Avatar
 
Join Date: Mar 2002
Location: Hollola, Finland
Posts: 4,483
Here's two sample frames where you can see the difference quite clearly:

http://img38.imageshack.us/img38/5058/normal1j.png
http://img3.imageshack.us/img3/8531/scaled1.png

http://img832.imageshack.us/img832/9183/normal2k.png
http://img853.imageshack.us/img853/5264/scaled2.png

I used this script to compare:
Code:
DGSource("batman1.dgi")
clip=last
clipScaled = clip.BicubicResize( clip.Width()/2, clip.Height()/2 )
superScaled = clipScaled.MSuper( pel=2, hpad=0,vpad=0 )
bVecScaled  = superScaled.MAnalyse( blksize=8, isb=true, overlap=4 )
fVecScaled  = superScaled.MAnalyse( blksize=8, isb=false, overlap=4 )
bVec = bVecScaled.MScaleVectors( 2 )
fVec = fVecScaled.MScaleVectors( 2 )
supersc = clip.MSuper( pel=2, hpad=0,vpad=0 )
fvecnormal = supersc.MAnalyse(blksize=16,overlap=8,isb=false)
bvecnormal = supersc.MAnalyse(blksize=16,overlap=8,isb=true)
interleave(MShow(supersc,fvecnormal),MShow(supersc,fvec))
__________________
And if the band you're in starts playing different tunes
I'll see you on the dark side of the Moon...
Boulder is offline   Reply With Quote
Old 15th November 2011, 21:23   #1520  |  Link
-Vit-
Registered User
 
Join Date: Jul 2010
Posts: 448
That looks like differences due to the analysis blocksize - it's mainly affecting blocks with little detail, which can be matched quite freely. More freely when the blocksize is small. You should compare the vectors before and after they were scaled - that's what the plugin does and so those clips should be equivalent. The plugin cannot guarantee that a search with a larger image/blocksize will be identical to a search with a smaller image/blocksize - that's down to the operation of MVTools. Although in practice those searches are similar enough for some purposes. Vector scaling will be used for faster QTGMC presets on HD material.

Change the last line in your script to show original vectors, then small image vectors, then scaled vectors:
Code:
interleave(MShow(supersc,fvecnormal), MShow(superScaled,fVecScaled).Spline36Resize(clip.Width(), clip.Height()), MShow(supersc,fvec))

Last edited by -Vit-; 15th November 2011 at 21:49.
-Vit- is offline   Reply With Quote
Reply

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 01:03.


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