ffmpeg: generate smart previews as .png instead of .jpg

Generate smart previews as .png so we don't suffer recompression losses
when we convert the preview frame from a full size image down to a
150x150 .jpg thumbnail.
This commit is contained in:
evazion
2021-09-05 07:48:57 -05:00
parent 13f98c02e3
commit d7d3439d79

View File

@@ -14,12 +14,12 @@ class FFmpeg
@file = file.is_a?(String) ? File.open(file) : file
end
# Generate a .jpg preview image for a video or animation. Generates
# Generate a .png preview image for a video or animation. Generates
# thumbnails intelligently by avoiding blank frames.
#
# @return [MediaFile] the preview image
def smart_video_preview
vp = Tempfile.new(["video-preview", ".jpg"], binmode: true)
vp = Tempfile.new(["video-preview", ".png"], binmode: true)
# https://ffmpeg.org/ffmpeg.html#Main-options
# https://ffmpeg.org/ffmpeg-filters.html#thumbnail