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 11th September 2016, 00:31   #2241  |  Link
trip_let
Registered User
 
Join Date: Sep 2012
Posts: 47
Quote:
Originally Posted by Selur View Post
@trip_let: simply add ?black? borders to both the logo and the alpha channel? does that make sense?
Erm, not sure how Overlay works. Never used it.

You may want to use the mask parameter, specifying that you're allowing a change in the part where you're putting the logo (area where the mask is white), and not allowing a change elsewhere (area where the mask is black).

# black clip the size of logo
mask = core.std.BlankClip(logo)
# now change to white
mask = core.std.Invert(mask)
# add black borders to right and bottom of the area (apply logo to upper-left)
mask = core.std.AddBorders(mask, right=clip.width-logo.width, bottom=clip.height-logo.height)

warning: didn't test; am not a regular user of these functions and not that familiar with VS


Or I guess if you max out the alpha in the logo for the garbage/padding, it would be 100% transparent and not change the picture there. That's probably easier, actually.
trip_let is offline   Reply With Quote
Old 11th September 2016, 06:49   #2242  |  Link
Selur
Registered User
 
Selur's Avatar
 
Join Date: Oct 2001
Location: Germany
Posts: 7,277
@HolyWu: as I understood it alphy=True returns two clips, don't I need to take both?
Code:
[logo, alpha] = core.imwrif.Read(filename="F:/TestClips&Co/background.png", alpha=True)
-> okay forget that just understood the [0] and [1] part

tried:
Code:
# Imports
import sys
import os
import vapoursynth as vs
core = vs.get_core()
# Import Scripts Folder
scriptPath = 'G:/Hybrid/vsscripts'
sys.path.append(os.path.abspath(scriptPath))
# Import havsfunc
import havsfunc as havsfunc
# Loading Plugins
core.std.LoadPlugin(path="G:/Hybrid/Vapoursynth/vapoursynth64/plugins/SourceFilter/Imagemagick/libimwri.dll")
core.std.LoadPlugin(path="G:/Hybrid/Vapoursynth/vapoursynth64/plugins/SourceFilter/LSmashSource/vslsmashsource.dll")
core.std.LoadPlugin(path="G:/Hybrid/Vapoursynth/vapoursynth64/plugins/Support/fmtconv.dll")
# Loading F:\TestClips&Co\test.avi using LWLibavSource
clip = core.lsmas.LWLibavSource(source="F:/TestClips&Co/test.avi", cache=0)
# adding 'F:\TestClips&Co\background.png' using Overlay
[logo, alpha] = core.imwrif.Read(filename="F:/TestClips&Co/background.png", alpha=True)
logo = core.resize.Bicubic(clip=logo, format=clip.format.id, matrix_s="709")
alpha = core.fmtc.bitdepth(clip=alpha, bits=clip.format.bits_per_sample)
clip=havsfunc.Overlay(clipa=clip, clipb=logo, mask=alpha)
# Output
clip.set_output()
but that still ignored the alpha (background all black)
__________________
Hybrid here in the forum, homepage

Last edited by Selur; 11th September 2016 at 07:02.
Selur is offline   Reply With Quote
Old 11th September 2016, 08:34   #2243  |  Link
Selur
Registered User
 
Selur's Avatar
 
Join Date: Oct 2001
Location: Germany
Posts: 7,277
]Here's the png I used.

Cu Selur
__________________
Hybrid here in the forum, homepage

Last edited by Selur; 11th September 2016 at 13:04.
Selur is offline   Reply With Quote
Old 11th September 2016, 10:19   #2244  |  Link
Selur
Registered User
 
Selur's Avatar
 
