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 > VapourSynth

Reply
 
Thread Tools Search this Thread Display Modes
Old 8th June 2018, 15:05   #3061  |  Link
l33tmeatwad
Registered User
 
l33tmeatwad's Avatar
 
Join Date: Jun 2007
Posts: 414
Quote:
Originally Posted by unix View Post
-VapourSynthEditor-r18-64bit
-VapourSynth-R39
The first thing you may want to try updating VapourSynth, it's up to R43 now. Second, you'll want to specify order:

Code:
from vapoursynth import core
import vapoursynth as vs
core = vs.get_core()
src = core.d2v.Source('My.d2v')
src = src.vivtc.VFM(order=1).vivtc.VDecimate()
src.set_output()
Check your source to make sure you use the correct order.

Last edited by l33tmeatwad; 8th June 2018 at 15:07.
l33tmeatwad is offline   Reply With Quote
Old 8th June 2018, 15:05   #3062  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,548
Quote:
Originally Posted by l33tmeatwad View Post
The first thing you may want to try updating VapourSynth, it's up to R43 now.
More like try reading the error message. You didn't set field ORDER.
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik is offline   Reply With Quote
Old 8th June 2018, 15:08   #3063  |  Link
l33tmeatwad
Registered User
 
l33tmeatwad's Avatar
 
Join Date: Jun 2007
Posts: 414
Quote:
Originally Posted by Myrsloik View Post
More like try reading the error message. You didn't set field ORDER.
Sorry, I accidentally hit submit as I was typing out my reply...
l33tmeatwad is offline   Reply With Quote
Old 8th June 2018, 17:18   #3064  |  Link
unix
Registered User
 
Join Date: Aug 2015
Posts: 47
Quote:
Originally Posted by l33tmeatwad View Post
The first thing you may want to try updating VapourSynth, it's up to R43 now. Second, you'll want to specify order:

Code:
from vapoursynth import core
import vapoursynth as vs
core = vs.get_core()
src = core.d2v.Source('My.d2v')
src = src.vivtc.VFM(order=1).vivtc.VDecimate()
src.set_output()
Check your source to make sure you use the correct order.
I installed the last ver and I opened the file without
Code:
src = src.vivtc.VFM(order=1).vivtc.VDecimate()
but when i used it i got this error:
Code:
Failed to evaluate the script:
Python exception: VFM: argument order is required

Traceback (most recent call last):
File "src\cython\vapoursynth.pyx", line 1830, in vapoursynth.vpy_evaluateScript (src\cython\vapoursynth.c:36860)
File "C:/Users/Administrator/Desktop/encoder/Untitled.vpy", line 6, in 
src.set_output()
File "src\cython\vapoursynth.pyx", line 1722, in vapoursynth.Function.__call__ (src\cython\vapoursynth.c:35000)
vapoursynth.Error: VFM: argument order is required

Last edited by unix; 8th June 2018 at 21:22.
unix is offline   Reply With Quote
Old 8th June 2018, 22:34   #3065  |  Link
unix
Registered User
 
Join Date: Aug 2015
Posts: 47
Thanks l33tmeatwad for solving my issue =)
unix is offline   Reply With Quote
Old 10th June 2018, 13:04   #3066  |  Link
edcrfv94
Registered User
 
Join Date: Apr 2015
Posts: 84
I have a problem with VapourSynth Internal Resize use, but work fine with core.fmtc.resample.
Internal Resize result look like damaged.

VapourSynth Internal Resize


haf.Resize(core.fmtc.resample)


example1:
Code:
test = core.resize.Bilinear(src8, 960, 540)
test = core.resize.Bilinear(test, 1920, 1080)

#Fixed
test = haf.Resize(src8, 960, 540, kernel="bilinear", noring=False)
test = haf.Resize(test, 1920, 1080, kernel="bilinear", noring=False)
example2:
Code:
def Padding(clip, left=0, right=0, top=0, bottom=0):
    if not isinstance(clip, vs.VideoNode):
        raise TypeError('Padding: This is not a clip')
    if left < 0 or right < 0 or top < 0 or bottom < 0:
        raise ValueError('Padding: border size to pad must not be negative')

    return core.resize.Point(clip, clip.width + left + right, clip.height + top + bottom,
                             src_left=-left, src_top=-top, src_width=clip.width + left + right, src_height=clip.height + top + bottom)

#Fixed
def Padding(clip, left=0, right=0, top=0, bottom=0):
	if not isinstance(clip, vs.VideoNode):
		raise TypeError('Padding: This is not a clip')
	if left < 0 or right < 0 or top < 0 or bottom < 0:
		raise ValueError('Padding: border size to pad must not be negative')
	
	src_w = clip.width
	src_h = clip.height
	
	return haf.Resize(clip, src_w + left + right, src_h + top + bottom, sx=-left, sy=-top, sw=src_w + left + right, sh=src_h + top + bottom, kernel="point", noring=False)

