mirror of https://github.com/tootsuite/mastodon
Fixed crash when supplying FFMPEG_BINARY environment variable (#30022)
parent
5973d7a4b6
commit
a6089cdfca
|
@ -22,7 +22,7 @@ class VideoMetadataExtractor
|
||||||
private
|
private
|
||||||
|
|
||||||
def ffmpeg_command_output
|
def ffmpeg_command_output
|
||||||
command = Terrapin::CommandLine.new('ffprobe', '-i :path -print_format :format -show_format -show_streams -show_error -loglevel :loglevel')
|
command = Terrapin::CommandLine.new(Rails.configuration.x.ffprobe_binary, '-i :path -print_format :format -show_format -show_streams -show_error -loglevel :loglevel')
|
||||||
command.run(path: @path, format: 'json', loglevel: 'fatal')
|
command.run(path: @path, format: 'json', loglevel: 'fatal')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
if ENV['FFMPEG_BINARY'].present?
|
# frozen_string_literal: true
|
||||||
FFMPEG.ffmpeg_binary = ENV['FFMPEG_BINARY']
|
|
||||||
|
Rails.application.configure do
|
||||||
|
config.x.ffmpeg_binary = ENV['FFMPEG_BINARY'] || 'ffmpeg'
|
||||||
|
config.x.ffprobe_binary = ENV['FFPROBE_BINARY'] || 'ffprobe'
|
||||||
end
|
end
|
||||||
|
|
|
@ -35,7 +35,7 @@ module Paperclip
|
||||||
dst.binmode
|
dst.binmode
|
||||||
|
|
||||||
begin
|
begin
|
||||||
command = Terrapin::CommandLine.new('ffmpeg', '-i :source -loglevel :loglevel -y :destination', logger: Paperclip.logger)
|
command = Terrapin::CommandLine.new(Rails.configuration.x.ffmpeg_binary, '-i :source -loglevel :loglevel -y :destination', logger: Paperclip.logger)
|
||||||
command.run(source: @file.path, destination: dst.path, loglevel: 'fatal')
|
command.run(source: @file.path, destination: dst.path, loglevel: 'fatal')
|
||||||
rescue Terrapin::ExitStatusError
|
rescue Terrapin::ExitStatusError
|
||||||
dst.close(true)
|
dst.close(true)
|
||||||
|
|
|
@ -51,7 +51,7 @@ module Paperclip
|
||||||
command_arguments, interpolations = prepare_command(destination)
|
command_arguments, interpolations = prepare_command(destination)
|
||||||
|
|
||||||
begin
|
begin
|
||||||
command = Terrapin::CommandLine.new('ffmpeg', command_arguments.join(' '), logger: Paperclip.logger)
|
command = Terrapin::CommandLine.new(Rails.configuration.x.ffmpeg_binary, command_arguments.join(' '), logger: Paperclip.logger)
|
||||||
command.run(interpolations)
|
command.run(interpolations)
|
||||||
rescue Terrapin::ExitStatusError => e
|
rescue Terrapin::ExitStatusError => e
|
||||||
raise Paperclip::Error, "Error while transcoding #{@basename}: #{e}"
|
raise Paperclip::Error, "Error while transcoding #{@basename}: #{e}"
|
||||||
|
|
Loading…
Reference in New Issue