Skip to content

Commit

Permalink
Adjust ffmpeg version detection in admin panel (mastodon#31130)
Browse files Browse the repository at this point in the history
Co-authored-by: Claire <[email protected]>
  • Loading branch information
vmstan and ClearlyClaire authored Jul 26, 2024
1 parent dfd4386 commit b120792
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -98,15 +98,16 @@ def imagemagick_version
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',
human_key: 'FFmpeg',
value: version,
human_value: version,
}
rescue Errno::ENOENT
rescue Terrapin::CommandNotFoundError, Terrapin::ExitStatusError, Oj::ParseError
nil
end

Expand Down

0 comments on commit b120792

Please sign in to comment.