Index: multimediafile.inc
===================================================================
--- multimediafile.inc	(revision 348)
+++ multimediafile.inc	(working copy)
@@ -81,6 +81,13 @@
       "INSERT into {files} (fid, nid, filename, filepath, filemime, filesize) VALUES (%d, %d, '%s', '%s', '%s', %d)",
       $file['fid'], $node->nid, $file['filename'], $file['filepath'], $file['filemime'], $file['filesize']
     );
+
+    // Convert the file to mp3 format if applicable.
+    if (($field['type'] == 'file_audio') &&
+        ($field['widget']['convert_to_mp3'])) {
+      _field_file_convert_mp3(&$file, $field);
+    }
+
     return (array)$file;
   }
   else {
@@ -236,3 +243,76 @@
   return $resource;
 //  return check_url(base_path(). $resource);
 }
+
+/**
+ * Convert an audio file field to audio/mpeg (mp3) format.
+ *
+ * @param array $file
+ *   The file to be converted.  It is passed by reference so that
+ *   attributes can be modified.
+ * @param array $field
+ *   Information related to the file field.
+ * @return boolean
+ *   TRUE is the file was converted, FALSE otherwise.
+ */
+function _field_file_convert_mp3(&$file, $field) {
+  $file = (object)$file;
+
+  // Set some ffmpeg parameters.
+  $ffmpeg_format    = 'mp3';
+  $ffmpeg_frequency = '44100';
+  $ffmpeg_bitrate   = '64k';
+  $ffmpeg_channels  = '2';
+  $ffmpeg_mime      = 'audio/mpeg';
+  $ffmpeg_path      = $field['widget']['ffmpeg_path'] ?
+                      $field['widget']['ffmpeg_path'] : '/usr/local/bin/ffmpeg';
+
+  // We can stop here if the file's already in the format we want.
+  $oldfile_bits = explode('.', $file->filename);
+  if (array_pop($oldfile_bits) == $ffmpeg_format) {
+    return FALSE;
+  }
+
+  // Create the new file name by changing the extension.
+  $newfile_name = implode('.', $oldfile_bits) . '.' . $ffmpeg_format;
+
+  // Get the path for the new file.
+  $newfile_path = dirname($file->filepath) . '/' . $newfile_name;
+
+  // Set the string of conversion arguments.
+  $ffmpeg_arguments = '-i ' . $file->filepath . ' ' .
+                      '-f ' . $ffmpeg_format . ' ' .
+                      '-acodec ' . $ffmpeg_format . ' ' .
+                      '-ar ' . $ffmpeg_frequency . ' ' .
+                      '-ab ' . $ffmpeg_bitrate . ' ' .
+                      '-ac ' . $ffmpeg_channels . ' ' .
+                      $newfile_path;
+
+  // Convert the file to one with the fresh file name.
+  $ffmpeg_results = shell_exec($ffmpeg_path . " " . $ffmpeg_arguments);
+
+  // Set an error message if the file could not be converted.
+  if (!(file_exists($newfile_path) && (filesize($newfile_path) > 0))) {
+    drupal_set_message(t("Your audio file could not be converted to $ffmpeg_mime ($ffmpeg_format) format.  Please upload a different file instead, as this one is most likely corrupt."), 'error');
+    return FALSE;
+  }
+
+  // Delete the old file.
+  file_delete($file->filepath);
+
+  // Update the file object.
+  $file->filepath = $newfile_path;
+  $file->filename = $newfile_name;
+  $file->filemime = $ffmpeg_mime;
+  $file->filesize = filesize($newfile_path);
+
+  // Update the database with the updated file information.
+  db_query("UPDATE {files} " .
+           "SET filepath='%s', filename='%s', filesize=%d, filemime='%s' " .
+           "WHERE fid=%d",
+           $file->filepath, $file->filename, $file->filesize, $file->filemime,
+           $file->fid);
+
+  // Report success.
+  return TRUE;
+}
Index: audiofield.module
===================================================================
--- audiofield.module	(revision 348)
+++ audiofield.module	(working copy)
@@ -121,11 +121,33 @@
         '#size' => 64,
         '#description' => t('Extensions a user can upload to this field. Seperate extensions with a space and do not include the leading dot.')
       );
+      $form['convert_to_mp3'] = array(
+        '#type' => 'checkbox',
+        '#title' => t('Convert file to audio/mpeg (mp3) format with FFMPEG?'),
+        '#default_value' => $widget['convert_to_mp3'] ?
+                            $widget['convert_to_mp3'] : 0,
+        '#return_value' => 1,
+        '#description' => t('If this option is selected, and the FFMPEG utility is installed on your system, the file will be converted when saved.'),
+      );
+      $form['ffmpeg_path'] = array(
+        '#type' => 'textfield',
+        '#title' => t('Path to FFMPEG executable'),
+        '#default_value' => $widget['ffmpeg_path'] ?
+                            $widget['ffmpeg_path'] : '/usr/local/bin/ffmpeg',
+        '#size' => 64,
+        '#description' => t('Enter the file name (with full path) of the ' .
+                            'FFMPEG executable.'),
+      );
       return $form;
     case 'validate':
       break;
     case 'save':
-      return array('file_extensions', 'upload_path');
+      return array(
+        'file_extensions',
+        'upload_path',
+        'convert_to_mp3',
+        'ffmpeg_path',
+      );
   }
 }
 
