-
Notifications
You must be signed in to change notification settings - Fork 360
Expand file tree
/
Copy pathplay.py
More file actions
executable file
·45 lines (34 loc) · 901 Bytes
/
play.py
File metadata and controls
executable file
·45 lines (34 loc) · 901 Bytes
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
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Import required modules
from __future__ import print_function
import mlt7 as mlt
import time
import sys
# Start the mlt system
mlt.Factory().init()
# Establish a default (usually "dv_pal") profile
profile = mlt.Profile()
# Create the producer
p = mlt.Producer(profile, sys.argv[1])
if p.is_valid():
# Derive a profile based on the producer
profile.from_producer(p)
# Reload the producer using the derived profile
p = mlt.Producer(profile, sys.argv[1])
# Create the consumer
c = mlt.Consumer(profile, "sdl2")
if not c.is_valid():
print("Failed to open the sdl2 consumer")
sys.exit(1)
# Connect the producer to the consumer
c.connect(p)
# Start the consumer
c.start()
# Wait until the user stops the consumer
while not c.is_stopped():
time.sleep(1)
else:
# Diagnostics
print("Unable to open ", sys.argv[1])
sys.exit(1)