Skip to content

Commit 60f3540

Browse files
committed
fix: MOV files processed in iMovie should not be marked as audio with attached picture
1 parent 781774e commit 60f3540

6 files changed

Lines changed: 17 additions & 5 deletions

File tree

.github/workflows/ci.test.yml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,12 @@ jobs:
1515
strategy:
1616
matrix:
1717
ruby-version: ['3.0', '3.1', '3.2', '3.3']
18-
ffmpeg-version: ['6.0.1', '5.1.1', '4.4.1']
18+
ffmpeg-version: ['7.0.2', '6.0.1', '5.1.1', '4.4.1']
19+
20+
include:
21+
- ffmpeg-version: '7.0.2'
22+
download-path: 'releases'
23+
version-name: 'release'
1924

2025
steps:
2126
- uses: actions/checkout@v4
@@ -30,11 +35,11 @@ jobs:
3035
run: |
3136
sudo apt-get update
3237
sudo apt-get install -y wget
33-
wget https://johnvansickle.com/ffmpeg/old-releases/ffmpeg-${{ matrix.ffmpeg-version }}-amd64-static.tar.xz
34-
tar -xf ffmpeg-${{ matrix.ffmpeg-version }}-amd64-static.tar.xz
38+
wget https://johnvansickle.com/ffmpeg/${{ matrix.download-path || 'old-releases' }}/ffmpeg-${{ matrix.version-name || matrix.ffmpeg-version }}-amd64-static.tar.xz
39+
tar -xf ffmpeg-${{ matrix.version-name || matrix.ffmpeg-version }}-amd64-static.tar.xz
3540
sudo mv ffmpeg-${{ matrix.ffmpeg-version }}-amd64-static/ffmpeg /usr/local/bin/ffmpeg
3641
sudo mv ffmpeg-${{ matrix.ffmpeg-version }}-amd64-static/ffprobe /usr/local/bin/ffprobe
37-
rm -rf ffmpeg-${{ matrix.ffmpeg-version }}-amd64-static.tar.xz ffmpeg-${{ matrix.ffmpeg-version }}-amd64-static
42+
rm -rf ffmpeg-${{ matrix.version-name || matrix.ffmpeg-version }}-amd64-static.tar.xz ffmpeg-${{ matrix.ffmpeg-version }}-amd64-static
3843
3944
- name: Run RSpec
4045
run: bundle exec rspec

ffmpeg.gemspec

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ Gem::Specification.new do |s|
1717

1818
s.add_dependency('multi_json', '~> 1.8')
1919

20+
s.add_development_dependency('debug')
2021
s.add_development_dependency('rake', '~> 13.2')
2122
s.add_development_dependency('rspec', '~> 3.13')
2223
s.add_development_dependency('rubocop', '~> 1.63')

lib/ffmpeg/media.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ def audio_only?
196196
end
197197

198198
def audio_with_attached_pic?
199-
audio? && streams.any?(&:attached_pic?)
199+
audio? && video? && streams.select(&:video?).all?(&:attached_pic?)
200200
end
201201

202202
def silent?

spec/ffmpeg/media_spec.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,11 @@ module FFMPEG
271271
subject = described_class.new("#{fixture_path}/sounds/hello.wav")
272272
expect(subject.audio_with_attached_pic?).to be(false)
273273
end
274+
275+
it 'should return false if the media has both attached pictures and normal video streams' do
276+
subject = described_class.new("#{fixture_path}/movies/attached_pic.mov")
277+
expect(subject.audio_with_attached_pic?).to be(false)
278+
end
274279
end
275280

276281
%i[
13.9 MB
Binary file not shown.

spec/spec_helper.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
require 'bundler'
77
Bundler.require
88

9+
require 'debug'
910
require 'fileutils'
1011
require 'webmock/rspec'
1112
require 'webrick'

0 commit comments

Comments
 (0)