Class: EnMasse::Dragonfly::FFMPEG::Encoder
- Inherits:
-
Object
- Object
- EnMasse::Dragonfly::FFMPEG::Encoder
- Includes:
- Dragonfly::Configurable
- Defined in:
- lib/dragonfly-ffmpeg/encoder.rb,
lib/dragonfly-ffmpeg/encoder/profile.rb
Defined Under Namespace
Classes: Profile
Instance Method Summary collapse
Instance Method Details
#encode(temp_object, format, profile = :html5, options = {}) ⇒ Object
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
# File 'lib/dragonfly-ffmpeg/encoder.rb', line 69 def encode(temp_object, format, profile = :html5, = {}) 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 .merge!(profile.) origin = ::FFMPEG::Movie.new(temp_object.path) tempfile = new_tempfile(format, original_filename) transcoded_file = origin.transcode(tempfile.path, ) content = ::Dragonfly::TempObject.new(File.new(transcoded_file.path)) = { :name => original_filename, :format => format, :ext => File.extname(transcoded_file.path) } [ content, ] end |