-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexamples.py
49 lines (44 loc) · 988 Bytes
/
examples.py
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
import pympeg
# add meta to file
operation = (
pympeg.input(name="input.mp4")
.input(name="FFMETADATA")
.output(name="out.mp4", map_cmd="-map_metadata")
.graph()
)
# fade effect
pympeg.init()
operations = (
pympeg.input(name="example.mp4")
.fade(st="3", d="3")
.output(name="out.mp4")
.run()
)
# add metafile back
pympeg.init()
operations = (
pympeg
.input(name="FFMETAFILE")
.input(name="input.mp4")
.output(name="output.mp4", map_cmd="-map_metadata 0")
.run()
)
# extract metadata file
pympeg.init()
operations = (
pympeg
.option(tag="-f", name="ffmetadata")
.input(name="input.mp4")
.output(name="FFMETAFILE", map_cmd="")
.run()
)
# trim, scale the video
pympeg.init()
operations = (
pympeg.input(name="example.mp4")
.filter(filter_name="trim", params={"start": 1, "duration": 5})
.setpts()
.scale(w="1920", h="-1")
.crop(w="1920", h="720")
.output(name="out.mp4")
)