- Timestamp:
- 2009-08-20T16:55:18+12:00 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/gsdl-video/trunk/perllib/plugins/VideoConverter.pm
r20111 r20346 121 121 'deft' => "200k", 122 122 'reqd' => "no" }, 123 { 'name' => "streamingHQsize", 124 'desc' => "{VideoPlugin.streamingsize}", 125 'type' => "int", 126 'deft' => "576", 127 'reqd' => "no" }, 128 { 'name' => "streamingHQVideoBitrate", 129 'desc' => "{VideoPlugin.streamingbitrate}", 130 'type' => "int", 131 'deft' => "426", 132 'reqd' => "no" }, 133 { 'name' => "streamingHQAudioBitrate", 134 'desc' => "{VideoPlugin.streamingbitrate}", 135 'type' => "int", 136 'deft' => "86", 137 'reqd' => "no" }, 123 138 124 139 { 'name' => "minimumsize", … … 373 388 374 389 390 sub stream_mp4_video_cmd 391 { 392 my $self = shift (@_); 393 my ($ivideo_filename,$streaming_HQ_size, $streaming_HQ_VideoBitrate, 394 $streaming_HQ_AudioBitrate) = @_; 395 396 397 my $output_dir = $self->{'cached_dir'}; 398 my $ivideo_root = $self->{'cached_file_root'}; 399 400 my $omp4_file = "${ivideo_root}_vHQstream.mp4"; 401 my $omp4_filename = &util::filename_cat($output_dir,$omp4_file); 402 403 404 #my $exp_duration = $self->{'exp_duration'}; 405 #my $t_opt = (defined $exp_duration) ? "-t $exp_duration" : ""; 406 407 408 409 my $size; 410 # Looks for empty string as well as fullsize string 411 if(!$streaming_HQ_size || $streaming_HQ_size eq "fullsize") { 412 $size = "--strict-anamorphic"; 413 } else { 414 $size = "-w $streaming_HQ_size --loose-anamorphic"; 415 } 416 417 418 my $ivideo_filename_gsdlenv = $self->gsdlhome_independent($ivideo_filename); 419 my $omp4_filename_gsdlenv = $self->gsdlhome_independent($omp4_filename); 420 421 my $pre_opts = "--decomb -t 1 -c 1"; 422 my $post_opts = "-f mp4 $size -O -e x264 -b $streaming_HQ_VideoBitrate -a 1 -E faac -6 dpl2 -B $streaming_HQ_AudioBitrate -D 0.0 -x ref=2:bframes=2:me-umh -v 1"; 423 424 my $handbrake_cmd = "HandbrakeCLI.exe -i \"$ivideo_filename_gsdlenv\" $pre_opts -o \"$omp4_filename_gsdlenv\" $post_opts"; 425 426 427 return ($handbrake_cmd,$omp4_filename,$omp4_file); 428 } 429 430 431 375 432 sub stream_flv_video_cmd 376 433 { … … 889 946 } 890 947 948 sub enable_h264_streaming 949 { 950 my $self = shift (@_); 951 my ($doc_obj,$originalfilename,$filename,$convertto_regenerated, 952 $video_width,$video_height) = @_; 953 954 955 my $section = $doc_obj->get_top_section(); 956 957 my $output_dir = $self->{'cached_dir'}; 958 my $ivideo_root = $self->{'cached_file_root'}; 959 960 # Generate the H264 video file format for streaming purposes using the cache feature if used 961 962 my $optionally_run_general_cmd = "run_uncached_general_cmd"; 963 if ($self->{'enable_cache'}) { 964 $optionally_run_general_cmd 965 = ($convertto_regenerated) ? "regenerate_general_cmd" : "run_cached_general_cmd"; 966 } 967 968 969 ## my $streaming_bitrate = $self->{'streamingbitrate'}; 970 ## my $streaming_size = $self->{'streamingsize'}; 971 my $streaming_HQ_size = $self->{'streamingHQsize'}; 972 my $streaming_HQ_VideoBitrate = $self->{'streamingHQVideoBitrate'}; 973 my $streaming_HQ_AudioBitrate = $self->{'streamingHQAudioBitrate'}; 974 975 ## my $streaming_quality = "high"; 976 977 my ($stream_cmd,$oflash_filename,$oflash_file) 978 = $self->stream_mp4_video_cmd($originalfilename || $filename, 979 $streaming_HQ_size, 980 $streaming_HQ_VideoBitrate, 981 $streaming_HQ_AudioBitrate); 982 983 984 my $streamable_options = { @{$self->{'handbrake_monitor'}}, 985 'message_prefix' => "MP4 Stream", 986 'message' => "Generating streamable MP4 video: $oflash_file" }; 987 988 989 my ($streamable_regenerated,$streamable_result,$streamable_had_error) 990 = $self->$optionally_run_general_cmd($stream_cmd,$oflash_filename,$streamable_options); 991 992 if (!$streamable_had_error) { 993 # my ($streamseekable_cmd,$ostreamseekable_filename) = $self->streamseekable_cmd($oflash_filename); 994 995 # my $streamseekable_options = { @{$self->{'flvtool2_monitor'}}, 996 # 'message_prefix' => "Stream Seekable", 997 # 'message' => "Reprocessing video stream to be seekable by timeline: $oflash_file" }; 998 999 # if ($streamable_regenerated) { 1000 # $self->run_general_cmd($streamseekable_cmd,$streamseekable_options); 1001 # } 1002 1003 my $streamable_url = $oflash_file; 1004 my $streamable_url_safe = $self->url_safe($streamable_url); 1005 1006 #add the metadata for the resulting file that should be open inside the flash video player 1007 $doc_obj->add_utf8_metadata ($section, "streamablevideo", $streamable_url_safe); 1008 $doc_obj->associate_file($oflash_filename,$oflash_file,"video/mp4", 1009 $section); 1010 } 1011 1012 1013 # 1014 # FlowPlayer.swf height+22 pixels 1015 # FlowPlayerBlack.swf height+16 pixels 1016 # FlowPlayerThermo.swf height+16 pixels 1017 # FlowPlayerWhite.swf height+26 pixels 1018 1019 my $flashwidth = $video_width; 1020 my $flashheight = $video_height + 22; 1021 1022 if ($self->{'extractkeyframes'}) { 1023 $flashheight += 100; 1024 } 1025 1026 $doc_obj->add_metadata ($section, "flashwidth", $flashwidth); 1027 $doc_obj->add_metadata ($section, "flashheight", $flashheight); 1028 1029 $self->{'oflash_file'} = $oflash_file; 1030 $self->{'oflash_filename'} = $oflash_filename; 1031 1032 return $streamable_regenerated; 1033 1034 1035 } 891 1036 892 1037 sub enable_full_streaming
Note:
See TracChangeset
for help on using the changeset viewer.