Join Date: Oct 2001
Location: Germany
Posts: 7,277
Thanks! That works!
Positioning and only showing the logo for a short time works fine too:
Code:
# Imports
import sys
import os
import vapoursynth as vs
core = vs.get_core()
# Import Scripts Folder
scriptPath = 'G:/Hybrid/vsscripts'
sys.path.append(os.path.abspath(scriptPath))
# Import havsfunc
import havsfunc as havsfunc
# Loading Plugins
core.std.LoadPlugin(path="G:/Hybrid/Vapoursynth/vapoursynth64/plugins/SourceFilter/Imagemagick/libimwri.dll")
core.std.LoadPlugin(path="G:/Hybrid/Vapoursynth/vapoursynth64/plugins/Support/fmtconv.dll")
core.std.LoadPlugin(path="G:/Hybrid/Vapoursynth/vapoursynth64/plugins/SourceFilter/LSmashSource/vslsmashsource.dll")
# Loading F:\TestClips&Co\test.avi using LWLibavSource
clip = core.lsmas.LWLibavSource(source="F:/TestClips&Co/test.avi", cache=0)
# adding 'F:\TestClips&Co\background.png' using Overlay
[logo, alpha] = core.imwrif.Read(filename="F:/TestClips&Co/background.png", alpha=True)
logo = core.resize.Bicubic(clip=logo, format=clip.format.id, matrix_s="709")
alpha = core.fmtc.bitdepth(clip=alpha, bits=clip.format.bits_per_sample, fulld=True).std.Invert()
beforeLogo = core.std.Trim(clip,last=49)
selection = core.std.Trim(clip,first=50,last=100)
afterLogo = core.std.Trim(clip,first=101)
selection = havsfunc.Overlay(clipa=selection, clipb=logo, mask=alpha, x=20, y=40)
clip = beforeLogo + selection + afterLogo
# Output
clip.set_output()
-> Next question: How to fade the logo in and out over x frames?

Cu Selur
__________________
Hybrid here in the forum, homepage

Last edited by Selur; 11th September 2016 at 11:47.
Selur is offline   Reply With Quote
Old 12th September 2016, 20:42   #2245  |  Link
splinter98
Registered User
 
Join Date: Oct 2010
Posts: 36
Quote:
Originally Posted by Selur View Post
-> Next question: How to fade the logo in and out over x frames?
Try my crossfade function from: http://forum.doom9.org/showthread.ph...34#post1755234
splinter98 is offline   Reply With Quote
Old 12th September 2016, 20:44   #2246  |  Link
Selur
Registered User
 
Selur's Avatar
 
Join Date: Oct 2001
Location: Germany
Posts: 7,277
Will do Thanks!
__________________
Hybrid here in the forum, homepage
Selur is offline   Reply With Quote
Old 13th September 2016, 11:37   #2247  |  Link
aculnaig
Registered User
 
Join Date: May 2016
Posts: 7
Can't build VapourSynth

Can't build vapoursynth ( gcc (GCC) 6.2.1 20160830 )

VapourSynth ( latest git )
Code:
git describe --tags
R33.1-18-gf65402b
zimg ( latest git )
Code:
git describe --tags
release-2.2.1-13-g1855661

Errors
Code:
src/core/vsresize.cpp:33:2: error: #error zAPI v2 or greater required
 #error zAPI v2 or greater required
  ^~~~~


src/core/vsresize.cpp:121:23: error: ‘ZIMG_TRANSFER_ST2084’ was not declared in this scope
         { "st2084",   ZIMG_TRANSFER_ST2084 },
                       ^~~~~~~~~~~~~~~~~~~~
src/core/vsresize.cpp:122:23: error: ‘ZIMG_TRANSFER_ARIB_B67’ was not declared in this scope
         { "std-b67",  ZIMG_TRANSFER_ARIB_B67 },
                       ^~~~~~~~~~~~~~~~~~~~~~
src/core/vsresize.cpp:123:5: error: no matching function for call to ‘std::unordered_map<std::__cxx11::basic_string<char>, zimg_transfer_characteristics_e>::unordered_map(<brace-enclosed initializer list>)’
     };

src/core/vsresize.cpp:760:26: error: ‘struct vszimgxx::zfilter_graph_builder_params’ has no member named ‘nominal_peak_luminance’
                 m_params.nominal_peak_luminance = propGetScalarDef<double>(in, "nominal_luminance", NAN, vsapi);

