Ignore:
Timestamp:
2009-02-10T13:31:55+13:00 (15 years ago)
Author:
davidb
Message:

Mods to cached_convert so the $GSDLHOME is used rather then explicit directory name. That way the collection can be moved to another computer with Greenstone installed in a different place and the caching mechanism still works

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/gsdl-video/trunk/perllib/videoconvert.pm

    r18425 r18490  
    242242
    243243
     244sub 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
    244256
    245257
     
    307319    my $vhook_opts = "$hive  -o $oshot_filename -k $output_dir $ivideo_filename";
    308320
    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\"";
    310325
    311326
     
    351366    my $ffmpeg_cmd;
    352367
     368    my $ivideo_filename_gsdlenv = $self->gsdlhome_independent($ivideo_filename);
     369    my $oflash_filename_gsdlenv = $self->gsdlhome_independent($oflash_filename);
     370
    353371    if ($streaming_quality eq "high") {
    354372
     
    358376    }
    359377
    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\"";
    365385    $ffmpeg_cmd = "( $ffmpeg_cmd_pass1 ; $ffmpeg_cmd_pass2 )";
    366386    }
     
    368388    # single pass
    369389
    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\"";
    371391    }
    372392
     
    400420
    401421
    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\"";
    403427
    404428    return ($ffmpeg_cmd,$omp3_filename,$omp3_file);
     
    485509{
    486510    my $self = shift (@_);
    487     my ($ivideo_filename,$thumbnailfile,$thumbnailsize) = @_;
     511    my ($ivideo_filename,$thumbnailfile,$thumbnailwidth,$thumbnailheight) = @_;
    488512
    489513    my $output_dir = $self->{'cached_dir'};
     
    497521    $key_filename = "${key_filename_prefix}_0000.jpg" if (!-e $key_filename);
    498522
     523    my $key_filename_gsdlenv = $self->gsdlhome_independent($key_filename);
     524    my $thumbnailfile_gsdlenv = $self->gsdlhome_independent($thumbnailfile);
     525
    499526    my $command;
    500527
    501528    if (-e $key_filename) {
    502     $command = "convert -interlace plane -verbose -geometry $thumbnailsize"
    503         . "x$thumbnailsize \"$key_filename\" \"$thumbnailfile\"";
     529    $command = "convert -interlace plane -verbose -geometry $thumbnailwidth"
     530        . "x$thumbnailheight \"$key_filename_gsdlenv\" \"$thumbnailfile_gsdlenv\"";
    504531    }
    505532    else {
     
    508535    # => extract a from
    509536    # 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\"";
    513543
    514544    # fmpeg -i input.dv -r 1 -f image2 -s 120x96 images%05d.png
Note: See TracChangeset for help on using the changeset viewer.