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, 09:35   #161  |  Link
jackoneill
unsigned int
 
jackoneill's Avatar
 
Join Date: Oct 2012
Location: 🇪🇺
Posts: 740
Quote:
Originally Posted by MonoS View Post
and for reading?? if all the frames have different width there should be a frameLen in the file, also i don't see any function for creating varying dimension clip for then writing to it
I don't think the width varies in a clip. The output of Analyse has unknown dimensions simply because they are not known until a frame is returned, not because they could change from one frame to the next. Anyway, I'll leave all that as exercises for the reader.
__________________
Buy me a "coffee" and/or hire me to write code!
jackoneill is offline   Reply With Quote
Old 25th May 2015, 10:20   #162  |  Link
MonoS
Registered User
 
Join Date: Aug 2012
Posts: 183
Then it should be a trivial task to do via scripting.
i'll try to.implemebt as soon as i return home.

@feisty2: i return home at about 15 utc, if you expect to write it yourself let me know so we don't write it twice
MonoS is offline   Reply With Quote
Old 25th May 2015, 10:41   #163  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Ikea Chair
Posts: 2,216
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   #164  |  Link
feisty2
I'm Siri
 
feisty2's Avatar
 
Join Date: Oct 2012
Location: Providence, RI
Posts: 2,360
@MonoS
gonna try to do it myself, but will let u know if I failed
__________________
If I got new ideas, will post here: https://github.com/IFeelBloated
feisty2 is online now   Reply With Quote
Old 25th May 2015, 15:07   #165  |  Link
feisty2
I'm Siri
 
feisty2's Avatar
 
Join Date: Oct 2012
Location: Providence, RI
Posts: 2,360

the writing part worked, the reading part popped out an error when I tried to preview it, soon after the error, vaporsynth crashed
__________________
If I got new ideas, will post here: https://github.com/IFeelBloated
feisty2 is online now   Reply With Quote
Old 25th May 2015, 15:09   #166  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Ikea Chair
Posts: 2,216
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   #167  |  Link
feisty2
I'm Siri
 
feisty2's Avatar
 
Join Date: Oct 2012
Location: Providence, RI
Posts: 2,360
still error, now it's
"Error getting the frame number 0:
Object is not writable."
__________________
If I got new ideas, will post here: https://github.com/IFeelBloated
feisty2 is online now   Reply With Quote
Old 25th May 2015, 15:31   #168  |  Link
MonoS
Registered User
 
Join Date: Aug 2012
Posts: 183
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   #169  |  Link
feisty2
I'm Siri
 
feisty2's Avatar
 
Join Date: Oct 2012
Location: Providence, RI
Posts: 2,360
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
__________________
If I got new ideas, will post here: https://github.com/IFeelBloated
feisty2 is online now   Reply With Quote
Old 25th May 2015, 21:57   #170  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Ikea Chair
Posts: 2,216
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   #171  |  Link
feisty2
I'm Siri
 
feisty2's Avatar
 
Join Date: Oct 2012
Location: Providence, RI
Posts: 2,360
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()
__________________
If I got new ideas, will post here: https://github.com/IFeelBloated

Last edited by feisty2; 26th May 2015 at 08:30.
feisty2 is online now   Reply With Quote
Old 26th May 2015, 09:35   #172  |  Link
MonoS
Registered User
 
Join Date: Aug 2012
Posts: 183
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   #173  |  Link
feisty2
I'm Siri
 
feisty2's Avatar
 
Join Date: Oct 2012
Location: Providence, RI
Posts: 2,360
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.
__________________
If I got new ideas, will post here: https://github.com/IFeelBloated
feisty2 is online now   Reply With Quote
Old 26th May 2015, 09:54   #174  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Ikea Chair
Posts: 2,216
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   #175  |  Link
jackoneill
unsigned int
 
jackoneill's Avatar
 
Join Date: Oct 2012
Location: 🇪🇺
Posts: 740
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   #176  |  Link
feisty2
I'm Siri
 
feisty2's Avatar
 
Join Date: Oct 2012
Location: Providence, RI
Posts: 2,360
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) ?
__________________
If I got new ideas, will post here: https://github.com/IFeelBloated

Last edited by feisty2; 29th May 2015 at 16:44.
feisty2 is online now   Reply With Quote
Old 29th May 2015, 17:00   #177  |  Link
jackoneill
unsigned int
 
jackoneill's Avatar
 
Join Date: Oct 2012
Location: 🇪🇺
Posts: 740
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   #178  |  Link
foxyshadis
ангел смерти
 
foxyshadis's Avatar
 
Join Date: Nov 2004
Location: Lost
Posts: 9,509
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.)
__________________
There are four boxes to be used in defense of liberty: soap, ballot, jury, and ammo. Please use in that order.
foxyshadis is offline   Reply With Quote
Old 16th June 2015, 14:00   #179  |  Link
feisty2
I'm Siri
 
feisty2's Avatar
 
Join Date: Oct 2012
Location: Providence, RI
Posts: 2,360
any plan to get mvtools to work on float point clips?
__________________
If I got new ideas, will post here: https://github.com/IFeelBloated
feisty2 is online now   Reply With Quote
Old 16th June 2015, 14:34   #180  |  Link
jackoneill
unsigned int
 
jackoneill's Avatar
 
Join Date: Oct 2012
Location: 🇪🇺
Posts: 740
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
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 04:08.


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