我正在尝试拍摄上传视频的快照。 以下Paperclip处理器在我的本地环境中工作正常,但在Heroku中失败。
module Paperclip
class VideoThumbnail < Processor
require 'RMagick'
attr_accessor :current_geometry, :target_geometry, :format, :whiny, :convert_options, :source_file_options
def initialize file, options = {}, attachment = nil
super
@file = file
@format_op = options[:format]
@format = File.extname(@file.path)
@basename = File.basename(@file.path, @format)
end
def make
src = @file
dst = Tempfile.new([@basename, ".png"])
dst.binmode
parameters = []
parameters << "-quiet"
parameters << ":source"
parameters << ":dest"
parameters = parameters.flatten.compact.join(" ").strip.squeeze(" ")
success = Paperclip.run("convert", parameters, :source => "#{File.expand_path(file.path)}[1]", :dest => File.expand_path(dst.path))
dst
end
end
end
错误如下:
2013-04-17T18:25:20.781972+00:00 heroku[router]: at=info method=POST path=/admin/content_items host=mclauncher.herokuapp.com fwd="186.55.107.205" dyno=web.1 connect=1ms service=12253ms status=500 bytes=643
2013-04-17T18:25:20.774386+00:00 app[web.1]: convert: Delegate failed `"ffmpeg" -v -1 -vframes %S -i "%i" -vcodec pam -an -f rawvideo -y "%u.pam" 2> "%Z"' @ delegate.c/InvokeDelegate/1060.
2013-04-17T18:25:20.779544+00:00 app[web.1]:
2013-04-17T18:25:20.774386+00:00 app[web.1]: convert: missing an image filename `/tmp/Valves20130417-2-170vly120130417-2-78zghs.png' @ convert.c/ConvertImageCommand/2838.
2013-04-17T18:25:20.774386+00:00 app[web.1]: convert: unable to open image `/tmp/magick-XXqompcz.pam': No such file or directory @ blob.c/OpenBlob/2480.
2013-04-17T18:25:20.779544+00:00 app[web.1]:
2013-04-17T18:25:20.779544+00:00 app[web.1]:
2013-04-17T18:25:20.780154+00:00 app[web.1]: Processing by Admin::ContentItemsController#create as HTML
2013-04-17T18:25:20.779544+00:00 app[web.1]: lib/paperclip_processors/video_thumbnail.rb:47:in `make'
2013-04-17T18:25:20.779544+00:00 app[web.1]: ):
2013-04-17T18:25:20.780154+00:00 app[web.1]: Command :: convert -quiet '/tmp/Valves20130417-2-170vly1.mp4[1]' '/tmp/Valves20130417-2-170vly120130417-2-78zghs.png'
2013-04-17T18:25:20.779544+00:00 app[web.1]:
2013-04-17T18:25:20.779544+00:00 app[web.1]: Cocaine::ExitStatusError (Command 'convert -quiet '/tmp/Valves20130417-2-170vly1.mp4[1]' '/tmp/Valves20130417-2-170vly120130417-2-78zghs.png'' returned 1. Expected 0
2013-04-17T18:25:20.779544+00:00 app[web.1]: Here is the command output:
2013-04-17T18:25:20.780154+00:00 app[web.1]: Parameters: {"utf8"=>"✓", "authenticity_token"=>"F5Y3tflzqvUlDbaOPBDiYHwUTGIVpoMaUIXL/QQfkbg=", "content_item"=>{"content_group_id"=>"3", "name"=>"asd", "emailable"=>"", "app_launch_url"=>"", "app_install_url"=>"", "file_item"=>#<ActionDispatch::Http::UploadedFile:0x000000061d2878 @original_filename="Valves.mp4", @content_type="video/mp4", @headers="Content-Disposition: form-data; name=\"content_item[file_item]\"; filename=\"Valves.mp4\"\r\nContent-Type: video/mp4\r\n", @tempfile=#<File:/tmp/RackMultipart20130417-2-1wvc61m>>}, "commit"=>"Create Content item"}
任何帮助?