Changeset 18490 for extensions/gsdl-video
- Timestamp:
- 2009-02-10T13:31:55+13:00 (15 years ago)
- Location:
- extensions/gsdl-video/trunk/perllib
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/gsdl-video/trunk/perllib/plugins/VideoPlugin.pm
r18476 r18490 362 362 363 363 364 my $convertto_command = "ffmpeg $main_opts -i \"$originalfilename\""; 364 my $originalfilename_gsdlenv = $self->gsdlhome_independent($originalfilename); 365 my $filename_gsdlenv = $self->gsdlhome_independent($filename); 366 367 368 my $convertto_command = "ffmpeg $main_opts -i \"$originalfilename_gsdlenv\""; 365 369 $convertto_command .= " -ar 22050" if ($converttotype eq "flv"); 366 $convertto_command .= " -y \"$filename \"";370 $convertto_command .= " -y \"$filename_gsdlenv\""; 367 371 368 372 my $convertto_result; … … 540 544 my $thumbnailsize = $self->{'thumbnailsize'} || 100; 541 545 my $thumbnailtype = $self->{'thumbnailtype'} || 'jpg'; 542 546 547 my $thumbnailwidth; 548 my $thumbnailheight; 549 550 if ($video_width>$video_height) { 551 my $scale_ratio = $video_height / $video_width; 552 $thumbnailwidth = $thumbnailsize; 553 $thumbnailheight = int($thumbnailsize * $scale_ratio); 554 } 555 else { 556 my $scale_ratio = $video_width / $video_height; 557 $thumbnailwidth = int($thumbnailsize * $scale_ratio); 558 $thumbnailheight = $thumbnailsize; 559 } 560 543 561 544 562 my $thumbnailfile = &util::filename_cat($output_dir,"$ivideo_root.$thumbnailtype"); … … 548 566 # Generate the thumbnail with convert, a la ImagePlug 549 567 my ($thumb_cmd ,$othumb_filename) 550 = $videoconvert->keyframe_thumbnail_cmd($filename,$thumbnailfile,$thumbnail size);568 = $videoconvert->keyframe_thumbnail_cmd($filename,$thumbnailfile,$thumbnailwidth,$thumbnailheight); 551 569 552 570 my $thumb_options = { 'verbosity' => $verbosity, … … 626 644 my $screenviewfilename = &util::filename_cat($output_dir,"$ivideo_root.$screenviewtype"); 627 645 646 my $screenviewwidth; 647 my $screenviewheight; 648 649 if ($video_width>$video_height) { 650 my $scale_ratio = $video_height / $video_width; 651 $screenviewwidth = $screenviewsize; 652 $screenviewheight = int($screenviewsize * $scale_ratio); 653 } 654 else { 655 my $scale_ratio = $video_width / $video_height; 656 $screenviewwidth = int($screenviewsize * $scale_ratio); 657 $screenviewheight = $screenviewsize; 658 } 659 660 628 661 # make the screenview image 629 662 630 663 my ($screenview_cmd,$oscreenview_filename) 631 = $videoconvert->keyframe_thumbnail_cmd($filename,$screenviewfilename,$screenview size);664 = $videoconvert->keyframe_thumbnail_cmd($filename,$screenviewfilename,$screenviewwidth,$screenviewheight); 632 665 633 666 my $screenview_options = { 'message_prefix' => "Screenview", -
extensions/gsdl-video/trunk/perllib/videoconvert.pm
r18425 r18490 242 242 243 243 244 sub gsdlhome_independent 245 { 246 my $self = shift @_; 247 my ($filename) = @_; 248 249 my $gsdlhome = $ENV{'GSDLHOME'}; 250 my $filename_gsdlenv = $filename; 251 $filename_gsdlenv =~ s@^$gsdlhome@\$GSDLHOME@; 252 253 return $filename_gsdlenv; 254 } 255 244 256 245 257 … … 307 319 my $vhook_opts = "$hive -o $oshot_filename -k $output_dir $ivideo_filename"; 308 320 309 my $ffmpeg_cmd = "ffkeyframe $main_opts -vhook \"$vhook_opts\" -i \"$ivideo_filename\" -an -y \"$oflash_filename\""; 321 my $ivideo_filename_gsdlenv = $self->gsdlhome_independent($ivideo_filename); 322 my $oflash_filename_gsdlenv = $self->gsdlhome_independent($oflash_filename); 323 324 my $ffmpeg_cmd = "ffkeyframe $main_opts -vhook \"$vhook_opts\" -i \"$ivideo_filename_gsdlenv\" -an -y \"$oflash_filename_gsdlenv\""; 310 325 311 326 … … 351 366 my $ffmpeg_cmd; 352 367 368 my $ivideo_filename_gsdlenv = $self->gsdlhome_independent($ivideo_filename); 369 my $oflash_filename_gsdlenv = $self->gsdlhome_independent($oflash_filename); 370 353 371 if ($streaming_quality eq "high") { 354 372 … … 358 376 } 359 377 360 $all_opts .= " -passlogfile \"$pass_log_file\""; 361 362 my $ffmpeg_cmd_pass1 = "ffmpeg -pass 1 -i \"$ivideo_filename\" $all_opts -y \"$oflash_filename\""; 363 364 my $ffmpeg_cmd_pass2 = "ffmpeg -pass 2 -i \"$ivideo_filename\" $all_opts $bitrate_opt -y \"$oflash_filename\""; 378 my $pass_log_file_gsdlenv = $self->gsdlhome_independent($pass_log_file); 379 380 $all_opts .= " -passlogfile \"$pass_log_file_gsdlenv\""; 381 382 my $ffmpeg_cmd_pass1 = "ffmpeg -pass 1 -i \"$ivideo_filename_gsdlenv\" $all_opts -y \"$oflash_filename_gsdlenv\""; 383 384 my $ffmpeg_cmd_pass2 = "ffmpeg -pass 2 -i \"$ivideo_filename_gsdlenv\" $all_opts $bitrate_opt -y \"$oflash_filename_gsdlenv\""; 365 385 $ffmpeg_cmd = "( $ffmpeg_cmd_pass1 ; $ffmpeg_cmd_pass2 )"; 366 386 } … … 368 388 # single pass 369 389 370 $ffmpeg_cmd = "ffmpeg -i \"$ivideo_filename \" $all_opts -y \"$oflash_filename\"";390 $ffmpeg_cmd = "ffmpeg -i \"$ivideo_filename_gsdlenv\" $all_opts -y \"$oflash_filename_gsdlenv\""; 371 391 } 372 392 … … 400 420 401 421 402 my $ffmpeg_cmd = "ffmpeg -i \"$ivoa_filename\" $all_opts \"$omp3_filename\""; 422 my $ivoa_filename_gsdlenv = $self->gsdlhome_independent($ivoa_filename); 423 my $omp3_filename_gsdlenv = $self->gsdlhome_independent($omp3_filename); 424 425 426 my $ffmpeg_cmd = "ffmpeg -i \"$ivoa_filename_gsdlenv\" $all_opts \"$omp3_filename_gsdlenv\""; 403 427 404 428 return ($ffmpeg_cmd,$omp3_filename,$omp3_file); … … 485 509 { 486 510 my $self = shift (@_); 487 my ($ivideo_filename,$thumbnailfile,$thumbnail size) = @_;511 my ($ivideo_filename,$thumbnailfile,$thumbnailwidth,$thumbnailheight) = @_; 488 512 489 513 my $output_dir = $self->{'cached_dir'}; … … 497 521 $key_filename = "${key_filename_prefix}_0000.jpg" if (!-e $key_filename); 498 522 523 my $key_filename_gsdlenv = $self->gsdlhome_independent($key_filename); 524 my $thumbnailfile_gsdlenv = $self->gsdlhome_independent($thumbnailfile); 525 499 526 my $command; 500 527 501 528 if (-e $key_filename) { 502 $command = "convert -interlace plane -verbose -geometry $thumbnail size"503 . "x$thumbnail size \"$key_filename\" \"$thumbnailfile\"";529 $command = "convert -interlace plane -verbose -geometry $thumbnailwidth" 530 . "x$thumbnailheight \"$key_filename_gsdlenv\" \"$thumbnailfile_gsdlenv\""; 504 531 } 505 532 else { … … 508 535 # => extract a from 509 536 # my $frame_rate = 1.0 / 60.0; 510 511 512 $command = "ffmpeg -i \"$ivideo_filename\" -ss 5.5 -vframes 1 -f image2 -s ${thumbnailsize}x${thumbnailsize} -y \"$thumbnailfile\""; 537 538 my $ivideo_filename_gsdlenv = $self->gsdlhome_independent($ivideo_filename); 539 540 541 542 $command = "ffmpeg -i \"$ivideo_filename_gsdlenv\" -ss 125 -vframes 1 -f image2 -s ${thumbnailwidth}x${thumbnailheight} -y \"$thumbnailfile_gsdlenv\""; 513 543 514 544 # fmpeg -i input.dv -r 1 -f image2 -s 120x96 images%05d.png
Note:
See TracChangeset
for help on using the changeset viewer.