diff --git a/lib/ffmpeg/movie.rb b/lib/ffmpeg/movie.rb index 0e148bb3..07037283 100644 --- a/lib/ffmpeg/movie.rb +++ b/lib/ffmpeg/movie.rb @@ -13,7 +13,7 @@ class Movie UNSUPPORTED_CODEC_PATTERN = /^Unsupported codec with id (\d+) for input stream (\d+)$/ - def initialize(path) + def initialize(path, options = []) @path = path if remote? @@ -28,7 +28,7 @@ def initialize(path) @path = path # ffmpeg will output to stderr - command = [FFMPEG.ffprobe_binary, '-i', path, *%w(-print_format json -show_format -show_streams -show_error)] + command = [FFMPEG.ffprobe_binary, '-i', path, *%w(-print_format json -show_format -show_streams -show_error ) + options] std_output = '' std_error = '' diff --git a/spec/ffmpeg/movie_spec.rb b/spec/ffmpeg/movie_spec.rb index 2e994fc2..ad32ec57 100644 --- a/spec/ffmpeg/movie_spec.rb +++ b/spec/ffmpeg/movie_spec.rb @@ -102,6 +102,13 @@ module FFMPEG end end end + + context 'given additional params' do + it 'should use it for ffprobe' do + pcm_file = FFMPEG::Movie.new("#{fixture_path}/movies/audio.pcm", %w(-f s16le)) + expect(pcm_file.valid?).to eq true + end + end end context "given a non movie file" do @@ -389,7 +396,7 @@ module FFMPEG end it "should parse the creation_time" do - expect(movie.creation_time).to eq(Time.parse("2010-02-05 16:05:04 UTC")) + expect(movie.creation_time).to eq(Time.parse("2010-02-05 16:05:04")) end it "should parse video stream information" do @@ -505,21 +512,6 @@ module FFMPEG end end - describe "transcode" do - let(:movie) { Movie.new("#{fixture_path}/movies/awesome movie.mov")} - - it "should run the transcoder" do - - transcoder_double = double(Transcoder) - expect(Transcoder).to receive(:new). - with(movie, "#{tmp_path}/awesome.flv", {custom: "-vcodec libx264"}, preserve_aspect_ratio: :width). - and_return(transcoder_double) - expect(transcoder_double).to receive(:run) - - movie.transcode("#{tmp_path}/awesome.flv", {custom: "-vcodec libx264"}, preserve_aspect_ratio: :width) - end - end - describe "transcode" do let(:movie) { Movie.new("#{fixture_path}/movies/awesome movie.mov")} diff --git a/spec/fixtures/movies/audio.pcm b/spec/fixtures/movies/audio.pcm new file mode 100644 index 00000000..7cafdeb6 Binary files /dev/null and b/spec/fixtures/movies/audio.pcm differ