lib/dragonfly-ffmpeg/encoder.rb in dragonfly-ffmpeg-0.1.5 vs lib/dragonfly-ffmpeg/encoder.rb in dragonfly-ffmpeg-0.1.6
- old
+ new
@@ -32,10 +32,11 @@
:video_codec => "libx264",
:resolution => "1280x720",
:frame_rate => 29.97,
:video_bitrate => 3072,
:audio_codec => "libfaac",
+ :audio_bitrate => 128,
:audio_channels => 2,
:audio_sample_rate => 48000,
:video_preset => "hq"
)
],
@@ -44,10 +45,11 @@
:video_codec => "libtheora",
:resolution => "1280x720",
:frame_rate => 29.97,
:video_bitrate => 3072,
:audio_codec => "libvorbis",
+ :audio_bitrate => 128,
:audio_channels => 2,
:audio_sample_rate => 48000
)
],
:webm => [
@@ -55,10 +57,11 @@
:video_codec => "libvpx",
:resolution => "1280x720",
:frame_rate => 29.97,
:video_bitrate => 3072,
:audio_codec => "libvorbis",
+ :audio_bitrate => 128,
:audio_channels => 2,
:audio_sample_rate => 48000,
:custom => "-f webm"
)
]
@@ -86,9 +89,14 @@
options.merge!(profile.encoding_options)
origin = ::FFMPEG::Movie.new(temp_object.path)
tempfile = new_tempfile(format, original_basename)
transcoded_file = origin.transcode(tempfile.path, options)
+
+ if(format.to_s == 'mp4' && `qt-faststart`)
+ `qt-faststart #{transcoded_file.path} #{transcoded_file.path}.tmp.mp4`
+ `mv #{transcoded_file.path}.tmp.mp4 #{transcoded_file.path}`
+ end
content = ::Dragonfly::TempObject.new(File.new(transcoded_file.path))
meta = {
:name => (original_basename + ".#{format}"),
:format => format,