Index: ffmpeg_wrapper_class.inc
===================================================================
*** ffmpeg_wrapper_class.inc	(revision 1249)
--- ffmpeg_wrapper_class.inc	(working copy)
*************** class ffmpeg_wrapper {
*** 55,68 ****
      // Escape our command, but make sure that we allow | and ;
      $this->command = str_replace($pattern, $replace, escapeshellcmd($this->path . ' ' . $command)) . " -v $verbosity";
  
!     // Find the input file
!     preg_match("/-i.*?'(.*?)'/", $this->command, $matches);
!     $this->input_file = $matches[1];
! 
!     // Find the output file in the command if there was one.
!     // This is sort of hacky but is helpful for passing the file out.
!     preg_match("/.*'(.*?)'.*?$/", $this->command, $matches);
!     $this->output_file = ! empty($matches[1]) ? $matches[1] : NULL;
  
      // Keep track of where this is being executed
      $this->cwd = getcwd();
--- 55,88 ----
      // Escape our command, but make sure that we allow | and ;
      $this->command = str_replace($pattern, $replace, escapeshellcmd($this->path . ' ' . $command)) . " -v $verbosity";
  
!     // break the command apart and find each argument
!     $chars = preg_split('//', $this->command, -1, PREG_SPLIT_NO_EMPTY);
!     $count_chars = count($chars);
!     $args = array();
!     $inside_quote = FALSE;
!     for ($i = 0; $i < $count_chars; $i++) {
!       if ($chars[$i] == ' ') {
!         if (!$inside_quote) {
!           $args[] = '';
!         }
!         continue;
!       }
!       if ($chars[$i] == '"' || $chars[$i] == "'") {
!         $inside_quote = (!$inside_quote) ? TRUE : FALSE;
!       }
!       $args[(count($args) == 0) ? 0 : (count($args) - 1)] = $args[(count($args) == 0) ? 0 : (count($args) - 1)] . $chars[$i];
!     }
! 
!     // Find the input and output file from the arguments, removing any quotes
!     $args_count = count($args);
!     for ($i = 0; $i < $args_count; $i++) {
!       if ($args[$i] == '-i') {
!         $this->input_file = preg_replace('/(\'|")/', '', $args[$i + 1]);
!       }
!       if ($i > 0 && preg_match('/^[^\-].*$/', $args[$i]) > 0 && preg_match('/^[^\-].*$/', $args[$i - 1]) > 0) {
!         $this->output_file = preg_replace('/(\'|")/', '', $args[$i]);
!       }
!     }
  
      // Keep track of where this is being executed
      $this->cwd = getcwd();
