-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSTP_ffmpeg.py
46 lines (44 loc) · 1.64 KB
/
STP_ffmpeg.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
import sys
import subprocess
###############################################################################
# Define inputs
###############################################################################
(USR, AOI, REL, LND) = (sys.argv[1], sys.argv[2], sys.argv[3], sys.argv[4])
# (USR, AOI, REL, LND, MGV) = ('dsk', 'HLT', '265', 'SPA', 'v1')
id = "{}-{}".format(sys.argv[5], AOI)
# basePath = "/home/chipdelmal/Documents/WorkSims/STP/SPA/505/video/"
rate = 45
###############################################################################
# User select
###############################################################################
if USR == 'srv':
basePath = '/RAID5/marshallShare/STP/{}/sim/{}/video/'.format(LND, REL)
else:
basePath = '/home/chipdelmal/Documents/WorkSims/STP/{}/{}/video/'.format(LND, REL)
###############################################################################
# Define paths
###############################################################################
outName = id
outPath = basePath + outName + '.mp4'
inPath = basePath + id + "/" + '%04d.png'
###############################################################################
# Launch process
###############################################################################
sp = subprocess.Popen([
'ffmpeg',
# '-loglevel', '+info',
'-start_number', '1',
'-r', str(rate),
'-f', 'image2',
'-s', '1920x1080',
'-i', inPath,
'-vf', 'scale=trunc(iw/2)*2:trunc(ih/2)*2',
'-vcodec', 'libx264',
'-preset', 'veryslow',
'-crf', '15',
'-report',
'-pix_fmt', 'yuv420p',
outPath
])
sp.wait()
print("I: " + inPath +"\n" + "O: " + outPath)