1 |
|
---|
2 |
|
---|
3 |
|
---|
4 |
|
---|
5 |
|
---|
6 |
|
---|
7 |
|
---|
8 |
|
---|
9 |
|
---|
10 |
|
---|
11 |
|
---|
12 |
|
---|
13 |
|
---|
14 |
$path = $0; |
---|
15 |
$path =~ s/captureimagemaker.pl$//i; |
---|
16 |
if ($pwd ne "./"){ |
---|
17 |
push( @INC, "$path"); |
---|
18 |
} |
---|
19 |
|
---|
20 |
require "foltialib.pl"; |
---|
21 |
|
---|
22 |
|
---|
23 |
$filename = $ARGV[0] ; |
---|
24 |
|
---|
25 |
|
---|
26 |
@filenametmp = split(/\./,$filename); |
---|
27 |
@filename = split(/-/,$filenametmp[0]); |
---|
28 |
$tid = $filename[0]; |
---|
29 |
|
---|
30 |
|
---|
31 |
$tid =~ s/[^0-9]//ig; |
---|
32 |
|
---|
33 |
|
---|
34 |
if ($tid eq "" ){ |
---|
35 |
|
---|
36 |
print "usage captureimagemaker.pl MPEG2filename\n"; |
---|
37 |
exit; |
---|
38 |
} |
---|
39 |
|
---|
40 |
if ($tid >= 0){ |
---|
41 |
|
---|
42 |
}else{ |
---|
43 |
&writelog("captureimagemaker TID invalid"); |
---|
44 |
exit; |
---|
45 |
} |
---|
46 |
|
---|
47 |
|
---|
48 |
$countno = $filename[1]; |
---|
49 |
$countno =~ s/[^0-9]//ig; |
---|
50 |
|
---|
51 |
|
---|
52 |
|
---|
53 |
|
---|
54 |
|
---|
55 |
$date = $filename[2]; |
---|
56 |
$date =~ s/[^0-9]//ig; |
---|
57 |
if ($date eq "" ){ |
---|
58 |
$date = `date +%Y%m%d` |
---|
59 |
} |
---|
60 |
|
---|
61 |
|
---|
62 |
|
---|
63 |
$time = $filename[3]; |
---|
64 |
$time = substr($time, 0, 4); |
---|
65 |
$time =~ s/[^0-9]//ig; |
---|
66 |
if ($time eq "" ){ |
---|
67 |
$time = `date +%H%M` |
---|
68 |
} |
---|
69 |
|
---|
70 |
|
---|
71 |
|
---|
72 |
if (-e "$recfolderpath/$filename"){ |
---|
73 |
|
---|
74 |
}else{ |
---|
75 |
|
---|
76 |
&writelog("captureimagemaker notexist $recfolderpath/$filename"); |
---|
77 |
|
---|
78 |
exit; |
---|
79 |
} |
---|
80 |
|
---|
81 |
|
---|
82 |
|
---|
83 |
$capimgdirname = "$tid.localized/"; |
---|
84 |
$capimgdirname = $recfolderpath."/".$capimgdirname; |
---|
85 |
|
---|
86 |
unless (-e $capimgdirname ){ |
---|
87 |
system("$toolpath/perl/mklocalizeddir.pl $tid"); |
---|
88 |
&writelog("captureimagemaker mkdir $capimgdirname"); |
---|
89 |
} |
---|
90 |
$capimgdirname = "$tid.localized/img"; |
---|
91 |
$capimgdirname = $recfolderpath."/".$capimgdirname; |
---|
92 |
|
---|
93 |
unless (-e $capimgdirname ){ |
---|
94 |
mkdir $capimgdirname ,0777; |
---|
95 |
&writelog("captureimagemaker mkdir $capimgdirname"); |
---|
96 |
} |
---|
97 |
|
---|
98 |
|
---|
99 |
|
---|
100 |
|
---|
101 |
$captureimgdir = $filename; |
---|
102 |
$captureimgdir =~ s/\.m2p$//; |
---|
103 |
|
---|
104 |
unless (-e "$capimgdirname/$captureimgdir"){ |
---|
105 |
mkdir "$capimgdirname/$captureimgdir" ,0777; |
---|
106 |
&writelog("captureimagemaker mkdir $capimgdirname/$captureimgdir"); |
---|
107 |
|
---|
108 |
} |
---|
109 |
|
---|
110 |
|
---|
111 |
|
---|
112 |
|
---|
113 |
|
---|
114 |
|
---|
115 |
|
---|
116 |
|
---|
117 |
|
---|
118 |
|
---|
119 |
|
---|
120 |
system ("mplayer -ss 00:00:10 -vo jpeg:outdir=$capimgdirname/$captureimgdir/ -vf crop=690:460:12:10,scale=160:120 -ao null -sstep 9 -v 3 $recfolderpath/$filename"); |
---|
121 |
|
---|