Fix wrong video dimensions for some rotated videos (#33008)

This commit is contained in:
Eugen Rochko 2024-11-21 11:58:04 +01:00 committed by GitHub
parent 2526b32ad3
commit 420ed155ba
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -46,6 +46,9 @@ class VideoMetadataExtractor
# For some video streams the frame_rate reported by `ffprobe` will be 0/0, but for these streams we # For some video streams the frame_rate reported by `ffprobe` will be 0/0, but for these streams we
# should use `r_frame_rate` instead. Video screencast generated by Gnome Screencast have this issue. # should use `r_frame_rate` instead. Video screencast generated by Gnome Screencast have this issue.
@frame_rate ||= @r_frame_rate @frame_rate ||= @r_frame_rate
# If the video has not been re-encoded by ffmpeg, it may contain rotation information,
# and we need to simulate applying it to the dimensions
@width, @height = @height, @width if video_stream[:side_data_list]&.any? { |x| x[:rotation].abs == 90 }
end end
if (audio_stream = audio_streams.first) if (audio_stream = audio_streams.first)