diff --git a/.github/workflows/ci.test.yml b/.github/workflows/ci.test.yml index 5024710..1c36d99 100644 --- a/.github/workflows/ci.test.yml +++ b/.github/workflows/ci.test.yml @@ -15,7 +15,12 @@ jobs: strategy: matrix: ruby-version: ['3.0', '3.1', '3.2', '3.3'] - ffmpeg-version: ['6.0.1', '5.1.1', '4.4.1'] + ffmpeg-version: ['7.0.2', '6.0.1', '5.1.1', '4.4.1'] + + include: + - ffmpeg-version: '7.0.2' + download-path: 'releases' + version-name: 'release' steps: - uses: actions/checkout@v4 @@ -30,11 +35,11 @@ jobs: run: | sudo apt-get update sudo apt-get install -y wget - wget https://johnvansickle.com/ffmpeg/old-releases/ffmpeg-${{ matrix.ffmpeg-version }}-amd64-static.tar.xz - tar -xf ffmpeg-${{ matrix.ffmpeg-version }}-amd64-static.tar.xz + wget https://johnvansickle.com/ffmpeg/${{ matrix.download-path || 'old-releases' }}/ffmpeg-${{ matrix.version-name || matrix.ffmpeg-version }}-amd64-static.tar.xz + tar -xf ffmpeg-${{ matrix.version-name || matrix.ffmpeg-version }}-amd64-static.tar.xz sudo mv ffmpeg-${{ matrix.ffmpeg-version }}-amd64-static/ffmpeg /usr/local/bin/ffmpeg sudo mv ffmpeg-${{ matrix.ffmpeg-version }}-amd64-static/ffprobe /usr/local/bin/ffprobe - rm -rf ffmpeg-${{ matrix.ffmpeg-version }}-amd64-static.tar.xz ffmpeg-${{ matrix.ffmpeg-version }}-amd64-static + rm -rf ffmpeg-${{ matrix.version-name || matrix.ffmpeg-version }}-amd64-static.tar.xz ffmpeg-${{ matrix.ffmpeg-version }}-amd64-static - name: Run RSpec run: bundle exec rspec diff --git a/ffmpeg.gemspec b/ffmpeg.gemspec index b74a06c..6d593a4 100644 --- a/ffmpeg.gemspec +++ b/ffmpeg.gemspec @@ -17,6 +17,7 @@ Gem::Specification.new do |s| s.add_dependency('multi_json', '~> 1.8') + s.add_development_dependency('debug') s.add_development_dependency('rake', '~> 13.2') s.add_development_dependency('rspec', '~> 3.13') s.add_development_dependency('rubocop', '~> 1.63') diff --git a/lib/ffmpeg/media.rb b/lib/ffmpeg/media.rb index 453f90d..98cd638 100644 --- a/lib/ffmpeg/media.rb +++ b/lib/ffmpeg/media.rb @@ -196,7 +196,7 @@ def audio_only? end def audio_with_attached_pic? - audio? && streams.any?(&:attached_pic?) + audio? && video? && streams.select(&:video?).all?(&:attached_pic?) end def silent? diff --git a/spec/ffmpeg/media_spec.rb b/spec/ffmpeg/media_spec.rb index 9802648..b16dad6 100644 --- a/spec/ffmpeg/media_spec.rb +++ b/spec/ffmpeg/media_spec.rb @@ -271,6 +271,11 @@ module FFMPEG subject = described_class.new("#{fixture_path}/sounds/hello.wav") expect(subject.audio_with_attached_pic?).to be(false) end + + it 'should return false if the media has both attached pictures and normal video streams' do + subject = described_class.new("#{fixture_path}/movies/attached_pic.mov") + expect(subject.audio_with_attached_pic?).to be(false) + end end %i[ diff --git a/spec/fixtures/movies/attached_pic.mov b/spec/fixtures/movies/attached_pic.mov new file mode 100644 index 0000000..5704968 Binary files /dev/null and b/spec/fixtures/movies/attached_pic.mov differ diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 6336ba1..7cd54f0 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -6,6 +6,7 @@ require 'bundler' Bundler.require +require 'debug' require 'fileutils' require 'webmock/rspec' require 'webrick'