Padding(clip, left=8, right=8, top=8, bottom=8)

Last edited by edcrfv94; 10th June 2018 at 13:14.
edcrfv94 is offline   Reply With Quote
Old 11th June 2018, 06:49   #3067  |  Link
edcrfv94
Registered User
 
Join Date: Apr 2015
Posts: 84
Quote:
Originally Posted by Stephen R. Savage View Post
Example1 is because your input is interlaced. Example2 is because the internal resizer uses a different border extension method from fmtc. You can use std.SetFieldBased to force the input to be treated as progressive.
Thanks
Also VapourSynth Internal Resize src_left and src_top not working.

Code:
test = core.resize.Spline36(src8, 1920, 1080, src_left=0, src_top=-0.5)

Fixed
test = haf.Resize(src8, 1920, 1080, sx=0, sy=-0.5, kernel="spline36", noring=False)
or
test = core.fmtc.resample(src8, 1920, 1080, sx=0, sy=-0.5, kernel="spline36")
edcrfv94 is offline   Reply With Quote
Old 13th June 2018, 21:01   #3068  |  Link
lansing
Registered User
 
Join Date: Sep 2006
Posts: 1,657
Quote:
Originally Posted by foxyshadis View Post
Color is only ever read as a Python list of each value per plane. There's nothing keeping you from implementing a convenience function, however, like:

Code:
def Hex2List(colorhex):
  digits = math.ceil(colorhex ** (1/16.))
  colorlist = []
  for plane in range(0,digits):
    colorlist.insert(0, colorhex % 256)
    colorhex = colorhex // 256
  return colorlist
And calling it as Hex2List(0x778899).

You can always use an actual list like [0x77, 0x88, 0x99], so the value of this convenience is questionable.
I have a follow-up issue with this. It works until I have a color hex like "000002"

Code:
color = "000002" # this doesn't work
#color = "53aadf" # this one works
hex_int = int(color, 16)

clip = core.std.BlankClip(width=patch_width, height=patch_width, length=1, color=Hex2List(hex_int))
It gives me an error "BlankClip: invalid number of color values specified".
lansing is offline   Reply With Quote
Old 13th June 2018, 22:11   #3069  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,548
Quote:
Originally Posted by lansing View Post
I have a follow-up issue with this. It works until I have a color hex like "000002"

Code:
color = "000002" # this doesn't work
#color = "53aadf" # this one works
hex_int = int(color, 16)

clip = core.std.BlankClip(width=patch_width, height=patch_width, length=1, color=Hex2List(hex_int))
It gives me an error "BlankClip: invalid number of color values specified".
Numbers starting with 0 are interpreted as octal numbers (base 8). If you always put a 0x in front you'll be fine or drop the leading zeroes.
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik is offline   Reply With Quote
Old 14th June 2018, 02:24   #3070  |  Link
lansing
Registered User
 
Join Date: Sep 2006
Posts: 1,657
After some searches I've found a 2 liner function for this in stackflow

