Skip to content

Commit

Permalink
use streamio-ffmpeg
Browse files Browse the repository at this point in the history
  • Loading branch information
youpy committed Nov 1, 2011
1 parent 16c23ef commit e8520db
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
1 change: 1 addition & 0 deletions Rakefile
Expand Up @@ -62,6 +62,7 @@ spec = Gem::Specification.new do |s|
s.add_dependency('ruby-mp3info')
s.add_dependency('riff', '<= 0.3.0')
s.add_dependency('tempdir')
s.add_dependency('streamio-ffmpeg')
#s.required_ruby_version = '>= 1.8.2'

s.files = %w(README.rdoc ChangeLog Rakefile) +
Expand Down
8 changes: 5 additions & 3 deletions lib/scissor/writer.rb
Expand Up @@ -2,6 +2,7 @@
require 'pathname'
require 'open4'
require 'temp_dir'
require 'streamio-ffmpeg'

module Scissor
class Writer
Expand All @@ -17,7 +18,6 @@ def initialize
@tracks = []

which('ecasound')
which('ffmpeg')
which('rubberband')
end

Expand All @@ -40,7 +40,8 @@ def join_fragments(fragments, outfile, tmpdir)
fragment_outfile = tmpdir + (Digest::MD5.hexdigest(fragment_filename.to_s) + '.wav')

unless fragment_outfile.exist?
run_command("ffmpeg -i \"#{fragment_filename}\" -ar 44100 \"#{fragment_outfile}\"")
movie = FFMPEG::Movie.new(fragment_filename.to_s)
movie.transcode(fragment_outfile.to_s, :audio_sample_rate => 44100)
end

cmd << "-a:#{index} -o:#{outfile} -y:#{position}"
Expand Down Expand Up @@ -115,7 +116,8 @@ def to_file(filename, options)

mix_files(tmpfiles, final_tmpfile = tmpdir + 'tmp.wav')

run_command("ffmpeg -ab #{options[:bitrate]} -i \"#{final_tmpfile}\" -ar 44100 \"#{full_filename}\"")
movie = FFMPEG::Movie.new(final_tmpfile.to_s)
movie.transcode(full_filename.to_s, :audio_sample_rate => 44100, :audio_bitrate => options[:bitrate])
end
end

Expand Down
2 changes: 2 additions & 0 deletions spec/scissor_spec.rb
Expand Up @@ -7,6 +7,8 @@

describe Scissor do
before do
FFMPEG.logger.level = Logger::WARN

@mp3 = Scissor(fixture('sample.mp3'))
mkdir '/tmp/scissor-test'
end
Expand Down

0 comments on commit e8520db

Please sign in to comment.