Sha256: e06e3dbf3c9e94ad008aa86b33e2369fa07ee6c437353e21ae692f39acea1e07

Contents?: true

Size: 1.95 KB

Versions: 1

Compression:

Stored size: 1.95 KB

Contents

# encoding: utf-8
require 'spec_helper'

describe Ffprober do
  describe "from_file", :if => Ffprober::Parser.ffprobe_version_valid? do
    before :each do
      @ffprobe = Ffprober::Parser.from_file('spec/assets/301-extracting_a_ruby_gem.m4v')
    end

    describe "format" do
      it "should determine the correct filename" do
        @ffprobe.format.filename.should eq("spec/assets/301-extracting_a_ruby_gem.m4v")
      end

      it "should find the correct size" do
        @ffprobe.format.size.should eq("130694")
      end

      it "should find the correct bit_rate" do
        @ffprobe.format.bit_rate.should eq("502669")
      end
    end

  end

  describe "from_json" do
    before :each do
      @ffprobe = Ffprober::Parser.from_json(File.read('spec/assets/301-extracting_a_ruby_gem.json'))
    end

    describe "format" do
      it "should determine the correct filename" do
        @ffprobe.format.filename.should eq("301-extracting-a-ruby-gem.mp4")
      end

      it "should find the correct size" do
        @ffprobe.format.size.should eq("44772490")
      end

      it "should find the correct bit_rate" do
        @ffprobe.format.bit_rate.should eq("361309")
      end
    end

    describe "audio_streams" do
      it "should determine the correct number of audio streams" do
        @ffprobe.audio_streams.count.should eq(1)
      end

      it "should determine the correct sample rate of the first audio stream" do
        @ffprobe.audio_streams.first.sample_rate.should eq("48000")
      end

    end

    describe "video_streams" do
      it "should determine the correct width of the first video streams" do
        @ffprobe.video_streams.first.width.should eq(960)
      end

      it "should determine the correct width of the first video streams" do
        @ffprobe.video_streams.first.height.should eq(600)
      end

      it "should determine the correct number of video streams" do
        @ffprobe.video_streams.count.should eq(1)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ffprober-0.0.2 spec/ffprober_spec.rb