Index: /gs2-extensions/video-and-audio/trunk/src/perllib/plugins/VideoConverter.pm
===================================================================
--- /gs2-extensions/video-and-audio/trunk/src/perllib/plugins/VideoConverter.pm	(revision 25515)
+++ /gs2-extensions/video-and-audio/trunk/src/perllib/plugins/VideoConverter.pm	(revision 25516)
@@ -121,4 +121,12 @@
 	'deft' => "false",
 	'reqd' => "no" },
+	
+	{ 'name' => "keyframesize",
+	'desc' => "{ImageConverter.keyframesize}",
+	'type' => "int",
+	'deft' => "520",
+	'range' => "1,",
+	'reqd' => "no" },
+	
 	   { 'name' => "keyframes_algorithm",
 	'desc' => "{VideoPlugin.keyframesAlgorithm}",
@@ -602,5 +610,5 @@
 {
     my $self = shift (@_);
-    my ($ivideo_filename) = @_;
+    my ($ivideo_filename,$video_width,$video_height) = @_;
 
     my $video_ext_dir = &util::filename_cat($ENV{'GSDLHOME'},"ext","video");
@@ -620,13 +628,16 @@
 	my $mtn_detect_blank = $mtn_detect_blank_perc/100.0;
 	
-	my $keyframe_height;
-	if ($self->{'create_screenview'} eq "true") {
-		$keyframe_height = $self->{'screenviewsize'};
-	}
-	else {
+	my $keyframe_height = $self->{'keyframesize'};
+	
+#	if ($self->{'create_screenview'} eq "true") {
+#		$keyframe_height = $self->{'screenviewsize'};
+#	}
+#	else {
 		# assume thumbnail size
-		$keyframe_height = $self->{'thumbnailsize'};
-	}
-		
+#		$keyframe_height = $self->{'thumbnailsize'};
+#	}
+	
+	
+	
 	$main_opts .= " -B $mtn_skip_intro_secs";
 	$main_opts .= " -E $mtn_skip_end_secs";
@@ -1010,5 +1021,5 @@
 	
 	#print STDERR "***** grabbing keyframe as 50% of $video_duration\n";
-	my $ss_opt = ($video_duration / 1000.0) * 0.35;
+	my $ss_opt = ($video_duration / 1000.0) * 0.45;
 	#print STDERR "*** ssopt = $ss_opt\n";
 	
@@ -1108,5 +1119,5 @@
 			     'keyframeindex' => $keyframe_index,
 			     'timestamp' => $time_msec,
-			     'thumb' => $f,
+			     'thumb' => &util::filename_cat("frames",$f),
 			     'keyframenum' => $keyframe_index };
 	
Index: /gs2-extensions/video-and-audio/trunk/src/perllib/plugins/VideoPlugin.pm
===================================================================
--- /gs2-extensions/video-and-audio/trunk/src/perllib/plugins/VideoPlugin.pm	(revision 25515)
+++ /gs2-extensions/video-and-audio/trunk/src/perllib/plugins/VideoPlugin.pm	(revision 25516)
@@ -121,8 +121,23 @@
 }
 
-
+ 
 sub extract_keyframes
 {
     my $self = shift (@_);
+    my ($doc_obj,$originalfilename,$filename, $video_width,$video_height) = @_;
+	
+	
+	if ($self->{'keyframes_algorithm'} eq "ffkeyframe") {
+		$self->extract_ffKeyframes($doc_obj,$originalfilename,$filename);
+	}
+	else {
+		$self->extract_mtnKeyframes($doc_obj,$originalfilename,$filename, $video_width,$video_height);
+	}
+}
+	
+  
+sub extract_ffKeyframes
+{
+    my $self = shift (@_);
     my ($doc_obj,$originalfilename,$filename) = @_;
 
@@ -134,5 +149,5 @@
     # Generate the keyframes with ffmpeg and hive
     my $ifilename = $originalfilename || $filename;
-    my ($keyframe_cmd,$okeyframe_filename) = $self->keyframe_cmd($ifilename);
+    my ($keyframe_cmd,$okeyframe_filename) = $self->ffKeyframe_cmd($ifilename);
     
     my $keyframe_options = { @{$self->{'ffmpeg_monitor'}},
@@ -150,4 +165,37 @@
 }
 
+
+sub extract_mtnKeyframes
+{
+    my $self = shift (@_);
+    my ($doc_obj,$originalfilename,$filename,$video_width,$video_height) = @_;
+
+    my $section = $doc_obj->get_top_section();
+
+    my $output_dir   = $self->{'cached_dir'};
+    my $ivideo_root  = $self->{'cached_file_root'};
+
+	my $verbosity = $self->{'verbosity'};
+    my $outhandle = $self->{'outhandle'};
+	
+    # Generate the keyframes with ffmpeg and hive
+    my $ifilename = $originalfilename || $filename;
+    my ($keyframe_cmd,$okeyframe_filename) = $self->mtnKeyframe_cmd($ifilename, $video_width,$video_height);
+    
+    my $keyframe_options = {  'verbosity' => $verbosity,
+				 'outhandle' => $outhandle,
+			     'message_prefix' => "Keyframe",
+			     'message' => "Extracting keyframes" }; 
+    
+    $self->run_cached_general_cmd($keyframe_cmd,
+				  $ifilename,$okeyframe_filename,
+				  $keyframe_options);
+				  
+    $self->parse_shot_dir();
+
+    my $keep_keyframe_timeline = $self->{'keep_keyframe_timeline'};
+    $self->associate_keyframes($doc_obj,$section,$keep_keyframe_timeline);
+
+}
 
 
@@ -340,8 +388,23 @@
     }
 
