--- media_mover/mm_ffmpeg/mm_ffmpeg.module	Fri Oct 17 05:29:50 2008
+++ media_mover/mm_ffmpeg/mm_ffmpeg.module	Wed Dec 03 17:14:24 2008
@@ -173,10 +173,15 @@
   }
 
   // build the output file path
-  // @ TODO make sure that the output file has the appropriate extension.
-  $output_file  = file_create_filename(
-    str_replace(' ', '_', basename($current_file)) .'.'. $configuration['ffmpeg_output_type'], 
-    media_mover_api_dir_path('ffmpeg/converted/'. $configuration['cid'])
+  // always take the last '.ext' from filename
+  $path_parts = pathinfo($current_file);
+  if(!isset($path_parts['filename'])){
+    $reversed_filename = strrev( $path_parts['basename'] );
+    $path_parts['filename'] = strrev( substr( $reversed_filename, strpos( $reversed_filename, '.' ) + 1 ) );
+  }
+  $output_file  = file_create_filename(
+    str_replace(' ', '_', $path_parts['filename']) .'.'. $configuration['ffmpeg_output_type'], 
+    media_mover_api_dir_path('ffmpeg/converted/'. $configuration['cid'])
   );
 
   // did the admin define a specific FFmpeg comand to run?
