Ignore:
Timestamp:
2012-04-05T15:53:05+12:00 (12 years ago)
Author:
davidb
Message:

Updates to code that take account of changes in the central PM modules

File:
1 edited

Legend:

Unmodified
Added
Removed
  • gs2-extensions/video-and-audio/trunk/src/perllib/plugins/AudioConverter.pm

    r18556 r25346  
    155155
    156156
    157 sub audio_stream_cmd
     157sub audio_stream_ffmpeg_cmd
    158158{
    159159    my $self = shift (@_);
    160     my ($iaudio_filename,
     160    my ($iaudio_filename, $ofile_ext,
    161161    $streaming_bitrate,$streaming_size,
    162162    $opt_streaming_achan, $opt_streaming_arate) = @_;
     
    171171    my $iaudio_root = $self->{'cached_file_root'};
    172172
    173     my $mp3_file = "${iaudio_root}_stream.mp3";
    174     my $mp3_filename = &util::filename_cat($output_dir,$mp3_file);
     173    my $op_file = "${iaudio_root}_stream.$ofile_ext";
     174    my $op_filename = &util::filename_cat($output_dir,$op_file);
    175175
    176176    my $exp_duration = $self->{'exp_duration'};
     
    188188
    189189    my $iaudio_filename_gsdlenv = $self->gsdlhome_independent($iaudio_filename);
    190     my $mp3_filename_gsdlenv = $self->gsdlhome_independent($mp3_filename);
    191 
    192    
    193     $ffmpeg_cmd = "ffmpeg -i \"$iaudio_filename_gsdlenv\" $all_opts -y \"$mp3_filename_gsdlenv\"";
    194 
    195     return ($ffmpeg_cmd,$mp3_filename,$mp3_file);
    196 }
     190    my $op_filename_gsdlenv = $self->gsdlhome_independent($op_filename);
     191
     192   
     193    $ffmpeg_cmd = "ffmpeg -i \"$iaudio_filename_gsdlenv\" $all_opts -y \"$op_filename_gsdlenv\"";
     194
     195    return ($ffmpeg_cmd,$op_filename,$op_file);
     196}
     197
     198
     199
     200sub stream_mp4_audio_cmd
     201{
     202    my $self = shift (@_);
     203    my ($ivideo_filename,$streaming_HQ_size, $streaming_HQ_AudioBitrate) = @_;
     204
     205    my $output_dir = $self->{'cached_dir'};
     206    my $ivideo_root = $self->{'cached_file_root'};
     207
     208    my $omp4_file = "${ivideo_root}_aHQstream.mp4";
     209    my $omp4_filename = &util::filename_cat($output_dir,$omp4_file);
     210
     211
     212    #my $exp_duration = $self->{'exp_duration'};
     213    #my $t_opt = (defined $exp_duration) ? "-t $exp_duration" : "";
     214
     215    my $deinterlace = $self->{'videoDeinterlacingFilter'};
     216    my $video_processing_parameters;   
     217    # Use specific resizing algorythms depending if we need to downsize the video resolution or not
     218    if(!$streaming_HQ_size || $streaming_HQ_size eq "fullsize") {
     219        $video_processing_parameters = "--strict-anamorphic";
     220    } else {
     221        $video_processing_parameters = "-w $streaming_HQ_size --loose-anamorphic";
     222    }
     223    # Use the deinterlace video filter if enabled in the plugin
     224    if ($deinterlace eq "true")
     225    {
     226        $video_processing_parameters .= " --decomb";
     227    }
     228
     229    my $ivideo_filename_gsdlenv = $self->gsdlhome_independent($ivideo_filename);
     230    my $omp4_filename_gsdlenv = $self->gsdlhome_independent($omp4_filename);
     231   
     232    # Generate the pre and post video parameters for Handbrake v0.9.4
     233    my $pre_opts = "-t 1 -c 1";
     234    my $post_opts = "-f mp4 -O $video_processing_parameters -e x264 -a 1 -E faac -6 dpl2 -R Auto -B $streaming_HQ_AudioBitrate -D 0.0 -x ref=2:bframes=2:subq=6:mixed-refs=0:weightb=0:8x8dct=0:trellis=0";
     235
     236    my $handbrake_cmd = "HandbrakeCLI.exe -i \"$ivideo_filename_gsdlenv\" $pre_opts -o \"$omp4_filename_gsdlenv\" $post_opts";
     237
     238    #print STDERR "****\nHandbrake command: $handbrake_cmd\n****\n";
     239   
     240    return ($handbrake_cmd,$omp4_filename,$omp4_file);
     241}
     242
     243
    197244
    198245
Note: See TracChangeset for help on using the changeset viewer.