-
Notifications
You must be signed in to change notification settings - Fork 0
/
build_edit_from_json.py
84 lines (71 loc) · 2.41 KB
/
build_edit_from_json.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
from editbot_main import *
import os, copy
ffmpeg_bin=r"C:\Program Files\ffmpeg\bin\ffmpeg.exe"
ffprobe_bin=r"C:\Program Files\ffmpeg\bin\ffprobe.exe"
def build_edit(
name,
folder,
pass_name,
edit_desc_path,
edit_desc_name,
edit_output_path,
edit_output_name,
logo_path,
fps,
studio_name = None,
director_name =None,
subfolders = False,
):
base_config = Config(
ffmpeg_bin=ffmpeg_bin,
ffprobe_bin=ffprobe_bin,
studio_name = studio_name,
director_name =director_name,
name=name,
default_pass_name=pass_name,
enable_shotmask=True,
shot_mask_logo_path=logo_path,
clip_frame_handles=0,
fps=fps
)
# build location
storageLocation = Location(name='root', folder=folder)
storageLocation.addSublocation(Location(name=pass_name, folder=folder, priority=7, subfolders_only=subfolders))
anim_config = copy.deepcopy(base_config)
anim_config.force_pass = True,
# anim_config.default_pass_name = 'Style_Test'
animEdit = Edit(
config=anim_config,
shot_desc_path=str(os.path.join(edit_desc_path, edit_desc_name)),
source_folder=storageLocation,
# frameoffset = 30*5, # 5 seconds slate
)
edits = [animEdit]
for edit in edits:
edit.conformEdit(mode='duration')
edit.addAutoSlate(duration=5)
edit.preconvertClips()
print("Building edit:")
[print(f" {editclip.name}") for editclip in edit.edit]
result_path = edit.build(os.path.join(edit_output_path, edit_output_name))
print(f"Edit saved to: {result_path}")
edit.cleanup()
if __name__ == "__main__":
edit_desc_path = r"C:"
edit_desc_name = r"editbot_testconfig.json"
folder = r"C:\Users\chris\Desktop\testfootage\02_Animation"
edit_output_path=r"C:",
edit_output_name="editbot_testconfig_edit.mp4",
build_edit_from_json.build_edit(
edit_desc_path=edit_desc_path,
edit_desc_name=edit_desc_name,
edit_output_path=edit_output_path,
edit_output_name=edit_output_name,
studio_name='Tetsuo Animation Studio',
director_name='Chris Unterberg',
name = 'Folder Edit',
pass_name = 'Folder Preview',
folder = foldername,
logo_path=os.path.join(os.path.dirname(__file__),"res","tetsuoanimation_logo_v004_cu.png"),
fps=30
)