-    my ($video_type, $video_width, $video_height, $video_duration, $durationDisplay, $video_size,
-	$vcodec,$vrate,$vfps,$atype,$afreq,$achan,$arate) 
-	= &VideoConverter::identify($filename, $outhandle, $verbosity);
-
+	my $identify_hash = &VideoConverter::identifyMI($filename, $outhandle, $verbosity);
+	
+	my $video_type     = $identify_hash->{'vtype'};
+	my $video_width    = $identify_hash->{'width'};
+	my $video_height   = $identify_hash->{'height'};
+	my $video_duration = $identify_hash->{'duration'};
+	my $video_size     = $identify_hash->{'filesize'};
+	my $vcodec         = $identify_hash->{'vcodec'};
+	my $vfps           = $identify_hash->{'fps'};
+	my $atype          = $identify_hash->{'acodec'};
+	my $afreq          = $identify_hash->{'afreq'};
+	my $achan          = $identify_hash->{'achan'};
+	my $arate          = $identify_hash->{'arate'};
+
+    if ($video_duration =~ m/^(\d\d):(\d\d):(\d\d)\.(\d+)$/) {
+	  # ffmpeg can generate durations in this form.
+	  # MediaInof works in milliseconds, so work to this same resolution
+		$video_duration = ($1*3600 + $2*60 + $3 + ($4/10.0)) * 1000.0;
+    }
 
 #    if ($video_duration =~ m/^(\d\d):(\d\d):(\d\d)\.(\d+)$/) {
@@ -361,8 +424,4 @@
 	$vfps = 25;
     }
-
-    #my ($dur_hour,$dur_min,$dur_sec) 
-	#= ($video_duration =~ m/(\d+):(\d+):(\d+\.\d+)/);
-    #my $total_dur_secs = $dur_hour*3600 + $dur_min*60 + $dur_sec;
 	
     my $total_dur_secs = $video_duration / 1000;
@@ -505,4 +564,5 @@
 
     $file = $file_unicode;
+
 #    my $filemeta = $self->filename_to_utf8_metadata($file);
 #    my $filemeta_url_safe = $self->url_safe($filemeta);
@@ -550,6 +610,6 @@
 
 
-    if ($self->{'extract_keyframes'}) {
-		$self->extract_keyframes($doc_obj,$originalfilename,$filename);
+    if ($self->{'create_keyframes'} eq "true") {
+		$self->extract_keyframes($doc_obj,$originalfilename,$filename,$video_width,$video_height);
     }
 
@@ -626,5 +686,5 @@
     }
 
-    if ($self->{'extract_keyframes'}) {
+    if (($self->{'create_keyframes'}  eq "true") && ($self->{'create_montage'}  eq "true")) {
 	$self->extract_keyframes_montage($doc_obj,$filename,$thumbnailtype);
     }
@@ -686,5 +746,5 @@
 	? 1 : 0;
 
-    if (($enable_streaming) && ($self->{'extract_keyframes'})) {
+    if (($enable_streaming) && ($self->{'create_keyframes'} eq "true")) {
 	my $section = $doc_obj->get_top_section();
 	my $oflash_filename = $self->{'oflash_filename'};
@@ -713,4 +773,20 @@
 
 
+sub open_on_cue
+{
+    my ($self) = shift @_;
+    my ($cue_filename) = @_;
+
+    open(CUEOUT,">$cue_filename")
+	|| die "Unable to open $cue_filename: $!\n";
+    print CUEOUT "<tags>\n";
+
+}
+
+sub close_on_cue
+{
+    print CUEOUT "</tags>\n";
+    close(CUEOUT);
+}
 
 sub output_distributed_keyframes
@@ -970,5 +1046,5 @@
     if ($element eq "seg") {
 
-	$self->output_distributed_keyframes($self->{'keyframe_timeline'},$self->{'keep_keyframes'});
+	$self->output_distributed_keyframes($self->{'keyframe_timeline'},$self->{'ffkeyframe_num_shots'});
 
 
