rails icon indicating copy to clipboard operation
rails copied to clipboard

FFmpeg (5.0+) has updated the tag where rotation info is retrieved from

Open hahmed opened this issue 1 year ago • 1 comments

Summary

When running the test locally bin/test test/analyzer/video_analyzer_test.rb:22 (analyzing a rotated video).

I'm seeing it failing for FFmpeg in versions 5.0+ this is due to a change upstream.

The original code which pulls the rotation from tags is still left for older ffmpeg versions whilst the newer ffmpeg version 5.0+ will use the side_data to retrieve the rotation info.

Example output for side_data_list (when adding puts here https://github.com/rails/rails/pull/45837/files#diff-e69a5f7b5e4a55a776812dcc33b529c549984a5692048b0ec2683596abd999b4R107)

[{"side_data_type"=>"Display Matrix",   
  "displaymatrix"=>                     
   "\n00000000:            0       65536           0\n00000001:       -65536           0           0\n00000002:            0           0  1073741824\n",
  "rotation"=>-90}] 

Run the command below to see the full output for the rotated_video file.

ffprobe -print_format json -show_streams -show_format activestorage/test/fixtures/files/rotated_video.mp4

Other Information

It's unclear why on CI everything is green but this line https://github.com/rails/buildkite-config/blob/b44bcf075b8683283ee4ab06391c895e608f162e/Dockerfile#L91 looks like we are using the latest version, I have no idea why upstream is not failing 🤷‍♂️

Commits where "rotate" was removed;

  • https://github.com/FFmpeg/FFmpeg/commit/9dd104f6e263dce770541074d99b5286524f2a8b
  • https://github.com/FFmpeg/FFmpeg/commit/7b6012efaae549b8e624876dba9550cb003f98b1
  • Nothing mentioned on release notes that I could see https://www.ffmpeg.org
  • https://git.ffmpeg.org/gitweb/ffmpeg.git/commit/9dd104f6e263dce770541074d99b5286524f2a8b
  • http://git.ffmpeg.org/gitweb/ffmpeg.git/commit/ddef3d902f0e4cbd6be6b3e5df7ec158ce51488b (this is also relevant for context)

cc/ @eileencodes

hahmed avatar Aug 16 '22 22:08 hahmed

The tests look unrelated, will see if I can take a look but let me know if there is anything else needed for this 🙂

EDIT: actually, I committed a file by accident, let me remove

hahmed avatar Aug 26 '22 14:08 hahmed