From 3aac12981c6db519e6fcbee5509b2a146c3f4d1e Mon Sep 17 00:00:00 2001 From: yufushiro <62991447+yufushiro@users.noreply.github.com> Date: Wed, 23 Aug 2023 15:44:56 +0900 Subject: [PATCH] Fix unexpected audio stream transcoding when uploaded video is eligible to passthrough (#26608) Co-authored-by: Claire --- lib/paperclip/transcoder.rb | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/paperclip/transcoder.rb b/lib/paperclip/transcoder.rb index be40b49241..0f2e30f7d5 100644 --- a/lib/paperclip/transcoder.rb +++ b/lib/paperclip/transcoder.rb @@ -37,12 +37,14 @@ module Paperclip @output_options['f'] = 'image2' @output_options['vframes'] = 1 when 'mp4' - @output_options['acodec'] = 'aac' - @output_options['strict'] = 'experimental' + unless eligible_to_passthrough?(metadata) + @output_options['acodec'] = 'aac' + @output_options['strict'] = 'experimental' - if high_vfr?(metadata) && !eligible_to_passthrough?(metadata) - @output_options['vsync'] = 'vfr' - @output_options['r'] = @vfr_threshold + if high_vfr?(metadata) + @output_options['vsync'] = 'vfr' + @output_options['r'] = @vfr_threshold + end end end