You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

16 lines
554 B

  1. # frozen_string_literal: true
  2. module Paperclip
  3. # This transcoder is only to be used for the MediaAttachment model
  4. # to check when uploaded videos are actually gifv's
  5. class VideoTranscoder < Paperclip::Processor
  6. def make
  7. meta = ::Av.cli.identify(@file.path)
  8. attachment.instance.type = MediaAttachment.types[:gifv] unless meta[:audio_encode]
  9. options[:format] = File.extname(attachment.instance.file_file_name)[1..-1] if options[:keep_same_format]
  10. Paperclip::Transcoder.make(file, options, attachment)
  11. end
  12. end
  13. end