File: OpenShot%20Wipe%20Tests.py

package info (click to toggle)
libopenshot 0.3.3%2Bdfsg1-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 29,264 kB
  • sloc: cpp: 26,779; python: 92; makefile: 21; ruby: 5; sh: 2
file content (48 lines) | stat: -rw-r--r-- 1,114 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# © OpenShot Studios, LLC
#
# SPDX-License-Identifier: LGPL-3.0-or-later

import openshot

# Create an empty timeline
t = openshot.Timeline(720, 480, openshot.Fraction(24,1), 44100, 2, openshot.LAYOUT_STEREO)
t.Open()

# lower layer
lower = openshot.QtImageReader("back.png")
c1 = openshot.Clip(lower)
c1.Layer(1)
t.AddClip(c1)

# higher layer
higher = openshot.QtImageReader("front3.png")
c2 = openshot.Clip(higher)
c2.Layer(2)
#c2.alpha = openshot.Keyframe(0.5)
t.AddClip(c2)

# Wipe / Transition
brightness = openshot.Keyframe()
brightness.AddPoint(1, 1.0, openshot.BEZIER)
brightness.AddPoint(24, -1.0, openshot.BEZIER)

contrast = openshot.Keyframe()
contrast.AddPoint(1, 20.0, openshot.BEZIER)
contrast.AddPoint(24, 20.0, openshot.BEZIER)

reader = openshot.QtImageReader("mask.png")
e = openshot.Mask(reader, brightness, contrast)
e.Layer(2)
e.End(60)
t.AddEffect(e)

reader1 = openshot.QtImageReader("mask2.png")
e1 = openshot.Mask(reader1, brightness, contrast)
e1.Layer(2)
e1.Order(2)
e1.End(60)
#t.AddEffect(e1)

for n in range(1,25):
 print(n, end=" ", flush=1)
 t.GetFrame(n).Save("%s.png" % n, 1.0)