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 25th May 2015, 10:41   #161  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,548
I approve of this insanity. My idea for solving the reading (not tested but works in theory):

Code:
import vapoursynth as vs

c = vs.get_core()

src = c.ffms2.Source("rule6.avi")

superclip = c.mv.Super(src)
analysis = c.mv.Analyse(superclip, delta=1, isb=True)

vf = open("/stored/vectors.bin")
vector_width = analysis.get_frame(0).width
vector_template_clip = c.std.BlankClip(analysis, height=1, width=vector_width)

def vector_read(n, f):
  vf.seek(n * f.width)
  vector_data = vf.read(f.width)
  fout = f.copy()
  view = fout.get_write_array(0)
  for x in range(fout.width):
    view[0,x] = vector_data[x]
  return fout

vector_clip = c.std.ModifyFrame(clip=vector_template_clip, clips=vector_template_clip, selector=vector_read)
vector_clip.set_output()
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet

Last edited by Myrsloik; 25th May 2015 at 21:53. Reason: now with tested solution
Myrsloik is offline   Reply With Quote
Old 25th May 2015, 11:00   #162  |  Link
feisty2
I'm Siri
 
feisty2's Avatar
 
Join Date: Oct 2012
Location: void
Posts: 2,633
@MonoS
gonna try to do it myself, but will let u know if I failed
feisty2 is offline   Reply With Quote
Old 25th May 2015, 15:07   #163  |  Link
feisty2
I'm Siri
 
feisty2's Avatar
 
Join Date: Oct 2012
Location: void
Posts: 2,633

the writing part worked, the reading part popped out an error when I tried to preview it, soon after the error, vaporsynth crashed
feisty2 is offline   Reply With Quote
Old 25th May 2015, 15:09   #164  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,548
line 16 should be:
view = fout.get_write_array(0)
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik is offline   Reply With Quote
Old 25th May 2015, 15:18   #165  |  Link
feisty2
I'm Siri
 
feisty2's Avatar
 
Join Date: Oct 2012
Location: void
Posts: 2,633
still error, now it's
"Error getting the frame number 0:
Object is not writable."
feisty2 is offline   Reply With Quote
Old 25th May 2015, 15:31   #166  |  Link
MonoS
Registered User
 
Join Date: Aug 2012
Posts: 203
I humbly suggest to add an extra parameter to vector_read for selecting which file to read from.
Something like
Code:
vecFile = "/tmp/vectors.bin"
def vector_read(n, f, file):
    vf= open("file", "rb")
    vf.seek(n * f.width)
    # etc...

    return fout

