Skip to content

Commit 897d73e

Browse files
committed
fix: correctly detect old-style MOV files (no ftyp box)
1 parent f164250 commit 897d73e

2 files changed

Lines changed: 15 additions & 5 deletions

File tree

lib/ffmpeg/media.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,11 +83,11 @@ def initialize(message, output)
8383
when /\basf_o\b/ then '.asf'
8484
when /\b(mov|mp4)\b/
8585
case major_brand
86-
when /\Aqt\b/i then '.mov'
87-
when /\Am4a\b/i then '.m4a'
88-
when /\Am4v\b/i then '.m4v'
89-
when /\Am4s\b/i then '.m4s'
90-
else '.mp4'
86+
when nil, /\Aqt\b/i then '.mov'
87+
when /\Am4a\b/i then '.m4a'
88+
when /\Am4v\b/i then '.m4v'
89+
when /\Am4s\b/i then '.m4s'
90+
else '.mp4'
9191
end
9292
when /\bmatroska\b/
9393
if streams

spec/ffmpeg/media_spec.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -609,6 +609,16 @@ module FFMPEG
609609
end
610610
end
611611

612+
context 'when the media is an old-style QuickTime MOV without an ftyp box' do
613+
let(:path) { fixture_media_file('rotated@0.mov') }
614+
615+
before { allow(subject).to receive(:major_brand).and_return(nil) }
616+
617+
it 'returns .mov' do
618+
expect(subject.extname).to eq('.mov')
619+
end
620+
end
621+
612622
context 'when the media is a WAV' do
613623
let(:path) { fixture_media_file('hello.wav') }
614624

0 commit comments

Comments
 (0)