Last edited by aculnaig; 13th September 2016 at 11:40.
aculnaig is offline   Reply With Quote
Old 13th September 2016, 11:38   #2248  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,555
You need to use the hdr branch of zimg to build it.
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik is offline   Reply With Quote
Old 13th September 2016, 12:26   #2249  |  Link
aculnaig
Registered User
 
Join Date: May 2016
Posts: 7
Thanks, It worked.
aculnaig is offline   Reply With Quote
Old 13th September 2016, 13:15   #2250  |  Link
Sm3n
Registered User
 
Join Date: Jul 2012
Posts: 94
Hello,

can you tell me if my guesses are true. Can I compile zimg on debian?
if yes why can't I compile it? Not sure I actualy can.
System: Debian wheezy x64

Here is my error code: http://paste2.org/tgXKhezc

cheers in advance
Sm3n is offline   Reply With Quote
Old 13th September 2016, 13:49   #2251  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,555
Quote:
Originally Posted by Sm3n View Post
Hello,

can you tell me if my guesses are true. Can I compile zimg on debian?
if yes why can't I compile it? Not sure I actualy can.
System: Debian wheezy x64

Here is my error code: http://paste2.org/tgXKhezc

cheers in advance
You compiler is too old.
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik is offline   Reply With Quote
Old 14th September 2016, 22:03   #2252  |  Link
Sm3n
Registered User
 
Join Date: Jul 2012
Posts: 94
OK. And do you think I can upgrade it? I'm not very confortable with debian - that's why I ask but I can manage it eventualy.
I'm trying to look for it right now...
Sm3n is offline   Reply With Quote
Old 14th September 2016, 23:06   #2253  |  Link
Are_
Registered User
 
Join Date: Jun 2012
Location: Ibiza, Spain
Posts: 321
Quote:
Originally Posted by Sm3n View Post
OK. And do you think I can upgrade it? I'm not very confortable with debian - that's why I ask but I can manage it eventualy.
I'm trying to look for it right now...
https://linuxconfig.org/how-to-upgra...stable-release
Are_ is offline   Reply With Quote
Old 15th September 2016, 10:13   #2254  |  Link
Sm3n
Registered User
 
Join Date: Jul 2012
Posts: 94
Thx a lot.
Sm3n is offline   Reply With Quote
Old 17th September 2016, 20:20   #2255  |  Link
Selur
Registered User
 
Selur's Avatar
 
Join Date: Oct 2001
Location: Germany
Posts: 7,277
I'm trying to get Vapoursynth working on mac, using:
Code:
# Imports
import vapoursynth as vs
core = vs.get_core()
# Loading Plugins
core.std.LoadPlugin(path="/Users/selur/build-Hybrid-Desktop-Release/Hybrid.app/Contents/MacOS/vsfilters/SourceFilter/FFMS2/ffms2.dylib")
# Loading /Users/selur/Desktop/公演后感言.mp4 using FFMS2
clip = core.ffms2.Source(source="/Users/selur/Desktop/公演后感言.mp4",cachefile="/Users/selur/Desktop/temp/mp4_d59244d4d4de113a5823257ae88125fc_16807.ffindex")
# Output
clip.set_output()
I get:
Code:
Failed to evaluate the script:
Python exception: Failed to load /Users/selur/build-Hybrid-Desktop-Release/Hybrid.app/Contents/MacOS/vsfilters/SourceFilter/FFMS2/ffms2.dylib. Error given: dlopen(/Users/selur/build-Hybrid-Desktop-Release/Hybrid.app/Contents/MacOS/vsfilters/SourceFilter/FFMS2/ffms2.dylib, 1): image not found
Traceback (most recent call last):
  File "src/cython/vapoursynth.pyx", line 1491, in vapoursynth.vpy_evaluateScript (src/cython/vapoursynth.c:26897)
  File "/Users/selur/Desktop/temp/tempPreviewVapoursynthFile21_04_39_802.vpy", line 5, in <module>
    core.std.LoadPlugin(path="/Users/selur/build-Hybrid-Desktop-Release/Hybrid.app/Contents/MacOS/vsfilters/SourceFilter/FFMS2/ffms2.dylib")
  File "src/cython/vapoursynth.pyx", line 1383, in vapoursynth.Function.__call__ (src/cython/vapoursynth.c:25204)
