lib/dragonfly-ffmpeg/encoder.rb in dragonfly-ffmpeg-0.1.1 vs lib/dragonfly-ffmpeg/encoder.rb in dragonfly-ffmpeg-0.1.2
- old
+ new
@@ -66,25 +66,26 @@
configurable_attr :output_directory, '/tmp'
def encode(temp_object, format, profile = :html5, options = {})
format = format.to_sym
+ original_filename = File.basename(temp_object.path, '.*')
raise UnsupportedFormat, "Format not supported - #{format}" unless supported_format?(format)
unless profile.is_a?(Profile)
raise UnknownEncoderProfile unless profile_defined?(format, profile.to_sym)
profile = get_profile(format, profile.to_sym)
end
options.merge!(profile.encoding_options)
origin = ::FFMPEG::Movie.new(temp_object.path)
- tempfile = new_tempfile(format, File.basename(temp_object.path, '.*'))
+ tempfile = new_tempfile(format, original_filename)
transcoded_file = origin.transcode(tempfile.path, options)
content = ::Dragonfly::TempObject.new(File.new(transcoded_file.path))
meta = {
- :name => File.basename(transcoded_file.path),
+ :name => original_filename,
:format => format,
:ext => File.extname(transcoded_file.path)
}
[ content, meta ]