From b120792f2752d358ea8142ab3f91f2ed93652fce Mon Sep 17 00:00:00 2001 From: Michael Stanclift Date: Fri, 26 Jul 2024 09:13:56 -0500 Subject: [PATCH] Adjust ffmpeg version detection in admin panel (#31130) Co-authored-by: Claire --- .../admin/metrics/dimension/software_versions_dimension.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/lib/admin/metrics/dimension/software_versions_dimension.rb b/app/lib/admin/metrics/dimension/software_versions_dimension.rb index a260a66e2a..71d6c63fb5 100644 --- a/app/lib/admin/metrics/dimension/software_versions_dimension.rb +++ b/app/lib/admin/metrics/dimension/software_versions_dimension.rb @@ -98,7 +98,8 @@ class Admin::Metrics::Dimension::SoftwareVersionsDimension < Admin::Metrics::Dim end def ffmpeg_version - version = `ffmpeg -version`.match(/ffmpeg version ([\d\.]+)/)[1] + version_output = Terrapin::CommandLine.new(Rails.configuration.x.ffprobe_binary, '-show_program_version -v 0 -of json').run + version = Oj.load(version_output, mode: :strict, symbol_keys: true).dig(:program_version, :version) { key: 'ffmpeg', @@ -106,7 +107,7 @@ class Admin::Metrics::Dimension::SoftwareVersionsDimension < Admin::Metrics::Dim value: version, human_value: version, } - rescue Errno::ENOENT + rescue Terrapin::CommandNotFoundError, Terrapin::ExitStatusError, Oj::ParseError nil end