gpt4 book ai didi

ffmpeg - 验证失败:Video Paperclip::Errors::NotIdentifiedByImageMagickError

转载 作者:行者123 更新时间:2023-12-04 23:26:48 24 4
gpt4 key购买 nike

我有一个带有附加视频的模型。我想创建视频的缩放版本以及一系列缩略图。我有以下设置:

has_attached_file :video,
styles: {
original: { format: 'mp4', processors: [:transcoder] },
large: { geometry: "720x720", format: 'jpg', processors: [:thumbnail] },
medium: { geometry: "540x540", format: 'jpg', processors: [:thumbnail] },
thumb: { geometry: "180x180", format: 'jpg', processors: [:thumbnail] }
},
default_url: ""

当我在我的开发环境中测试它时,它工作得很好。视频和所有图像的大小都正确。但是,当我部署到 Heroku 时,出现以下错误:
Validation failed: Video Paperclip::Errors::NotIdentifiedByImageMagickError
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.0.2/lib/active_record/validations.rb:78:in `raise_validation_error'
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.0.2/lib/active_record/validations.rb:50:in `save!'
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.0.2/lib/active_record/attribute_methods/dirty.rb:30:in `save!'
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.0.2/lib/active_record/transactions.rb:324:in `block in save!'
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.0.2/lib/active_record/transactions.rb:395:in `block in with_transaction_returning_status'
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.0.2/lib/active_record/connection_adapters/abstract/database_statements.rb:232:in `block in transaction'
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.0.2/lib/active_record/connection_adapters/abstract/transaction.rb:189:in `within_new_transaction'
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.0.2/lib/active_record/connection_adapters/abstract/database_statements.rb:232:in `transaction'
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.0.2/lib/active_record/transactions.rb:211:in `transaction'
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.0.2/lib/active_record/transactions.rb:392:in `with_transaction_returning_status'
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.0.2/lib/active_record/transactions.rb:324:in `save!'
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.0.2/lib/active_record/suppressor.rb:45:in `save!'
/app/app/models/concerns/snapshot_methods.rb:37:in `copy_from_ziggeo!'
/app/app/workers/snapshot_transcoder.rb:16:in `perform'
/app/vendor/bundle/ruby/2.3.0/gems/resque-status-0.5.0/lib/resque/plugins/status.rb:161:in `safe_perform!'
/app/vendor/bundle/ruby/2.3.0/gems/resque-status-0.5.0/lib/resque/plugins/status.rb:137:in `perform'

我在这里想念什么?我搜索过 NotIdentifiedByImageMagickError并扫描了有关此问题的许多其他问题,但没有成功解决我的问题。

我见过的大多数解决方案都涉及设置 Paperclip.options[:command_path] = "/usr/bin/identify"开发中。由于我的问题仅在生产中,我尝试将其应用于生产,为我的生产环境选择正确的路径,如下所示:
Paperclip.options[:command_path] = "/app/vender/imagemagick/bin/identify"

这没有效果。 /app/vender/imagemagick/bin 也没有.

最佳答案

经过多次头疼后,我设法通过清除我的应用程序的缓存并重新安装 ImageMagick 来解决这个问题。以下是我采取的步骤:

  • 安装 heroku-repo CLI并运行 heroku repo:purge_cache -a APP_NAME .
  • 创建一个空提交:git commit --allow-empty -m "Hope this works"
  • 重新部署到 Heroku:git push heroku master

  • 重新部署需要几分钟,因为 Heroku 现在必须从头开始重建所有静态 Assets 和依赖项。

    据我了解,这个问题是由 ImageMagick 的缓存副本错误引起的。我很乐意接受任何可以就导致此问题的原因提供更明智解释的人的回答。即使它现在已经解决了,我不相信这不会在 future 的某个随机点再次发生。

    关于ffmpeg - 验证失败:Video Paperclip::Errors::NotIdentifiedByImageMagickError,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43051901/

    24 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com