mirror of
https://github.com/lunaisnotaboy/mastodon.git
synced 2024-11-16 11:53:13 +00:00
ca22a22d7f
* Change animated GIF detection to not shell out to ImageMagick Signed-off-by: Eugen Rochko <eugen@zeonfederated.com> * Change video encoding parameters to limit to 10800 video frames Signed-off-by: Eugen Rochko <eugen@zeonfederated.com> * Limit GIF image size further Signed-off-by: Eugen Rochko <eugen@zeonfederated.com> * Always strip metadata from video files * Fix code style issues
17 lines
554 B
Ruby
17 lines
554 B
Ruby
# frozen_string_literal: true
|
|
|
|
module Paperclip
|
|
# This transcoder is only to be used for the MediaAttachment model
|
|
# to check when uploaded videos are actually gifv's
|
|
class VideoTranscoder < Paperclip::Processor
|
|
def make
|
|
meta = ::Av.cli.identify(@file.path)
|
|
|
|
attachment.instance.type = MediaAttachment.types[:gifv] unless meta[:audio_encode]
|
|
options[:format] = File.extname(attachment.instance.file_file_name)[1..-1] if options[:keep_same_format]
|
|
|
|
Paperclip::Transcoder.make(file, options, attachment)
|
|
end
|
|
end
|
|
end
|