Skip to content

Commit 3d7b521

Browse files
author
Anup Narkhede
committed
Fix VideoAnalyzerTest#test_analyzing_a_rotated_HDR_video failure with ffmpeg < 5.0
The VideoAnalyzer uses ffprobe (part of ffmpeg) to determine the rotation of a video. The VideoAnalyzer#angle returns tags["rotate"] if it is available, else it attempts to get "rotation" from the Display Matrix side_data. However, ffprobe exhibits different behavior with different versions: ffprobe version 4.4.2-0ubuntu on Ubuntu 22.04 returns a "rotate" : "90" tag. In contrast, ffprobe version 6.0-6ubuntu1 on Ubuntu 23.10 does not return the "rotate" tag; instead, it determines the angle from the display matrix side_data, which returns "rotation": -90. To account for this difference, we now check for both values in the test.
1 parent b16b516 commit 3d7b521

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

activestorage/test/analyzer/video_analyzer_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class ActiveStorage::Analyzer::VideoAnalyzerTest < ActiveSupport::TestCase
3535

3636
assert_equal 1080.0, metadata[:width]
3737
assert_equal 1920.0, metadata[:height]
38-
assert_equal(-90, metadata[:angle])
38+
assert_includes [90, -90], metadata[:angle]
3939
end
4040

4141
test "analyzing a video with rectangular samples" do

0 commit comments

Comments
 (0)