-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGESClipEffectSample.py
More file actions
62 lines (45 loc) · 1.64 KB
/
GESClipEffectSample.py
File metadata and controls
62 lines (45 loc) · 1.64 KB
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
from gi.repository import Gtk
from gi.repository import GES
from gi.repository import Gst
from gi.repository import GObject
import signal
video_path = "/home/cfoch/Videos/samples/big_buck_bunny_1080p_stereo.ogg"
def handle_sigint(sig, frame):
print "Bye!"
Gtk.main_quit()
def busMessageCb(unused_bus, message):
if message.type == Gst.MessageType.EOS:
print "EOS: The End"
Gtk.main_quit()
def duration_querier(pipeline):
print pipeline.query_position(Gst.Format.TIME)
return True
if __name__ == "__main__":
GObject.threads_init()
Gst.init(None)
GES.init()
video_uri = "file://" + video_path
timeline = GES.Timeline.new_audio_video()
layer = timeline.append_layer()
asset_video = GES.UriClipAsset.request_sync(video_uri)
clip_video = layer.add_asset(asset_video, 0, 0, asset_video.get_duration(), GES.TrackType.UNKNOWN)
clip_effect = GES.EffectClip.new(
video_bin_description="videobalance saturation=1.5 hue=+0.5",
audio_bin_description="audiopanorama panorama=1.0")
#The effect starts after 3 seconds
clip_effect.set_start(Gst.SECOND * 3)
clip_effect.set_inpoint(0)
clip_effect.set_duration(asset_video.get_duration())
clip_video.set_priority(0)
clip_video.set_priority(1)
layer.add_clip(clip_effect)
timeline.commit()
pipeline = GES.Pipeline()
pipeline.set_timeline(timeline)
pipeline.set_state(Gst.State.PLAYING)
bus = pipeline.get_bus()
bus.add_signal_watch()
bus.connect("message", busMessageCb)
GObject.timeout_add(300, duration_querier, pipeline)
signal.signal(signal.SIGINT, handle_sigint)
Gtk.main()