-
Notifications
You must be signed in to change notification settings - Fork 27
/
seq2mezz.py
52 lines (44 loc) · 1.66 KB
/
seq2mezz.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
#!/usr/bin/env python
import subprocess
import sys
import os
from glob import glob
def get_input(root):
source_directory = root
os.chdir(source_directory)
images = (glob('*.tif')
+ glob('*.tiff')
+ glob('*.dpx'))
return images, source_directory
def get_filenames(images, source_directory):
numberless_filename = images[0].split("_")[0:-1]
ffmpeg_friendly_name = ''
counter = 0
while counter <len(numberless_filename) :
ffmpeg_friendly_name += numberless_filename[counter] + '_'
counter += 1
dirname = os.path.dirname(source_directory)
output = dirname + '/%s_consolidate.mov' % os.path.split(source_directory)[-1]
return ffmpeg_friendly_name, output
def make_dv(ffmpeg_friendly_name, output):
ffmpeg_friendly_name += '%06d.tiff'
cmd = ['ffmpeg','-f','image2',
'-framerate','24',
'-i', ffmpeg_friendly_name,
'-c:v','prores',
'-profile:v', '3',
output]
print cmd
subprocess.call(cmd)
def main():
all_files = sys.argv[1:]
for folders in all_files:
for root, dirs, files in os.walk(folders):
if len(files) > 10:
if files[5].endswith(('.tif', '.tiff', '.dpx' )):
print '***********************************************************************************************************************************************************'
images,source_directory = get_input(root)
ffmpeg_friendly_name,output = get_filenames(images, source_directory)
make_dv(ffmpeg_friendly_name, output)
if __name__ == '__main__':
main()