summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicolai Søborg <NicolaiSoeborg@users.noreply.github.com>2023-08-18 08:32:47 +0200
committerClaire <claire.github-309c@sitedethib.com>2023-09-19 17:01:32 +0200
commit871e63edfff6415ebeaf6226830637838a5f2d23 (patch)
tree5ef3586501131ee40a0518dc8c98e3c286a54c03
parentbc4408db08e30e3956a9de7647043532396c6ba0 (diff)
Fix `frame_rate` for videos where `ffprobe` reports 0/0 (#26500)
-rw-r--r--app/lib/video_metadata_extractor.rb3
1 files changed, 3 insertions, 0 deletions
diff --git a/app/lib/video_metadata_extractor.rb b/app/lib/video_metadata_extractor.rb
index 2896620cb21..f27d34868a2 100644
--- a/app/lib/video_metadata_extractor.rb
+++ b/app/lib/video_metadata_extractor.rb
@@ -43,6 +43,9 @@ class VideoMetadataExtractor
@height = video_stream[:height]
@frame_rate = video_stream[:avg_frame_rate] == '0/0' ? nil : Rational(video_stream[:avg_frame_rate])
@r_frame_rate = video_stream[:r_frame_rate] == '0/0' ? nil : Rational(video_stream[:r_frame_rate])
+ # 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.
+ @frame_rate ||= @r_frame_rate
end
if (audio_stream = audio_streams.first)