Code:
def hex_to_rgb(value):
    """Return (red, green, blue) for the color given as #rrggbb."""
    value = value.lstrip('#')
    lv = len(value)
    return list(int(value[i:i + lv // 3], 16) for i in range(0, lv, lv // 3))
lansing is offline   Reply With Quote
Old 14th June 2018, 21:26   #3071  |  Link
hBIkOa7m
Registered User
 
Join Date: Feb 2016
Posts: 6
Quote:
Originally Posted by lansing View Post
After some searches I've found a 2 liner function for this in stackflow
You do realise hexadecimal colours are already 0xRRGGBB? It's just stacked in base16 instead of split into a list of base10. You can just shift the input value to access the colour without any fancy stuff. Dumb example Python code.

Code:
input_hex = 0x53aadf
r = (input_hex >> 16) & 0xFF # 83
g = (input_hex >> 8) & 0xFF # 170
b = (input_hex >> 0) & 0xFF # 223

Last edited by hBIkOa7m; 15th June 2018 at 20:11. Reason: Fixed comments at EOL to use # rather than //. Wrote sample code in the forum and didn't run it.
hBIkOa7m is offline   Reply With Quote
Old 14th June 2018, 21:45   #3072  |  Link
foxyshadis
ангел смерти
 
foxyshadis's Avatar
 
Join Date: Nov 2004
Location: Lost
Posts: 9,558
Quote:
Originally Posted by lansing View Post
After some searches I've found a 2 liner function for this in stackflow

Code:
def hex_to_rgb(value):
    """Return (red, green, blue) for the color given as #rrggbb."""
    value = value.lstrip('#')
    lv = len(value)
    return list(int(value[i:i + lv // 3], 16) for i in range(0, lv, lv // 3))
Would you rather pass a string instead of a hex integer? OK, use that. You HAVE to pass a string though. It wouldn't be difficult to combine a way to pass string or integer, but it's not a 2-liner.
foxyshadis is offline   Reply With Quote
Old 15th June 2018, 04:45   #3073  |  Link
lansing
Registered User
 
Join Date: Sep 2006
Posts: 1,657
Quote:
Originally Posted by foxyshadis View Post
Would you rather pass a string instead of a hex integer? OK, use that. You HAVE to pass a string though. It wouldn't be difficult to combine a way to pass string or integer, but it's not a 2-liner.
It's good, I'm going to read the color from a text file, so they will be all strings.
lansing is offline   Reply With Quote
Old 24th June 2018, 18:43   #3074  |  Link
ChaosKing
Registered User
 
Join Date: Dec 2005
Location: Germany
Posts: 1,795
Is there a Despot script or plugin available for VS?

I tried this avs script by Didée http://forum.doom9.net/showthread.ph...90#post1402690
which works good, but has problems with heavy motion / flashy scenes and produces sometimes ghosting. The two first problems can be compensated to some degree if used as a prefilter in smdegrain, but the ghosting problem remains.

Maybe someone knows an alternative or can improve this script?


Code:
def despot(o):
	osup = o.mv.Super(pel=2, sharp=2)
	bv1  = osup.mv.Analyse(isb=True, delta=1, blksize=8, overlap=4, search=4)
	fv1  = osup.mv.Analyse(isb=False,delta=1, blksize=8, overlap=4, search=4)
	bc1  = o.mv.Compensate(osup, bv1)
	fc1  = o.mv.Compensate(osup, fv1)
	
	clip = core.std.Interleave([fc1, o, bc1])
	clip = core.rgvs.Clense(clip)
	clip = core.std.SelectEvery(clip, cycle=3, offsets=1)
	
	return clip
__________________
AVSRepoGUI // VSRepoGUI - Package Manager for AviSynth // VapourSynth
VapourSynth Portable FATPACK || VapourSynth Database
ChaosKing is offline   Reply With Quote
Old 29th June 2018, 13:13   #3075  |  Link
unix
Registered User
 
Join Date: Aug 2015
Posts: 47
is there a "histogram" filter for VapourSynth?
unix is offline   Reply With Quote
Old 29th June 2018, 13:44   #3076  |  Link
Wolfberry
Helenium(Easter)
 
Wolfberry's Avatar
 
Join Date: Aug 2017
Location: Hsinchu, Taiwan
Posts: 99
Plugin List
Histogram
Next time check the list before asking.
Wolfberry is offline   Reply With Quote
Old 30th June 2018, 18:17   #3077  |  Link
lansing
Registered User
 
Join Date: Sep 2006
Posts: 1,657
Reporting a bug cropping a rgb32 clip.

Code:
rgb_clip = core.resize.Bicubic(clip, matrix_in_s="709", format=vs.COMPATBGR32)
rgb_clip = core.std.Crop(rgb_clip , bottom=50)
This will crop 50 from the top instead of the bottom. It works fine in YUV clips.
lansing is offline   Reply With Quote
Old 30th June 2018, 18:51   #3078  |  Link
LigH
German doom9/Gleitz SuMo
 
LigH's Avatar
 
Join Date: Oct 2001
Location: Germany, rural Altmark
Posts: 6,753
I remember there are top-down DIBs and bottom-up DIBs; maybe the COMPAT format is a factor here?
__________________

New German Gleitz board
MediaFire: x264 | x265 | VPx | AOM | Xvid
LigH is offline   Reply With Quote
Old 30th June 2018, 22:14   #3079  |  Link
foxyshadis
ангел смерти
 
foxyshadis's Avatar
 
Join Date: Nov 2004
Location: Lost
Posts: 9,558
Quote:
Originally Posted by LigH View Post
I remember there are top-down DIBs and bottom-up DIBs; maybe the COMPAT format is a factor here?
Exactly. I think it's a legit bug, but DIB (COMPATRGB) should be converted away from as quickly as possible unless intending to display on a generic Windows control. Don't use DIB is a solid rule of thumb.
foxyshadis is offline   Reply With Quote
Old 6th July 2018, 18:05   #3080  |  Link
unix
Registered User
 
Join Date: Aug 2015
Posts: 47
Hi!
guys I used InsertSign func but I didn't get the result properly!
Quote:
import fvsfunc as fvf
v = core.ffms2.Source("ْX.mkv")
fx1 = core.ffms2.Source("AFX.avi")
v = fvf.InsertSign(v, fx1, 3895,4063)
final = v.set_output()
link: https://imgur.com/a/TFz2Hms
unix is offline   Reply With Quote
Reply

Tags
speed, vaporware, vapoursynth

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


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