-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdoCreatMP4.py
45 lines (40 loc) · 1.64 KB
/
doCreatMP4.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
import h264_to_mp4
import os
import autoCamera
import loadTXVODParameter
import datetime
import ctcmsconf
h264_to_mp4.init_video_folder();
h264FilePath =h264_to_mp4.gen_h264_filepath();
print h264FilePath
print "<1> has h264file Path--------------------------------"
mp4FilePath =h264_to_mp4.gen_mp4_filepath();
print mp4FilePath
print "<2> has mp4file Path--------------------------------"
autoCamera.getCamera(h264FilePath);
print "<3> has h264file--------------------------------"
h264_to_mp4.convert_to_mp4(h264FilePath,mp4FilePath);
print "<4> has mp4file--------------------------------"
mediaUrl = autoCamera.mp4LoadTXVod(mp4FilePath,
loadTXVODParameter.VODID,
loadTXVODParameter.VODKEY,
loadTXVODParameter.VODAREA,
loadTXVODParameter.VODAPPID);
print("<5.1> mediaUrl:"+mediaUrl+"--------------------------------------------------------")
print("<5.2> MEDIOURLDIR:"+ctcmsconf.MEDIOURLDIR+"-----------------------------------------------------")
localtime = datetime.datetime.now()
timeStr = localtime.strftime('%Y-%m-%d-%H-%M-%S')
print("<5.3> timeStr:"+timeStr+"--------------------------------------------------------")
exist=os.path.exists(ctcmsconf.MEDIOURLDIR)
if not exist:
os.makedirs(ctcmsconf.MEDIOURLDIR)
if mediaUrl != "":
fileName = ctcmsconf.MEDIOURLDIR+timeStr+".txt"
fw = open(fileName ,'w');
fw.write(mediaUrl);
print("<6> File is URL OK "+"--------------------------------------------------------")
else:
fileName = ctcmsconf.MEDIOURLDIR+"error"+timeStr+".txt"
fw = open(fileName ,'w');
print("<6> File is ERROR OK "+"--------------------------------------------------------")
fw.close()