1 |
|
---|
2 |
|
---|
3 |
|
---|
4 |
|
---|
5 |
|
---|
6 |
|
---|
7 |
|
---|
8 |
|
---|
9 |
|
---|
10 |
|
---|
11 |
|
---|
12 |
|
---|
13 |
use DBI; |
---|
14 |
use DBD::Pg; |
---|
15 |
use DBD::SQLite; |
---|
16 |
use Jcode; |
---|
17 |
|
---|
18 |
$path = $0; |
---|
19 |
$path =~ s/ipodtranscode.pl$//i; |
---|
20 |
if ($path ne "./"){ |
---|
21 |
push( @INC, "$path"); |
---|
22 |
} |
---|
23 |
require "foltialib.pl"; |
---|
24 |
|
---|
25 |
|
---|
26 |
|
---|
27 |
$processes = &processfind("ipodtranscode.pl"); |
---|
28 |
|
---|
29 |
|
---|
30 |
if ($processes > 1 ){ |
---|
31 |
&writelog("ipodtranscode processes exist. exit:"); |
---|
32 |
exit; |
---|
33 |
}else{ |
---|
34 |
|
---|
35 |
} |
---|
36 |
|
---|
37 |
|
---|
38 |
$dbh = DBI->connect($DSN,$DBUser,$DBPass) ||die $DBI::error;; |
---|
39 |
|
---|
40 |
|
---|
41 |
|
---|
42 |
|
---|
43 |
|
---|
44 |
|
---|
45 |
|
---|
46 |
|
---|
47 |
|
---|
48 |
&writelog("ipodtranscode starting up."); |
---|
49 |
|
---|
50 |
$counttranscodefiles = &counttranscodefiles(); |
---|
51 |
if ($counttranscodefiles == 0){ |
---|
52 |
&writelog("ipodtranscode No MPEG2 files to transcode."); |
---|
53 |
exit; |
---|
54 |
} |
---|
55 |
sleep 30; |
---|
56 |
|
---|
57 |
while ($counttranscodefiles >= 1){ |
---|
58 |
$sth = $dbh->prepare($stmt{'ipodtranscode.1'}); |
---|
59 |
$sth->execute($FILESTATUSRECEND, $FILESTATUSTRANSCODECOMPLETE, ); |
---|
60 |
@dbparam = $sth->fetchrow_array; |
---|
61 |
|
---|
62 |
|
---|
63 |
&writelog("ipodtranscode DEBUG $dbparam[0],$dbparam[1],$dbparam[2],$dbparam[3],$dbparam[4],$dbparam[5]"); |
---|
64 |
$pid = $dbparam[0]; |
---|
65 |
$tid = $dbparam[1]; |
---|
66 |
$inputmpeg2 = $recfolderpath."/".$dbparam[2]; |
---|
67 |
$mpeg2filename = $dbparam[2]; |
---|
68 |
$filestatus = $dbparam[3]; |
---|
69 |
$aspect = $dbparam[4]; |
---|
70 |
$countno = $dbparam[5]; |
---|
71 |
$mp4filenamestring = &mp4filenamestringbuild($pid); |
---|
72 |
|
---|
73 |
&writelog("ipodtranscode DEBUG mp4filenamestring $mp4filenamestring"); |
---|
74 |
|
---|
75 |
$pspdirname = &makemp4dir($tid); |
---|
76 |
$mp4outdir = $pspdirname ; |
---|
77 |
|
---|
78 |
|
---|
79 |
if ($pid ne ""){ |
---|
80 |
$sth = $dbh->prepare($stmt{'ipodtranscode.2'}); |
---|
81 |
$sth->execute($pid); |
---|
82 |
@programtitle = $sth->fetchrow_array; |
---|
83 |
$programtitle[0] =~ s/\"/\\"/gi; |
---|
84 |
$programtitle[2] =~ s/\"/\\"/gi; |
---|
85 |
|
---|
86 |
if ($pid > 0){ |
---|
87 |
if ($programtitle[1] ne ""){ |
---|
88 |
$movietitle = " -title \"$programtitle[0] 第$programtitle[1]話 $programtitle[2]\" "; |
---|
89 |
$movietitleeuc = " -t \"$programtitle[0] 第$programtitle[1]話 $programtitle[2]\" "; |
---|
90 |
}else{ |
---|
91 |
$movietitle = " -title \"$programtitle[0] $programtitle[2]\" "; |
---|
92 |
$movietitleeuc = " -t \"$programtitle[0] $programtitle[2]\" "; |
---|
93 |
} |
---|
94 |
}elsif($pid < 0){ |
---|
95 |
|
---|
96 |
$movietitle = " -title \"$programtitle[2]\" "; |
---|
97 |
$movietitleeuc = " -t \"$programtitle[2]\" "; |
---|
98 |
}else{ |
---|
99 |
|
---|
100 |
$movietitle = ""; |
---|
101 |
$movietitleeuc = ""; |
---|
102 |
} |
---|
103 |
|
---|
104 |
$movietitle = ""; |
---|
105 |
$movietitleeuc = ""; |
---|
106 |
|
---|
107 |
} |
---|
108 |
|
---|
109 |
if ($filestatus <= $FILESTATUSRECEND){ |
---|
110 |
} |
---|
111 |
|
---|
112 |
if ($filestatus <= $FILESTATUSWAITINGCAPTURE){ |
---|
113 |
|
---|
114 |
} |
---|
115 |
|
---|
116 |
if ($filestatus <= $FILESTATUSCAPTURE){ |
---|
117 |
|
---|
118 |
|
---|
119 |
if (-e "$toolpath/perl/captureimagemaker.pl"){ |
---|
120 |
&writelog("ipodtranscode Call captureimagemaker $mpeg2filename"); |
---|
121 |
&changefilestatus($pid,$FILESTATUSCAPTURE); |
---|
122 |
system ("$toolpath/perl/captureimagemaker.pl $mpeg2filename"); |
---|
123 |
&changefilestatus($pid,$FILESTATUSCAPEND); |
---|
124 |
} |
---|
125 |
} |
---|
126 |
|
---|
127 |
if ($filestatus <= $FILESTATUSCAPEND){ |
---|
128 |
|
---|
129 |
&makethumbnail(); |
---|
130 |
&changefilestatus($pid,$FILESTATUSTHMCREATE); |
---|
131 |
} |
---|
132 |
|
---|
133 |
if ($filestatus <= $FILESTATUSWAITINGTRANSCODE){ |
---|
134 |
} |
---|
135 |
|
---|
136 |
$filenamebody = $inputmpeg2 ; |
---|
137 |
$filenamebody =~ s/.m2t$|.ts$|.m2p$|.mpg$|.aac$//gi; |
---|
138 |
|
---|
139 |
|
---|
140 |
if ($inputmpeg2 =~ /m2t$|ts$|aac$/i){ |
---|
141 |
|
---|
142 |
if ($filestatus <= $FILESTATUSTRANSCODETSSPLITTING){ |
---|
143 |
unlink("${filenamebody}_tss.m2t"); |
---|
144 |
unlink("${filenamebody}_HD.m2t"); |
---|
145 |
} |
---|
146 |
if ($filestatus <= $FILESTATUSTRANSCODEFFMPEG){ |
---|
147 |
|
---|
148 |
|
---|
149 |
$trcnmpegfile = $inputmpeg2 ; |
---|
150 |
|
---|
151 |
if ($aspect == 1){ |
---|
152 |
$cropopt = " -croptop 150 -cropbottom 150 -cropleft 200 -cropright 200 "; |
---|
153 |
}elsif($aspect == 4){ |
---|
154 |
$cropopt = " -croptop 6 -cropbottom 6 -cropleft 8 -cropright 8 "; |
---|
155 |
}else{ |
---|
156 |
$cropopt = " -croptop 6 -cropbottom 6 -cropleft 8 -cropright 8 "; |
---|
157 |
} |
---|
158 |
|
---|
159 |
if (($trconqty eq "")||($trconqty == 1)){ |
---|
160 |
$ffmpegencopt = " -s 360x202 -deinterlace -r 24.00 -vcodec libx264 -g 300 -b 330000 -level 13 -loop 1 -sc_threshold 60 -partp4x4 1 -rc_eq 'blurCplx^(1-qComp)' -refs 3 -maxrate 700000 -async 50 -f h264 $filenamebody.264"; |
---|
161 |
}elsif($trconqty == 2){ |
---|
162 |
|
---|
163 |
|
---|
164 |
$ffmpegencopt = " -s 480x272 -deinterlace -r 29.97 -vcodec libx264 -vpre default -g 300 -b 400000 -level 13 -sc_threshold 60 -rc_eq 'blurCplx^(1-qComp)' -refs 3 -maxrate 700000 -async 50 -f h264 $filenamebody.264"; |
---|
165 |
}elsif($trconqty == 3){ |
---|
166 |
|
---|
167 |
|
---|
168 |
$ffmpegencopt = " -s 640x352 -deinterlace -r 29.97 -vcodec libx264 -vpre default -g 100 -b 600000 -level 13 -sc_threshold 60 -rc_eq 'blurCplx^(1-qComp)' -refs 3 -maxrate 700000 -async 50 -f h264 $filenamebody.264"; |
---|
169 |
} |
---|
170 |
&changefilestatus($pid,$FILESTATUSTRANSCODEFFMPEG); |
---|
171 |
&writelog("ipodtranscode ffmpeg $filenamebody.264"); |
---|
172 |
system ("ffmpeg -y -i $trcnmpegfile $cropopt $ffmpegencopt"); |
---|
173 |
|
---|
174 |
|
---|
175 |
if (! -e "$filenamebody.264"){ |
---|
176 |
&changefilestatus($pid,$FILESTATUSTRANSCODETSSPLITTING); |
---|
177 |
unlink("${filenamebody}_tss.m2t"); |
---|
178 |
unlink("${filenamebody}_HD.m2t"); |
---|
179 |
if (-e "$toolpath/perl/tool/tss.py"){ |
---|
180 |
&writelog("ipodtranscode tss $inputmpeg2"); |
---|
181 |
system("$toolpath/perl/tool/tss.py $inputmpeg2"); |
---|
182 |
|
---|
183 |
}else{ |
---|
184 |
|
---|
185 |
&writelog("ipodtranscode TsSplitter $inputmpeg2"); |
---|
186 |
system("wine $toolpath/perl/tool/TsSplitter.exe -EIT -ECM -EMM -SD -1SEG -WAIT2 $inputmpeg2"); |
---|
187 |
} |
---|
188 |
if(-e "${filenamebody}_tss.m2t"){ |
---|
189 |
$trcnmpegfile = "${filenamebody}_tss.m2t"; |
---|
190 |
}elsif (-e "${filenamebody}_HD.m2t"){ |
---|
191 |
$trcnmpegfile = "${filenamebody}_HD.m2t"; |
---|
192 |
}else{ |
---|
193 |
&writelog("ipodtranscode ERR NOT Exist ${filenamebody}_HD.m2t"); |
---|
194 |
$trcnmpegfile = inputmpeg2 ; |
---|
195 |
} |
---|
196 |
|
---|
197 |
&changefilestatus($pid,$FILESTATUSTRANSCODEFFMPEG); |
---|
198 |
&writelog("ipodtranscode ffmpeg retry $filenamebody.264"); |
---|
199 |
system ("ffmpeg -y -i $trcnmpegfile $cropopt $ffmpegencopt"); |
---|
200 |
} |
---|
201 |
|
---|
202 |
if (! -e "$filenamebody.264"){ |
---|
203 |
|
---|
204 |
&changefilestatus($pid,$FILESTATUSTRANSCODEFFMPEG); |
---|
205 |
&writelog("ipodtranscode ffmpeg retry no crop $filenamebody.264"); |
---|
206 |
system ("ffmpeg -y -i $trcnmpegfile $ffmpegencopt"); |
---|
207 |
} |
---|
208 |
} |
---|
209 |
if ($filestatus <= $FILESTATUSTRANSCODEWAVE){ |
---|
210 |
|
---|
211 |
unlink("${filenamebody}.wav"); |
---|
212 |
&changefilestatus($pid,$FILESTATUSTRANSCODEWAVE); |
---|
213 |
&writelog("ipodtranscode mplayer $filenamebody.wav"); |
---|
214 |
system ("mplayer $trcnmpegfile -vc null -vo null -ao pcm:file=$filenamebody.wav:fast"); |
---|
215 |
|
---|
216 |
} |
---|
217 |
if ($filestatus <= $FILESTATUSTRANSCODEAAC){ |
---|
218 |
|
---|
219 |
unlink("${filenamebody}.aac"); |
---|
220 |
&changefilestatus($pid,$FILESTATUSTRANSCODEAAC); |
---|
221 |
if (-e "$toolpath/perl/tool/neroAacEnc"){ |
---|
222 |
if (-e "$filenamebody.wav"){ |
---|
223 |
&writelog("ipodtranscode neroAacEnc $filenamebody.wav"); |
---|
224 |
system ("$toolpath/perl/tool/neroAacEnc -br 128000 -if $filenamebody.wav -of $filenamebody.aac"); |
---|
225 |
}else{ |
---|
226 |
&writelog("ipodtranscode ERR Not Found $filenamebody.wav"); |
---|
227 |
} |
---|
228 |
}else{ |
---|
229 |
|
---|
230 |
&writelog("ipodtranscode faac $filenamebody.wav"); |
---|
231 |
system ("faac -b 128 -o $filenamebody.aac $filenamebody.wav "); |
---|
232 |
} |
---|
233 |
|
---|
234 |
} |
---|
235 |
if ($filestatus <= $FILESTATUSTRANSCODEMP4BOX){ |
---|
236 |
|
---|
237 |
unlink("${filenamebody}.base.mp4"); |
---|
238 |
|
---|
239 |
|
---|
240 |
if ($inputmpeg2 =~ /aac$/i){ |
---|
241 |
if (-e "$toolpath/perl/tool/MP4Box"){ |
---|
242 |
&writelog("ipodtranscode MP4Box $filenamebody"); |
---|
243 |
system ("cd $recfolderpath ;$toolpath/perl/tool/MP4Box -add $filenamebody.aac -new $filenamebody.base.mp4"); |
---|
244 |
$exit_value = $? >> 8; |
---|
245 |
$signal_num = $? & 127; |
---|
246 |
$dumped_core = $? & 128; |
---|
247 |
&writelog("ipodtranscode DEBUG MP4Box -add $filenamebody.aac -new $filenamebody.base.mp4:$exit_value:$signal_num:$dumped_core"); |
---|
248 |
}else{ |
---|
249 |
&writelog("ipodtranscode WARN; Pls. install $toolpath/perl/tool/MP4Box"); |
---|
250 |
} |
---|
251 |
}else{ |
---|
252 |
|
---|
253 |
if (-e "$toolpath/perl/tool/MP4Box"){ |
---|
254 |
&changefilestatus($pid,$FILESTATUSTRANSCODEMP4BOX); |
---|
255 |
&writelog("ipodtranscode MP4Box $filenamebody"); |
---|
256 |
system ("cd $recfolderpath ;$toolpath/perl/tool/MP4Box -fps 29.97 -add $filenamebody.264 -new $filenamebody.base.mp4"); |
---|
257 |
$exit_value = $? >> 8; |
---|
258 |
$signal_num = $? & 127; |
---|
259 |
$dumped_core = $? & 128; |
---|
260 |
&writelog("ipodtranscode DEBUG MP4Box -fps 29.97 -add $filenamebody.264 -new $filenamebody.base.mp4:$exit_value:$signal_num:$dumped_core"); |
---|
261 |
if (-e "$filenamebody.base.mp4"){ |
---|
262 |
system ("cd $recfolderpath ;$toolpath/perl/tool/MP4Box -add $filenamebody.aac $filenamebody.base.mp4"); |
---|
263 |
$exit_value = $? >> 8; |
---|
264 |
$signal_num = $? & 127; |
---|
265 |
$dumped_core = $? & 128; |
---|
266 |
&writelog("ipodtranscode DEBUG MP4Box -add $filenamebody.aac:$exit_value:$signal_num:$dumped_core"); |
---|
267 |
}else{ |
---|
268 |
$filelist = `ls -lhtr $recfolderpath/${filenamebody}*`; |
---|
269 |
$debugenv = `env`; |
---|
270 |
&writelog("ipodtranscode ERR File not exist.$debugenv.$filelist ;$filenamebody.base.mp4;$filelist;cd $recfolderpath ;$toolpath/perl/tool/MP4Box -fps 29.97 -add $filenamebody.264 -new $filenamebody.base.mp4"); |
---|
271 |
} |
---|
272 |
}else{ |
---|
273 |
&writelog("ipodtranscode WARN; Pls. install $toolpath/perl/tool/MP4Box"); |
---|
274 |
} |
---|
275 |
unlink("$filenamebody.aac"); |
---|
276 |
} |
---|
277 |
|
---|
278 |
|
---|
279 |
|
---|
280 |
|
---|
281 |
if (-e "$toolpath/perl/tool/MP4Box"){ |
---|
282 |
|
---|
283 |
|
---|
284 |
&writelog("ipodtranscode ATOM $filenamebody"); |
---|
285 |
|
---|
286 |
|
---|
287 |
system ("cd $recfolderpath ; $toolpath/perl/tool/MP4Box -ipod $filenamebody.base.mp4"); |
---|
288 |
$exit_value = $? >> 8; |
---|
289 |
$signal_num = $? & 127; |
---|
290 |
$dumped_core = $? & 128; |
---|
291 |
&writelog("ipodtranscode DEBUG MP4Box -ipod $filenamebody.base.mp4:$exit_value:$signal_num:$dumped_core"); |
---|
292 |
if (-e "$filenamebody.base.mp4"){ |
---|
293 |
unlink("${mp4outdir}MAQ${mp4filenamestring}.MP4"); |
---|
294 |
system("mv $filenamebody.base.mp4 ${mp4outdir}MAQ${mp4filenamestring}.MP4"); |
---|
295 |
&writelog("ipodtranscode mv $filenamebody.base.mp4 ${mp4outdir}MAQ${mp4filenamestring}.MP4"); |
---|
296 |
}else{ |
---|
297 |
&writelog("ipodtranscode ERR $filenamebody.base.mp4 Not found."); |
---|
298 |
} |
---|
299 |
|
---|
300 |
}else{ |
---|
301 |
&writelog("ipodtranscode WARN; Pls. install $toolpath/perl/tool/MP4Box"); |
---|
302 |
} |
---|
303 |
} |
---|
304 |
if ($filestatus <= $FILESTATUSTRANSCODECOMPLETE){ |
---|
305 |
if (-e "${mp4outdir}MAQ${mp4filenamestring}.MP4"){ |
---|
306 |
|
---|
307 |
&changefilestatus($pid,$FILESTATUSTRANSCODECOMPLETE); |
---|
308 |
unlink("${filenamebody}_HD.m2t"); |
---|
309 |
unlink("${filenamebody}_tss.m2t"); |
---|
310 |
unlink("$filenamebody.264"); |
---|
311 |
unlink("$filenamebody.wav"); |
---|
312 |
unlink("$filenamebody.base.mp4"); |
---|
313 |
|
---|
314 |
&updatemp4file(); |
---|
315 |
}else{ |
---|
316 |
&writelog("ipodtranscode ERR ; Fail MAQ${mp4filenamestring}.MP4"); |
---|
317 |
} |
---|
318 |
} |
---|
319 |
|
---|
320 |
}else{ |
---|
321 |
|
---|
322 |
|
---|
323 |
if ($aspect == 16){ |
---|
324 |
$cropopt = " -croptop 70 -cropbottom 60 -cropleft 8 -cropright 14 -aspect 16:9 "; |
---|
325 |
}else{ |
---|
326 |
$cropopt = " -croptop 8 -cropbottom 8 -cropleft 8 -cropright 14 "; |
---|
327 |
} |
---|
328 |
|
---|
329 |
if (($trconqty eq "")||($trconqty == 1)){ |
---|
330 |
|
---|
331 |
$mp4file = "${mp4outdir}M4V${mp4filenamestring}.MP4"; |
---|
332 |
$encodeoption = "-y -i $inputmpeg2 vcodec libxvid $cropopt -s 320x240 -b 300 -bt 128 -r 14.985 -deinterlace -acodec libfaac -f ipod ${mp4outdir}M4V${mp4filenamestring}.MP4"; |
---|
333 |
|
---|
334 |
|
---|
335 |
|
---|
336 |
}elsif($trconqty == 2){ |
---|
337 |
|
---|
338 |
$mp4file = "${mp4outdir}MAQ${mp4filenamestring}.MP4"; |
---|
339 |
$encodeoption = "-y -i $inputmpeg2 -vcodec libx264 -croptop 8 $cropopt -s 320x240 -b 300 -bt 128 -r 24 -deinterlace -acodec libfaac -f ipod ${mp4outdir}MAQ${mp4filenamestring}.MP4"; |
---|
340 |
|
---|
341 |
|
---|
342 |
|
---|
343 |
}elsif($trconqty == 3){ |
---|
344 |
|
---|
345 |
$mp4file = "${mp4outdir}MAQ${mp4filenamestring}.MP4"; |
---|
346 |
$encodeoption = "-y -i $inputmpeg2 -vcodec libx264 $cropopt -s 320x240 -b 380 -bt 128 -r 29.97 -deinterlace -acodec libfaac -f ipod ${mp4outdir}MAQ${mp4filenamestring}.MP4"; |
---|
347 |
|
---|
348 |
|
---|
349 |
|
---|
350 |
}elsif($trconqty == 4){ |
---|
351 |
|
---|
352 |
$mp4file = "${mp4outdir}MAQ${mp4filenamestring}.MP4"; |
---|
353 |
$encodeoption = "-y -i $inputmpeg2 -vcodec libx264 $cropopt -s 640x480 -b 500 -maxrate 700 -bt 128 -r 29.97 -deinterlace -acodec libfaac -f ipod ${mp4outdir}MAQ${mp4filenamestring}.MP4"; |
---|
354 |
|
---|
355 |
|
---|
356 |
|
---|
357 |
}elsif($trconqty == 5){ |
---|
358 |
|
---|
359 |
$mp4file = "${mp4outdir}MAQ${mp4filenamestring}.MP4"; |
---|
360 |
$encodeoption = "-y -i $inputmpeg2 -vcodec libx264 -croptop 8 $cropopt -s 640x480 -b 500 -maxrate 700 -bt 128 -r 29.97 -deinterlace -flags loop -trellis 2 -partitions parti4x4+parti8x8+partp4x4+partp8x8+partb8x8 -acodec libfaac -f ipod ${mp4outdir}MAQ${mp4filenamestring}.MP4"; |
---|
361 |
|
---|
362 |
|
---|
363 |
|
---|
364 |
} |
---|
365 |
|
---|
366 |
$encodeoptionlog = $encodeoption; |
---|
367 |
Jcode::convert(\$encodeoptionlog,'euc'); |
---|
368 |
|
---|
369 |
&writelog("ipodtranscode START QTY=$trconqty $encodeoptionlog"); |
---|
370 |
|
---|
371 |
&changefilestatus($pid,$FILESTATUSTRANSCODEFFMPEG); |
---|
372 |
system ("ffmpeg $encodeoption "); |
---|
373 |
&writelog("ipodtranscode FFEND $inputmpeg2"); |
---|
374 |
&changefilestatus($pid,$FILESTATUSTRANSCODECOMPLETE); |
---|
375 |
|
---|
376 |
|
---|
377 |
|
---|
378 |
|
---|
379 |
|
---|
380 |
&updatemp4file(); |
---|
381 |
} |
---|
382 |
|
---|
383 |
$counttranscodefiles = &counttranscodefiles(); |
---|
384 |
|
---|
385 |
|
---|
386 |
|
---|
387 |
} |
---|
388 |
|
---|
389 |
&writelog("ipodtranscode ALL COMPLETE"); |
---|
390 |
exit; |
---|
391 |
|
---|
392 |
|
---|
393 |
sub mp4filenamestringbuild(){ |
---|
394 |
|
---|
395 |
|
---|
396 |
my @mpegfilename = split(/\./,$dbparam[2]) ; |
---|
397 |
my $pspfilname = "-".$mpegfilename[0] ; |
---|
398 |
return("$pspfilname"); |
---|
399 |
} |
---|
400 |
|
---|
401 |
|
---|
402 |
sub makethumbnail(){ |
---|
403 |
|
---|
404 |
my $outputfilename = $inputmpeg2 ; |
---|
405 |
my $thmfilename = "MAQ${mp4filenamestring}.THM"; |
---|
406 |
&writelog("ipodtranscode DEBUG thmfilename $thmfilename"); |
---|
407 |
|
---|
408 |
|
---|
409 |
|
---|
410 |
|
---|
411 |
if($outputfilename =~ /.m2t$/){ |
---|
412 |
|
---|
413 |
system ("mplayer -ss 00:01:20 -vo jpeg:outdir=$pspdirname -ao null -vf framestep=300step,scale=160:90,expand=160:120 -frames 1 $outputfilename"); |
---|
414 |
&writelog("ipodtranscode DEBUG mplayer -ss 00:01:20 -vo jpeg:outdir=$pspdirname -ao null -vf framestep=300step,scale=160:90,expand=160:120 -frames 1 $outputfilename"); |
---|
415 |
}else{ |
---|
416 |
|
---|
417 |
system ("mplayer -ss 00:01:20 -vo jpeg:outdir=$pspdirname -ao null -vf framestep=300step,scale=165:126,crop=160:120 -frames 1 $outputfilename"); |
---|
418 |
&writelog("ipodtranscode DEBUG mplayer -ss 00:01:20 -vo jpeg:outdir=$pspdirname -ao null -vf framestep=300step,scale=165:126,crop=160:120 -frames 1 $outputfilename"); |
---|
419 |
} |
---|
420 |
|
---|
421 |
|
---|
422 |
|
---|
423 |
|
---|
424 |
|
---|
425 |
|
---|
426 |
|
---|
427 |
|
---|
428 |
|
---|
429 |
|
---|
430 |
|
---|
431 |
system("mv $pspdirname/00000001.jpg $pspdirname/$thmfilename"); |
---|
432 |
|
---|
433 |
} |
---|
434 |
|
---|
435 |
sub updatemp4file(){ |
---|
436 |
my $mp4filename = "MAQ${mp4filenamestring}.MP4"; |
---|
437 |
|
---|
438 |
if (-e "${mp4outdir}MAQ${mp4filenamestring}.MP4"){ |
---|
439 |
|
---|
440 |
$sth = $dbh->prepare($stmt{'ipodtranscode.updatemp4file.1'}); |
---|
441 |
$sth->execute($mp4filename, $pid); |
---|
442 |
&writelog("ipodtranscode UPDATEsubtitleDB $stmt{'ipodtranscode.updatemp4file.1'}"); |
---|
443 |
|
---|
444 |
|
---|
445 |
$sth = $dbh->prepare($stmt{'ipodtranscode.updatemp4file.2'}); |
---|
446 |
$sth->execute($tid, $mp4filename); |
---|
447 |
&writelog("ipodtranscode UPDATEmp4DB $stmt{'ipodtranscode.updatemp4file.2'}"); |
---|
448 |
|
---|
449 |
&changefilestatus($pid,$FILESTATUSALLCOMPLETE); |
---|
450 |
}else{ |
---|
451 |
&writelog("ipodtranscode ERR MP4 NOT EXIST $pid/$mp4filename"); |
---|
452 |
} |
---|
453 |
|
---|
454 |
|
---|
455 |
} |
---|
456 |
|
---|
457 |
sub counttranscodefiles(){ |
---|
458 |
$sth = $dbh->prepare($stmt{'ipodtranscode.counttranscodefiles.1'}); |
---|
459 |
$sth->execute($FILESTATUSRECEND, $FILESTATUSTRANSCODECOMPLETE); |
---|
460 |
my @titlecount= $sth->fetchrow_array; |
---|
461 |
|
---|
462 |
return ($titlecount[0]); |
---|
463 |
|
---|
464 |
|
---|
465 |
} |
---|