diff options
author | ThibG <thib@sitedethib.com> | 2020-03-10 11:58:40 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-10 11:58:40 +0100 |
commit | 2c6099125d9ed5c2add62e84d5ba7b93de658910 (patch) | |
tree | b8709ff971d30d50262eb99328068bb33145c08f /lib/paperclip | |
parent | abd839488054b6de2dec9e7ec095d79e4a106573 (diff) |
Fix videos with unsupported colorspace not being transcoded (#13242)
Diffstat (limited to 'lib/paperclip')
-rw-r--r-- | lib/paperclip/video_transcoder.rb | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/lib/paperclip/video_transcoder.rb b/lib/paperclip/video_transcoder.rb index 0de548964..4d9544231 100644 --- a/lib/paperclip/video_transcoder.rb +++ b/lib/paperclip/video_transcoder.rb @@ -6,19 +6,21 @@ module Paperclip class VideoTranscoder < Paperclip::Processor def make movie = FFMPEG::Movie.new(@file.path) - actual_options = options - passthrough_options = actual_options[:passthrough_options] - actual_options = passthrough_options[:options] if passthrough?(movie, passthrough_options) attachment.instance.type = MediaAttachment.types[:gifv] unless movie.audio_codec - Paperclip::Transcoder.make(file, actual_options, attachment) + Paperclip::Transcoder.make(file, actual_options(movie), attachment) end private - def passthrough?(movie, options) - options && options[:video_codec_whitelist].include?(movie.video_codec) && options[:audio_codec_whitelist].include?(movie.audio_codec) + def actual_options(movie) + opts = options[:passthrough_options] + if opts && opts[:video_codecs].include?(movie.video_codec) && opts[:audio_codecs].include?(movie.audio_codec) && opts[:colorspaces].include?(movie.colorspace) + opts[:options] + else + options + end end end end |