You can work around this issue by using a temp file (with an mp3 extension), and then moving it into place where it can be handled by full_filename
as expected:
version :mp3 do
process :convert_to_mp3
def convert_to_mp3
temp_path = ... # generate good temp path, ending in '.mp3'
`ffmpeg -i #{ current_path.shellescape } -acodec libmp3lame -f mp3 #{ temp_path.shellescape }`
File.unlink(current_path)
FileUtils.mv(temp_path, current_path)
end
def full_filename(for_file)
super.chomp(File.extname(super)) + '.mp3'
end
end
Some options for generating your temp_path, for you to test and decide from:
current_path.chomp(File.extname(current_path)) + '.mp3'
Tempfile.new([File.basename(current_path), '.mp3']).path
Rails.root.join('tmp', 'mp3', Dir::Tmpname.make_tmpname([original_filename,'.mp3'], nil))