Log in

View Full Version : [solved] Apply a filter to only parts of a video?


unknownsoldierX
18th July 2011, 22:12
How do I go about applying a filter to only certain parts of a video?

Groucho2004
18th July 2011, 22:20
How do I go about applying a filter to only certain parts of a video?

You could use the "Trim" function.

vid = <yoursourcefilter> #let's assume it has 10000 frames and you want to apply the filter to frames 3000 - 5999

a = trim(0, 2999)
b = trim(3000, 5999)
c = trim(6000, 9999)

fb = yourfilter(b, ...)

return a + fb + c

unknownsoldierX
18th July 2011, 22:54
Ok. So I have a script made by MeGUI for a video that has 23010 frames. If I want to flip part of the video I can do this?

DirectShowSource("D:\test.avi", fps=29.970, audio=false, convertfps=true).AssumeFPS(30000,1001)

a = trim(0, 13318)
b = trim(13319, 23010)

fa = fliphorizontal(a, ...)


return fa + b

Or if I want to do filters to different parts, I can do this?

DirectShowSource("D:\test.avi", fps=29.970, audio=false, convertfps=true).AssumeFPS(30000,1001)

a = trim(0, 13318)
b = trim(13319, 15315)
c = trim(15316, 23010)

fa = fliphorizontal(a, ...)
fc = fliphorizontal(c, ...)

return fa + b +fc

edit: just tried the script in the first box and got a syntax error (line 6, column 24).

Groucho2004
18th July 2011, 23:12
It should be:

DirectShowSource("D:\test.avi", fps=29.970, audio=false, convertfps=true).AssumeFPS(30000,1001)

a = trim(0, 13318)
b = trim(13319, 15315)
c = trim(15316, 23010)

fa = fliphorizontal(a)
fc = fliphorizontal(c)

return fa + b + fc

unknownsoldierX
19th July 2011, 00:32
That works really well. Thank you!