This commit is contained in:
BoHung Chiu 2022-08-25 10:14:24 +08:00
parent 986cca8c5c
commit 1ae2e0b103
1 changed files with 48 additions and 39 deletions

View File

@ -2,6 +2,9 @@ $:.push File.expand_path("../lib", __FILE__)
# Maintain your gem's version:
require "ad_banner/version"
bundle_update_flag = ARGV[0]=='update' || ARGV[0]=='install'
if bundle_update_flag
require "fileutils"
app_path = File.expand_path(__dir__)
template_path = ENV['PWD'] + '/app/templates'
all_template = Dir.glob(template_path+'/*/')
@ -28,8 +31,13 @@ end
begin
destination = ENV['PWD']+'/tmp/ffmpeg'
if Dir[destination].length==0
FileUtils.mkdir_p("#{ENV['PWD']}/tmp")
require 'open-uri'
if RUBY_VERSION.to_f >= 2.7
download = URI.open('https://github.com/ffbinaries/ffbinaries-prebuilt/releases/download/v4.2/ffmpeg-4.2-linux-64.zip')
else
download = open('https://github.com/ffbinaries/ffbinaries-prebuilt/releases/download/v4.2/ffmpeg-4.2-linux-64.zip')
end
save_zip_name = "#{ENV['PWD']}/tmp/ffmpeg-4.2-linux-64.zip"
IO.copy_stream(download, save_zip_name)
require 'zip'
@ -45,6 +53,7 @@ rescue => e
FileUtils.rmdir(destination) rescue nil
puts ["download ffmpeg failed",e]
end
end
#./ffmpeg -i 2.mp4 -c:v libvpx-vp9 -crf 35 -b:v 0 -b:a 96k -c:a libopus -filter:v fps=20 output.webm -cpu-used 4
# Describe your gem and declare its dependencies:
Gem::Specification.new do |s|