Fix #3400: Smarter thumbnail generation for videos

This commit is contained in:
evazion
2021-09-05 05:43:59 -05:00
parent 52847e4ce9
commit ef28576673
8 changed files with 50 additions and 17 deletions

View File

@@ -32,9 +32,7 @@ class MediaFile::Video < MediaFile
end
def preview_frame
vp = Tempfile.new(["video-preview", ".jpg"], binmode: true)
video.screenshot(vp.path, seek_time: 0)
MediaFile.open(vp.path)
FFmpeg.new(file).smart_video_preview
end
memoize :video, :preview_frame, :dimensions, :duration, :has_audio?