Posts: 315
Threads: 33
Joined: 2017 Oct
Thanks: 73
Given 149 thank(s) in 86 post(s)
Country:
And then put those in the DeSub script?
Posts: 7,153
Threads: 601
Joined: 2015 Jan
Thanks: 1081
Given 1466 thank(s) in 963 post(s)
Country:
First you have to understand if the problem is in the file itself or in the script...
So, make a new .avs file, put the first code, load it in virtualdub; if it shows, it means no problems.
Same for second code.
If there is an error in first or second, you must find out what is the problem in the file.
Posts: 315
Threads: 33
Joined: 2017 Oct
Thanks: 73
Given 149 thank(s) in 86 post(s)
Country:
Thanks spoRv! VirtualDub is just hanging while trying to load the script. The problem must be in the first script.
Posts: 7,153
Threads: 601
Joined: 2015 Jan
Thanks: 1081
Given 1466 thank(s) in 963 post(s)
Country:
(2021-11-23, 06:33 AM)Serums Wrote: VirtualDub is just hanging while trying to load the script.
ffvideosource needs to write an index file first; depending on the clip lenght/size/complexity and your PC speed, it could take from few to many minutes to finish, so leave it alone (read: do not close virtualdub!); this is a one time process, so next time would take only few seconds to load it!
Posts: 315
Threads: 33
Joined: 2017 Oct
Thanks: 73
Given 149 thank(s) in 86 post(s)
Country:
2021-11-24, 02:13 AM
(This post was last modified: 2021-11-24, 02:17 AM by Serums.)
Thanks, spoRv!
I can load the individual scripts but VirtualDub still shows that the DeSub script doesn't have a video stream. The problem must be somewhat deeper.
Posts: 7,153
Threads: 601
Joined: 2015 Jan
Thanks: 1081
Given 1466 thank(s) in 963 post(s)
Country:
I checked the script, and it worked - but I swapped the clips with and without subs by mistake... by bad!
Now you have the revised version in the first post; as you can see, I added also that it works only with white subtitles.
To check if it works:
Code: nosubs=ffvideosource("F:\Desktop\Projects\old\ivtc.mkv")
# IF IT'S NOT WORKING, REPLACE IT WITH ANY OTHER FILE!!!
withsubs=nosubs.subtitle("SAMPLE SUBTITLE!", font="georgia", size=48, text_color=$ffffff, align=5)
# THIS ADDS SUBTITLES
stackhorizontal(withsubs,desubTEST(withsubs,nosubs))
# THIS TEST IF THE SCRIPTS DELETE SUBTITLES
function DeSubTEST (clip nosubs, clip withsubs) {
withsubs=withsubs.converttoyv24
nosubs=nosubs.converttoyv24
color=$ffffff
subs = withsubs.converttorgb
mask = ColorKeyMask(subs, color, 20)
blk = blankclip(length=withsubs.FrameCount,width=withsubs.width,height=withsubs.height)
over=Overlay(withsubs, blk, mask=mask.ShowAlpha, mode="blend", opacity=1)
mk=over.levels(235,1,255,1,255)
w=2
a=mk.addborders(0,0,w,w).crop(w,w,0,0)
b=mk.addborders(0,0,0,w).crop(0,w,0,0)
c=mk.addborders(w,0,0,w).crop(0,w,-w,0)
d=mk.addborders(w,0,0,0).crop(0,0,-w,0)
e=mk.addborders(w,w,0,0).crop(0,0,-w,-w)
f=mk.addborders(0,w,0,0).crop(0,0,0,-w)
g=mk.addborders(0,w,w,0).crop(w,0,0,-w)
h=mk.crop(w,0,0,0).addborders(0,0,w,0)
x= overlay(b, f, mode="add")
y= overlay(d, h, mode="add")
xx=overlay(a, e, mode="add")
yy=overlay(c, g, mode="add")
z= overlay(x, y, mode="add")
zz=overlay(xx,yy,mode="add")
nu=overlay(z,zz,mode="add")
mk=nu.levels(235,1,255,1,255)
w=3
a=mk.addborders(0,0,w,w).crop(w,w,0,0)
b=mk.addborders(0,0,0,w).crop(0,w,0,0)
c=mk.addborders(w,0,0,w).crop(0,w,-w,0)
d=mk.addborders(w,0,0,0).crop(0,0,-w,0)
e=mk.addborders(w,w,0,0).crop(0,0,-w,-w)
f=mk.addborders(0,w,0,0).crop(0,0,0,-w)
g=mk.addborders(0,w,w,0).crop(w,0,0,-w)
h=mk.crop(w,0,0,0).addborders(0,0,w,0)
x= overlay(b, f, mode="add")
y= overlay(d, h, mode="add")
xx=overlay(a, e, mode="add")
yy=overlay(c, g, mode="add")
z= overlay(x, y, mode="add")
zz=overlay(xx,yy,mode="add")
nu=overlay(z,zz,mode="add")
mk=nu.levels(235,1,255,1,255)
w=4
a=mk.addborders(0,0,w,w).crop(w,w,0,0)
b=mk.addborders(0,0,0,w).crop(0,w,0,0)
c=mk.addborders(w,0,0,w).crop(0,w,-w,0)
d=mk.addborders(w,0,0,0).crop(0,0,-w,0)
e=mk.addborders(w,w,0,0).crop(0,0,-w,-w)
f=mk.addborders(0,w,0,0).crop(0,0,0,-w)
g=mk.addborders(0,w,w,0).crop(w,0,0,-w)
h=mk.crop(w,0,0,0).addborders(0,0,w,0)
x= overlay(b, f, mode="add")
y= overlay(d, h, mode="add")
xx=overlay(a, e, mode="add")
yy=overlay(c, g, mode="add")
z= overlay(x, y, mode="add")
zz=overlay(xx,yy,mode="add")
nu=overlay(z,zz,mode="add").levels(235,1,255,1,255)
numask = ColorKeyMask(nu.ConvertToRGB32, color, 30)
Overlay(nosubs, withsubs, mask=numask.ShowAlpha, mode="blend", opacity=1)
converttoyv12
}
Posts: 315
Threads: 33
Joined: 2017 Oct
Thanks: 73
Given 149 thank(s) in 86 post(s)
Country:
2021-11-24, 03:35 AM
(This post was last modified: 2021-11-24, 04:49 AM by Serums.)
Thanks spoRv, I'll test it out!
Edit: I got the sample script to work. I can see the added subtitles in the first preview window of Virtualdub and I can see they've been deleted in the second.
Posts: 315
Threads: 33
Joined: 2017 Oct
Thanks: 73
Given 149 thank(s) in 86 post(s)
Country:
Hi spoRv,
Just an update on my end. Managed to get the script running using a different file. Though the frames didn't match up exactly so it didn't work out. Good to know that I can test it a bit more now.
|