vector_clip = core.std.ModifyFrame(clip=vector_template_clip, clips=vector_template_clip, selector=functools.partial(vector_read, file=vecFile)
MonoS is offline   Reply With Quote
Old 25th May 2015, 15:40   #167  |  Link
feisty2
I'm Siri
 
feisty2's Avatar
 
Join Date: Oct 2012
Location: void
Posts: 2,633
yeah, uh, organizing kinda stuff like this can wait I guess, right now, I can't get it to work, I got "Object is not writable" error
feisty2 is offline   Reply With Quote
Old 25th May 2015, 21:57   #168  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,548
I updated my previous post with a fixed script.

It's basically how you write a raw source filter using only python. Actually you probably could replace most of this with chikuzen's raw source...
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik is offline   Reply With Quote
Old 26th May 2015, 07:25   #169  |  Link
feisty2
I'm Siri
 
feisty2's Avatar
 
Join Date: Oct 2012
Location: void
Posts: 2,633
so I decide to take the easiest way

simply this works
Code:
vw = vec.get_frame(0).width
vecr=core.raws.Source(r"D:\test\vectors.bin", vw, 1, src_fmt="Y8")
vecr.set_output()
edit: replaced "vw" with a log file, no need to create a template anymore now
writing part
vw = vec.get_frame(0).width
log = open(r"D:\test\log.txt", "w").write (repr (vw))
reading part
w=int (open(r"D:\test\log.txt", "r").read ())
vecr=core.raws.Source(r"D:\test\vectors.bin", w, 1, src_fmt="Y8")
vecr.set_output()

Last edited by feisty2; 26th May 2015 at 08:30.
feisty2 is offline   Reply With Quote
Old 26th May 2015, 09:35   #170  |  Link
MonoS
Registered User
 
Join Date: Aug 2012
Posts: 203
Every time i create the vector file with the same parameters and clip i get a different md5, is this to be expected??
MonoS is offline   Reply With Quote
Old 26th May 2015, 09:51   #171  |  Link
feisty2
I'm Siri
 
feisty2's Avatar
 
Join Date: Oct 2012
Location: void
Posts: 2,633
Quote:
Originally Posted by MonoS View Post
Every time i create the vector file with the same parameters and clip i get a different md5, is this to be expected??
guess ur source filter is the one to blame here, not mvtools, I remember Myrsloik said something like "Don't expect FFMPEG to be bit exact" or whatever similar.
feisty2 is offline   Reply With Quote
Old 26th May 2015, 09:54   #172  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,548
Quote:
Originally Posted by MonoS View Post
Every time i create the vector file with the same parameters and clip i get a different md5, is this to be expected??
The answer is mostly not but with a bit of yes. Some formats can have +-1 differences due to rounding I think. Try it with something lossless like utvideo or huffyuv as input and see if it's still different.
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik is offline   Reply With Quote
Old 26th May 2015, 10:48   #173  |  Link
jackoneill
unsigned int
 
jackoneill's Avatar
 
Join Date: Oct 2012
Location: 🇪🇺
Posts: 760
Quote:
Originally Posted by MonoS View Post
Every time i create the vector file with the same parameters and clip i get a different md5, is this to be expected??
Compare the contents.

Edit: Nevermind. I think it's just a little unused memory that never gets initialised.
__________________
Buy me a "coffee" and/or hire me to write code!

Last edited by jackoneill; 26th May 2015 at 11:15.
jackoneill is offline   Reply With Quote
Old 29th May 2015, 16:33   #174  |  Link
feisty2
I'm Siri
 
feisty2's Avatar
 
Join Date: Oct 2012
Location: void
Posts: 2,633
Do "thsad" and "thscd1/2" have a varying range related to bit depth like "limit" in mv.degrain or they stay in some fixed certain range (always "400" as default whatever input depth is) ?

Last edited by feisty2; 29th May 2015 at 16:44.
feisty2 is offline   Reply With Quote
Old 29th May 2015, 17:00   #175  |  Link
jackoneill
unsigned int
 
jackoneill's Avatar
 
Join Date: Oct 2012
Location: 🇪🇺
Posts: 760
Quote:
Originally Posted by feisty2 View Post
Do "thsad" and "thscd1/2" have a varying range related to bit depth like "limit" in mv.degrain or they stay in some fixed certain range (always "400" as default whatever input depth is) ?
The ranges for thsad and thscdX do not vary with the bit depth. They are scaled internally as needed.
__________________
Buy me a "coffee" and/or hire me to write code!
jackoneill is offline   Reply With Quote
Old 30th May 2015, 00:49   #176  |  Link
foxyshadis
ангел смерти
 
foxyshadis's Avatar
 
Join Date: Nov 2004
Location: Lost
Posts: 9,558
Quote:
Originally Posted by jackoneill View Post
The ranges for thsad and thscdX do not vary with the bit depth. They are scaled internally as needed.
I'm convinced this is the proper mode of operations for all filters, which should take fractional values instead of requiring the user to know what bit depth they're in anytime a filter is called. I'm glad havs does the heavy lifting for the filters that don't scale input. (Although it's going to have to be done all over again for anything that wants 0...1.0 in float. rean has the right idea there.)
foxyshadis is offline   Reply With Quote
Old 16th June 2015, 14:00   #177  |  Link
feisty2
I'm Siri
 
feisty2's Avatar
 
Join Date: Oct 2012
Location: void
Posts: 2,633
any plan to get mvtools to work on float point clips?
feisty2 is offline   Reply With Quote
Old 16th June 2015, 14:34   #178  |  Link
jackoneill
unsigned int
 
jackoneill's Avatar
 
Join Date: Oct 2012
Location: 🇪🇺
Posts: 760
Quote:
Originally Posted by feisty2 View Post
any plan to get mvtools to work on float point clips?
No.    
__________________
Buy me a "coffee" and/or hire me to write code!
jackoneill is offline   Reply With Quote
Old 17th June 2015, 05:42   #179  |  Link
feisty2
I'm Siri
 
feisty2's Avatar
 
Join Date: Oct 2012
Location: void
Posts: 2,633
Quote:
Originally Posted by jackoneill View Post
No.    
okay then, how do I make all this work, like how, should I modify the cpp code to add support for float point clips? a short and simple guide like that "python removegrain19", can I ask for one plz?
I been running from C/CPP like, forever, cuz they are obscure and simply look like machine code to me, and I've always favored stuff easier like python or that "home grown avisynth language"
but that's officially over now, guess it's just, well, time to face the devil finally.
feisty2 is offline   Reply With Quote
Old 17th June 2015, 07:30   #180  |  Link
jackoneill
unsigned int
 
jackoneill's Avatar
 
Join Date: Oct 2012
Location: 🇪🇺
Posts: 760
Quote:
Originally Posted by feisty2 View Post
okay then, how do I make all this work, like how, should I modify the cpp code to add support for float point clips? a short and simple guide like that "python removegrain19", can I ask for one plz?
I been running from C/CPP like, forever, cuz they are obscure and simply look like machine code to me, and I've always favored stuff easier like python or that "home grown avisynth language"
but that's officially over now, guess it's just, well, time to face the devil finally.
Convert your float clips to integer.
__________________
Buy me a "coffee" and/or hire me to write code!
jackoneill 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 03:31.


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