Skip to content

Commit

Permalink
fix: MOV files processed in iMovie should not be marked as audio with…
Browse files Browse the repository at this point in the history
… attached picture
  • Loading branch information
kiskoza committed Nov 4, 2024
1 parent 781774e commit f27a991
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 5 deletions.
13 changes: 9 additions & 4 deletions .github/workflows/ci.test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
1 change: 1 addition & 0 deletions ffmpeg.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
2 changes: 1 addition & 1 deletion lib/ffmpeg/media.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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?
Expand Down
5 changes: 5 additions & 0 deletions spec/ffmpeg/media_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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[
Expand Down
Binary file added spec/fixtures/movies/attached_pic.mov
Binary file not shown.
1 change: 1 addition & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
require 'bundler'
Bundler.require

require 'debug'
require 'fileutils'
require 'webmock/rspec'
require 'webrick'
Expand Down

0 comments on commit f27a991

Please sign in to comment.