Changeset 23292

Show
Ignore:
Timestamp:
08.11.2010 11:51:38 (9 years ago)
Author:
max
Message:

Add direct streaming option to use the original video file directly without any processing. Depending on the format of the imported video file, VLC player may be required (flash is fussy regarding formats and containers).

Location:
gs2-extensions/video-and-audio/trunk/src/perllib/plugins
Files:
2 modified

Legend:

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

    r21826 r23292  
    6868    'list' => [{'name' => "disabled", 'desc' => "Do not create any video file optimised for streaming over the Internet."}, 
    6969               {'name' => "flv", 'desc' => "Uses the FLV format for streaming media. Better to target old computers."}, 
    70                {'name' => "mp4", 'desc' => "Uses the MP4 container with H264 and AAC codecs. Better quality at very low bitrates but more ressources intensive."}], 
     70               {'name' => "mp4", 'desc' => "Uses the MP4 container with H264 and AAC codecs. Better quality at very low bitrates but more ressources intensive."}, 
     71               {'name' => "direct", 'desc' => "Uses the original video file for direct streaming. The video player should be compatible with the format used!"}], 
    7172    'deft' => "disabled", 
    7273    'reqd' => "no" }]; 
  • gs2-extensions/video-and-audio/trunk/src/perllib/plugins/VideoConverter.pm

    r22486 r23292  
    11681168} 
    11691169 
     1170sub enable_direct_streaming 
     1171{ 
     1172    my $self = shift (@_); 
     1173    my ($doc_obj,$originalfilename,$filename,$file, 
     1174    $video_width,$video_height) = @_; 
     1175 
     1176    my $section = $doc_obj->get_top_section(); 
     1177     
     1178    my $ifilename = $originalfilename || $filename; 
     1179    #my $ifile = $self->gsdlhome_independent($ifilename); 
     1180    my $ifile = $file; 
     1181 
     1182    print STDERR "Using the original video file for direct streaming: $ifile\n"; 
     1183 
     1184    my $streamable_url = $ifile; 
     1185    my $streamable_url_safe = $self->url_safe($streamable_url); 
     1186     
     1187    my $outhandle = $self->{'outhandle'}; 
     1188 
     1189    my ($vtype, $width, $height, $duration, $durationDisplay, $vsize, 
     1190        $vcodec,$vrate,$fps,$atype,$afreq,$achan,$arate,$metadata_table) = identifyMI($ifilename,$outhandle,0); 
     1191    #Add the most common metadata extracted by MediaInfo from the streamable video file 
     1192    $doc_obj->add_utf8_metadata ($section, "tv.HQStreamingVideoFormat", $vtype); 
     1193    $doc_obj->add_utf8_metadata ($section, "tv.HQStreamingVideoFileSize", $vsize); 
     1194    $doc_obj->add_utf8_metadata ($section, "tv.HQStreamingWidth", $width); 
     1195    $doc_obj->add_utf8_metadata ($section, "tv.HQStreamingHeight", $height); 
     1196    $doc_obj->add_utf8_metadata ($section, "tv.HQStreamingDuration", $durationDisplay); 
     1197    $doc_obj->add_utf8_metadata ($section, "tv.HQStreamingFPS", $fps); 
     1198    $doc_obj->add_utf8_metadata ($section, "tv.HQStreamingVideoCodec", $vcodec); 
     1199    $doc_obj->add_utf8_metadata ($section, "tv.HQStreamingVideoBitrate", $vrate); 
     1200    $doc_obj->add_utf8_metadata ($section, "tv.HQStreamingAudioCodec", $atype); 
     1201    $doc_obj->add_utf8_metadata ($section, "tv.HQStreamingAudioBitrate", $arate); 
     1202    #$doc_obj->add_utf8_metadata ($section, "tv.HQStreamingFileBitrate", $vrate + $arate); 
     1203     
     1204    my $get_max_metadata = $self->{'getMaximumMetadata'}; 
     1205    if ($get_max_metadata eq "true"){ 
     1206        foreach my $metaname(keys %$metadata_table) 
     1207        { 
     1208            my $metaval = $metadata_table->{$metaname}; 
     1209            $doc_obj->add_utf8_metadata ($section, $metaname, $metaval); 
     1210        } 
     1211    } 
     1212     
     1213    #add the metadata for the resulting file that should be open inside the flash video player 
     1214    $doc_obj->add_utf8_metadata ($section, "streamablevideo", $streamable_url_safe); 
     1215    $doc_obj->associate_file($ifilename,$ifile,"application/octet-stream",$section); 
     1216 
     1217    my $flashwidth = $video_width; 
     1218    my $flashheight = $video_height + 22; 
     1219 
     1220    if ($self->{'extract_keyframes'}) { 
     1221    $flashheight += 100; 
     1222    } 
     1223 
     1224    $doc_obj->add_metadata ($section, "flashwidth",    $flashwidth); 
     1225    $doc_obj->add_metadata ($section, "flashheight",   $flashheight); 
     1226      
     1227    $self->{'oflash_file'} = $ifile; 
     1228    $self->{'oflash_filename'} = $ifilename; 
     1229 
     1230} 
     1231 
     1232 
    11701233sub enable_h264_streaming 
    11711234{