Changeset 27552
- Timestamp:
- 2013-06-05T13:08:47+12:00 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
gs2-extensions/video-and-audio/trunk/src/perllib/plugins/SimpleVideoPlugin.pm
r27529 r27552 138 138 } 139 139 140 print STDERR " [A:" . time() . "]SimpleVideoPlugin processing: " . $file . "\n";140 print STDERR " * SimpleVideoPlugin processing: " . $file . "\n"; 141 141 142 142 # - I have to add some text (yay, back to needing dummy text) otherwise the … … 206 206 if ($separate_io eq 'true') 207 207 { 208 print STDERR "[B1:" . time() . "] Creating local copy of file: " . $ivideo_path . "\n"; 208 my $io_start = time(); 209 print " - creating local copy of file: " . $ivideo_path . " [IOS:" . time() . "]\n"; 209 210 my $local_ivideo_path = &FileUtils::filenameConcatenate($process_dir, $filename . ".ts"); 210 211 &FileUtils::copyFiles($ivideo_path, $local_ivideo_path); 211 212 $ivideo_path = $local_ivideo_path; 212 print STDERR "[B2:" . time() . "] Complete\n"; 213 } 214 else 215 { 216 print "Not gonna work!\n"; 217 exit; 213 print " - copied! [IOE:" . time() . "]\n"; 218 214 } 219 215 220 216 # 1. Use MediaInfo to extract important metadata 221 print STDERR "[C1:" . time() . "] Extracting metadata\n"; 222 print " - Extracting metadata using MediaInfo\n"; 217 print ' - Extracting metadata using MediaInfo...'; 223 218 my $mi_metadata = $self->getMetadata($ivideo_path); 224 219 $doc_obj->add_utf8_metadata($topsection,"Format", 'multimedia (' . $mi_metadata->{'General'}->{'Format'} . ')'); … … 242 237 $doc_obj->add_utf8_metadata($topsection,"Width",$mi_metadata->{'Video'}->{'Width'}); 243 238 $doc_obj->add_utf8_metadata($topsection,"Height",$mi_metadata->{'Video'}->{'Height'}); 244 print STDERR " [C2:" . time() . "] Complete\n";239 print STDERR "Done!\n"; 245 240 246 241 # 2. Convert into FLV, reprocess to make seekable, and associate 247 242 # - generate a path for our temporary converted video file 248 print STDERR " [D1:" . time() . "] Converting video to streamble format\n";243 print STDERR " - Converting video to streamble format...\n"; 249 244 my $ovideo_path = &FileUtils::filenameConcatenate($tmp_dir, 'gsv.mp4'); 250 245 if (&FileUtils::fileExists($ovideo_path)) 251 246 { 252 print " - Found existing converted video in cache\n";247 print " - Found existing converted video in cache!\n"; 253 248 } 254 249 else 255 250 { 256 251 # - first conversion pass 257 print " - Convert using Handbrake\n";252 print " - Convert using Handbrake\n"; 258 253 my $streaming_HQ_size = $self->{'streamingHQsize'}; 259 254 my $streaming_HQ_VideoBitrate = $self->{'streamingHQVideoBitrate'}; … … 310 305 die("Fatal Error! Failed to convert video: " . $ovideo_path . "\nReason:" . $! . "\n"); 311 306 } 312 print STDERR " [D2:" . time() . "] Complete\n";307 print STDERR " - conversion done!\n"; 313 308 314 309 # 3. Extract keyframes using hive 315 print STDERR " [E1:" . time() . "] Extract keyframes\n";310 print STDERR " - extract keyframes...\n"; 316 311 my $oshots_path = &FileUtils::filenameConcatenate($tmp_dir, 'shots.xml'); 317 312 if (&FileUtils::fileExists($oshots_path)) 318 313 { 319 print " - Found existing keyframe images in cache\n";314 print " - found existing keyframe images in cache\n"; 320 315 } 321 316 else 322 317 { 323 print " - Generating keyframe images using Hive2\n";318 print " - generating keyframe images using Hive2\n"; 324 319 my $cmd = 'hive2_ffmpegsvn -o "' . $oshots_path . '" -k "' . $tmp_dir . '" "' . $ovideo_path . '" >> "' . $convert_log_path . '" 2>&1'; 325 320 ###print "[cmd: " . $cmd . "]\n"; … … 330 325 die("Fatal Error! Failed to extract keyframe images: " . $oshots_path . "\nReason:" . $! . "\n"); 331 326 } 332 print STDERR " [E2:" . time() . "] Complete\n";327 print STDERR " - keyframes extracted!\n"; 333 328 334 329 335 330 # 4. Associate files (copies back to shared space if IO separated) 336 print STDERR " [F1:" . time() . "] Associate derived files to doc_obj\n";331 print STDERR " - Associate derived files to doc_obj... "; 337 332 # - associate streamable video 338 333 $doc_obj->associate_file($ovideo_path,'gsv.mp4','video/mp4',$topsection); … … 356 351 } 357 352 } 358 print STDERR " [F2:" . time() . "] Complete\n";353 print STDERR "Done!\n"; 359 354 360 355 # 5. Done! Cleanup. 361 print STDERR " [G:" . time() . "] SimpleVideoPlugin: Complete!\n";356 print STDERR "SimpleVideoPlugin: Complete! [IOS:" . time() . "]\n"; 362 357 return 1; 363 358 }
Note:
See TracChangeset
for help on using the changeset viewer.