【问题标题】:Video uploaded using paperclip on heroku showing no screen, only sound在heroku上使用回形针上传的视频没有屏幕,只有声音
【发布时间】:2016-04-20 11:52:33
【问题描述】:

我正在将视频上传到 Heroku 服务器上的 Ruby on Rails 应用程序。在本地它工作正常,但在 Heroku 服务器上没有屏幕显示,只有声音。

型号:

class Video < ActiveRecord::Base
  validates :user_id, :title, presence: true

  has_attached_file :file, :styles => {
    :poster => { :geometry => "640x480", :format => 'jpg' },
    :large => { :geometry => "640x480", :format => 'mp4',  }
  }, :use_timestamp => false, :processors => [:transcoder]

  validates_attachment_content_type :file, content_type: /\Avideo\/.*\Z/

  belongs_to :user
end

以及显示视频的视图:

<video width="640" height="480" controls>
  <source src="<%= @video.file.url(:large) %>" type="video/mp4">
    Your browser does not support the video tag.
</video>

除了 Heroku 上的 ruby​​ buildpack 之外,我还在使用 buildpack https://github.com/shunjikonishi/heroku-buildpack-ffmpeg。

我使用gem 'paperclip-av-transcoder'。我还尝试了以下宝石:

gem 'paperclip', '~> 4.3.1'
gem 'aws-sdk', '< 2.0'
gem 'paperclip-av-transcoder'
gem "paperclip-ffmpeg", "~> 1.2.0" 

但结果相同。

我开始认为这与 Heroku 上使用的转码器有关。如果您下载文件,则视频在视频播放器中可以正常播放。

有什么想法吗?

【问题讨论】:

    标签: ruby-on-rails heroku ffmpeg paperclip


    【解决方案1】:

    好的,我尝试了一些不同的方法并修复了它。我没有使用 buildpack https://github.com/shunjikonishi/heroku-buildpack-ffmpeg,而是将其更改为 https://github.com/jonathanong/heroku-buildpack-ffmpeg-latest.git。现在它可以工作了。

    【讨论】:

      猜你喜欢
      • 2013-10-13
      • 1970-01-01
      • 2015-03-23
      • 1970-01-01
      • 1970-01-01
      • 2013-10-16
      • 2012-04-12
      • 2012-10-08
      • 1970-01-01
      相关资源
      最近更新 更多