vapoursynth.Error: Failed to load /Users/selur/build-Hybrid-Desktop-Release/Hybrid.app/Contents/MacOS/vsfilters/SourceFilter/FFMS2/ffms2.dylib. Error given: dlopen(/Users/selur/build-Hybrid-Desktop-Release/Hybrid.app/Contents/MacOS/vsfilters/SourceFilter/FFMS2/ffms2.dylib, 1): image not found
Do I need to load the filter in another way ?
(I'm on mac osx, vapoursynth was installed using homebrew, ffms2 was separately compiled and copied to '/Users/selur/build-Hybrid-Desktop-Release/Hybrid.app/Contents/MacOS/vsfilters/SourceFilter/FFMS2/ffms2.dylib' )
__________________
Hybrid here in the forum, homepage
Selur is offline   Reply With Quote
Old 17th September 2016, 20:55   #2256  |  Link
kolak
Registered User
 
Join Date: Nov 2004
Location: Poland
Posts: 2,843
Use L-SMASH Source- I found it more reliable than ffms2, which is far from being perfect.
kolak is offline   Reply With Quote
Old 17th September 2016, 20:59   #2257  |  Link
Selur
Registered User
 
Selur's Avatar
 
Join Date: Oct 2001
Location: Germany
Posts: 7,277
haven't figured out to compile l-smash on mac and I'm not sure if I the loading script is correct,...
__________________
Hybrid here in the forum, homepage
Selur is offline   Reply With Quote
Old 17th September 2016, 21:49   #2258  |  Link
jackoneill
unsigned int
 
jackoneill's Avatar
 
Join Date: Oct 2012
Location: 🇪🇺
Posts: 760
Quote:
Originally Posted by Selur View Post
Do I need to load the filter in another way ?
(I'm on mac osx, vapoursynth was installed using homebrew, ffms2 was separately compiled and copied to '/Users/selur/build-Hybrid-Desktop-Release/Hybrid.app/Contents/MacOS/vsfilters/SourceFilter/FFMS2/ffms2.dylib' )
Are you sure you have the right file name? Are you sure that file is a library?
__________________
Buy me a "coffee" and/or hire me to write code!
jackoneill is offline   Reply With Quote
Old 17th September 2016, 22:48   #2259  |  Link
kolak
Registered User
 
Join Date: Nov 2004
Location: Poland
Posts: 2,843
Quote:
Originally Posted by Selur View Post
haven't figured out to compile l-smash on mac and I'm not sure if I the loading script is correct,...
Vapoursynth OSX installer has it. You can find post about it in vs section.
kolak is offline   Reply With Quote
Old 18th September 2016, 05:28   #2260  |  Link
Selur
Registered User
 
Selur's Avatar
 
Join Date: Oct 2001
Location: Germany
Posts: 7,277
Quote:
Are you sure you have the right file name? Are you sure that file is a library?
Ahhh it was a typo. Now I get a 'Video codec not found', but that is probably due to some mistake during the ffms2 compilation. (forgot the ffmpeg libs) Thanks totally didn't see the typo yesterday.
Quote:
Vapoursynth OSX installer has it. You can find post about it in vs section.
Problem with that is that it interferes with the vapoursynth version I installed through homebrew to be able to compile my own vsedit version (contains some limited ipc capabilities).
+ There doesn't seem to be a way to uninstall it and it's r33 not r33.1
__________________
Hybrid here in the forum, homepage

Last edited by Selur; 18th September 2016 at 06:47.
Selur 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 21:16.


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