Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
563 views
in Technique[技术] by (71.8m points)

heroku paperclip video error Av::UnableToDetect (Unable to detect any supported library):

I am trying to upload video to my website with paperclip and it work perfectly locally but in heroku I got this error

 ActionController::RoutingError (No route matches [GET] "/videos/original/missing.png"):
2021-01-06T19:53:12.425050+00:00 app[web.1]: vendor/bundle/ruby/2.6.0/gems/actionpack-4.2.11.1/lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call'
2021-01-06T19:53:12.425050+00:00 app[web.1]: vendor/bundle/ruby/2.6.0/gems/actionpack-4.2.11.1/lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
2021-01-06T19:53:12.425050+00:00 app[web.1]: vendor/bundle/ruby/2.6.0/gems/railties-4.2.11.1/lib/rails/rack/logger.rb:38:in `call_app'
2021-01-06T19:53:12.425052+00:00 app[web.1]: vendor/bundle/ruby/2.6.0/gems/railties-4.2.11.1/lib/rails/rack/logger.rb:20:in `block in call'
2021-01-06T19:53:12.425052+00:00 app[web.1]: vendor/bundle/ruby/2.6.0/gems/activesupport-4.2.11.1/lib/active_support/tagged_logging.rb:68:in `block in tagged'
2021-01-06T19:53:12.425052+00:00 app[web.1]: vendor/bundle/ruby/2.6.0/gems/activesupport-4.2.11.1/lib/active_support/tagged_logging.rb:26:in `tagged'
2021-01-06T19:53:12.425053+00:00 app[web.1]: vendor/bundle/ruby/2.6.0/gems/activesupport-4.2.11.1/lib/active_support/tagged_logging.rb:68:in `tagged'
2021-01-06T19:53:12.425053+00:00 app[web.1]: vendor/bundle/ruby/2.6.0/gems/railties-4.2.11.1/lib/rails/rack/logger.rb:20:in `call'
2021-01-06T19:53:12.425053+00:00 app[web.1]: vendor/bundle/ruby/2.6.0/gems/actionpack-4.2.11.1/lib/action_dispatch/middleware/request_id.rb:21:in `call'
2021-01-06T19:53:12.425054+00:00 app[web.1]: vendor/bundle/ruby/2.6.0/gems/rack-1.6.13/lib/rack/methodoverride.rb:22:in `call'
2021-01-06T19:53:12.425055+00:00 app[web.1]: vendor/bundle/ruby/2.6.0/gems/rack-1.6.13/lib/rack/runtime.rb:18:in `call'
2021-01-06T19:53:12.425055+00:00 app[web.1]: vendor/bundle/ruby/2.6.0/gems/activesupport-4.2.11.1/lib/active_support/cache/strategy/local_cache_middleware.rb:28:in `call'
2021-01-06T19:53:12.425055+00:00 app[web.1]: vendor/bundle/ruby/2.6.0/gems/actionpack-4.2.11.1/lib/action_dispatch/middleware/static.rb:120:in `call'
2021-01-06T19:53:12.425056+00:00 app[web.1]: vendor/bundle/ruby/2.6.0/gems/rack-1.6.13/lib/rack/sendfile.rb:113:in `call'
2021-01-06T19:53:12.425057+00:00 app[web.1]: vendor/bundle/ruby/2.6.0/gems/actionpack-4.2.11.1/lib/action_dispatch/middleware/ssl.rb:24:in `call'
2021-01-06T19:53:12.425057+00:00 app[web.1]: vendor/bundle/ruby/2.6.0/gems/railties-4.2.11.1/lib/rails/engine.rb:518:in `call'
2021-01-06T19:53:12.425061+00:00 app[web.1]: vendor/bundle/ruby/2.6.0/gems/railties-4.2.11.1/lib/rails/application.rb:165:in `call'
2021-01-06T19:53:12.425061+00:00 app[web.1]: vendor/bundle/ruby/2.6.0/gems/rack-1.6.13/lib/rack/content_length.rb:15:in `call'
2021-01-06T19:53:12.425061+00:00 app[web.1]: vendor/bundle/ruby/2.6.0/gems/puma-5.1.1/lib/puma/configuration.rb:246:in `call'
2021-01-06T19:53:12.425062+00:00 app[web.1]: vendor/bundle/ruby/2.6.0/gems/puma-5.1.1/lib/puma/request.rb:76:in `block in handle_request'
2021-01-06T19:53:12.425062+00:00 app[web.1]: vendor/bundle/ruby/2.6.0/gems/puma-5.1.1/lib/puma/thread_pool.rb:337:in `with_force_shutdown'
2021-01-06T19:53:12.425062+00:00 app[web.1]: vendor/bundle/ruby/2.6.0/gems/puma-5.1.1/lib/puma/request.rb:75:in `handle_request'
2021-01-06T19:53:12.425063+00:00 app[web.1]: vendor/bundle/ruby/2.6.0/gems/puma-5.1.1/lib/puma/server.rb:431:in `process_client'
2021-01-06T19:53:12.425063+00:00 app[web.1]: vendor/bundle/ruby/2.6.0/gems/puma-5.1.1/lib/puma/thread_pool.rb:145:in `block in spawn_thread'
2021-01-06T19:53:12.425063+00:00 app[web.1]: 
2021-01-06T19:53:12.425064+00:00 app[web.1]: 
2021-01-06T19:53:12.458808+00:00 heroku[router]: at=info method=GET path="/videos/original/missing.png" host=www.mobileimplantlab.ca request_id=a7661465-ee4e-49d4-b694-27814e4fb23b fwd="24.85.18.207" dyno=web.1 connect=0ms service=71ms status=404 bytes=222 protocol=https
2021-01-06T19:53:30.751932+00:00 app[web.1]: Started POST "/galleries" for 24.85.18.207 at 2021-01-06 19:53:30 +0000
2021-01-06T19:53:30.768629+00:00 app[web.1]: Processing by GalleriesController#create as HTML
2021-01-06T19:53:30.768802+00:00 app[web.1]: Parameters: {"utf8"=>"?", "authenticity_token"=>"YFGiYYWmgDb+foSNMk1u1o2H2bp11nqwjAVzc4jqeGYDxoG6zLNGyFxBMvUrqxhBUAt+pex21VI+NqRGucRGOQ==", "gallery"=>{"product_name"=>"", "title1"=>"", "title2"=>"", "title3"=>"", "title4"=>"", "title5"=>"", "videotitle"=>"", "video"=>#<ActionDispatch::Http::UploadedFile:0x000055ebb2b89770 @tempfile=#<Tempfile:/tmp/RackMultipart20210106-4-baa646.mp4>, @original_filename="IMG_2826.mp4", @content_type="video/mp4", @headers="Content-Disposition: form-data; name="gallery[video]"; filename="IMG_2826.mp4"
Content-Type: video/mp4
">}, "commit"=>"Submit"}
2021-01-06T19:53:30.790290+00:00 app[web.1]: User Load (5.8ms)  SELECT  "users".* FROM "users" WHERE "users"."id" = $1  ORDER BY "users"."id" ASC LIMIT 1  [["id", 1]]
2021-01-06T19:53:30.836411+00:00 app[web.1]: [paperclip] Trying to link /tmp/RackMultipart20210106-4-baa646.mp4 to /tmp/847606d3771b12aa2d91db7647fe3a4920210106-4-1m2r6hc.mp4
2021-01-06T19:53:30.844138+00:00 app[web.1]: [paperclip] Trying to link /tmp/847606d3771b12aa2d91db7647fe3a4920210106-4-1m2r6hc.mp4 to /tmp/847606d3771b12aa2d91db7647fe3a4920210106-4-fg47sn.mp4
2021-01-06T19:53:30.858332+00:00 app[web.1]: Command :: file -b --mime '/tmp/847606d3771b12aa2d91db7647fe3a4920210106-4-fg47sn.mp4'
2021-01-06T19:53:30.938505+00:00 app[web.1]: [AV] Running command: if command -v avprobe 2>/dev/null; then echo "true"; else echo "false"; fi
2021-01-06T19:53:30.960650+00:00 app[web.1]: [AV] Running command: if command -v ffmpeg 2>/dev/null; then echo "true"; else echo "false"; fi
2021-01-06T19:53:30.973770+00:00 app[web.1]: Completed 500 Internal Server Error in 204ms (ActiveRecord: 14.0ms)
2021-01-06T19:53:30.975178+00:00 app[web.1]: 
2021-01-06T19:53:30.975180+00:00 app[web.1]: Av::UnableToDetect (Unable to detect any supported library):
2021-01-06T19:53:30.975180+00:00 app[web.1]: app/controllers/galleries_controller.rb:8:in `create

here is my model

class Gallery < ActiveRecord::Base
  has_attached_file :image1, :styles => { :medium => "300x300>", :thumb => "100x100>" }, :default_url => "/images/:style/missing.png"
  validates_attachment_content_type :image1, :content_type => /Aimage/.*/
  has_attached_file :image2, :styles => { :medium => "300x300>", :thumb => "100x100>" }, :default_url => "/images/:style/missing.png"
  validates_attachment_content_type :image2, :content_type => /Aimage/.*/
  has_attached_file :image3, :styles => { :medium => "300x300>", :thumb => "100x100>" }, :default_url => "/images/:style/missing.png"
  validates_attachment_content_type :image3, :content_type => /Aimage/.*/
  has_attached_file :image4, :styles => { :medium => "300x300>", :thumb => "100x100>" }, :default_url => "/images/:style/missing.png"
  validates_attachment_content_type :image4, :content_type => /Aimage/.*/
  has_attached_file :image5, :styles => { :medium => "300x300>", :thumb => "100x100>" }, :default_url => "/images/:style/missing.png"
  validates_attachment_content_type :image5, :content_type => /Aimage/.*/
  has_attached_file :video, :styles => {
     :medium => { :geometry => "500x500", :format => 'jpg' },
     :thumb => { :geometry => "100x100", :format => 'jpg' }
  }, :processors => [:transcoder]

validates_attachment_content_type :video,
    :content_type => [
      "video/mp4", 
      "video/quicktime",
      "video/3gpp",
      "video/x-ms-wmv",
      "video/mov",
      "video/flv",
      ],
    :message => "Sorry! We do not accept the attached file type"

end

I have these gems for it

gem "paperclip"
gem 'paperclip-av-transcoder'
gem "paperclip-ffmpeg", "~> 1.2.0"

I did few research on this issue and it said that i have to add this to my heroku buildpack but when i add it my heroku website crashed. so I remove it. Is there any other solution? https://github.com/jonathanong/heroku-buildpack-ffmpeg-latest.git

Thanks in advance


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...