轨道上的红宝石载波 - 视频ffmpeg AWS [英] ruby on rails carrierwave-video ffmpeg AWS

查看:197
本文介绍了轨道上的红宝石载波 - 视频ffmpeg AWS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在创建一个学术网站,用户可以上传演讲视频,其他用户可以查看它们 - 类似于Udemy等网站。

I am trying to create an academic site where users can upload lecture videos and other users can view them - similar to a site like Udemy.

我正在使用Carrierwave ,载波视频(用于编码视频),AWS使其发生。 AWS配置已经完成,它正在运行。

I am using Carrierwave, Carrierwave-video (for encoding videos), AWS to make this happen. AWS configuration has been done, and it's working.

但是,我收到这个错误。 (顺便说一句,我正在Yelpdemo网站测试这个视频功能,所以我试图让用户现在将视频上传到餐馆。)

However, I am getting this error. (By the way, I am testing this video feature in a Yelpdemo site, so I am trying to have users upload videos to restaurants for now.)

rails指出错误到@restaurant = Restaurant.new(restaurant_params)

rails points the error to @restaurant = Restaurant.new(restaurant_params)

Errno :: ENOENT in RestaurantsController#create

Errno::ENOENT in RestaurantsController#create

没有这样文件或目录 - ffmpeg

No such file or directory - ffmpeg

#POST /restaurants.json
def create
@restaurant = Restaurant.new(restaurant_params)

# POST /restaurants.json def create @restaurant = Restaurant.new(restaurant_params)

respond_to do |format|
  if @restaurant.save

这是我的video_uploader.rb

This is my video_uploader.rb

# encoding: utf-8

class VideoUploader < CarrierWave::Uploader::Base

  include CarrierWave::Video
  include CarrierWave::Video::Thumbnailer

  process encode_video: [:mp4]

  include CarrierWave::MiniMagick

  storage :fog

  def store_dir
    "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
  end

   version :thumb do
      process thumbnail: [{format: 'png', quality: 10, size: 192, strip: true, logger: Rails.logger}]
      def full_filename for_file
        png_name for_file, version_name
      end
  end

    def png_name for_file, version_name
      %Q{#{version_name}_#{for_file.chomp(File.extname(for_file))}.png}
    end
end



I have manually (added a file to the model) created video.rb in the model - not sure if this is the right way to do it..

class Video < ActiveRecord::Base

  attr_accessor :user_id, :video,, :type, :filename, :path, :filesize, :width, :height, :duration, :bit_rate

  belongs_to :restaurant
  belongs_to :user

  mount_uploader :video, VideoUploader
end


/ b $ b

在app / views / restaurants / show.html.erb中显示视频。现在,没有编码,我可以看到像视频的图像。当我正确舔和复制代码 - 它给我的AWS URL,这意味着AWS配置就位

in app/views/restaurants/show.html.erb for showing the video. Right now, without the encoding done, I can see like an image of the video. When I right lick and copy the code - it gives me the AWS URL which means AWS configuration is in place

        <p>
            <strong>Video:</strong>
            <%= video_tag @restaurant.video_url %>
        </p>

我正在尝试显示这样的视频。

I am trying to show videos like this.

我已经下载了FFMPEG(ffmpeg-2.6和SnowLeopard_Lion_Mountain_Yosemite_17) - 不知道哪一个是正确的。我已经读过某个地方需要将FFMPEG放在你的usr / local / bin中 - >所以你必须物理上将ffmpeg exec文件放在您的相应文件夹中?

I have downloaded FFMPEG (both ffmpeg-2.6 and SnowLeopard_Lion_Mountain_Yosemite_17) - not sure which one's the right one.. And I have read somewhere that you need to place FFMPEG in your usr/local/bin -> So do you have to physically place ffmpeg exec file in your respective folder?

需要您的专家帮助。

提前谢谢

推荐答案

解决问题的最简单方法是删除您的AMI AWS实例,并在Ubuntu上创建新的基础。在这种情况下,您可以毫不费力地安装FFMPEG开箱即用:

The easiest way to solve your problem is remove your AMI AWS instance and create new base on Ubuntu. In this case you can without any problems install FFMPEG out of the box use:

apt-get install ffmpeg

否则你有两种方式:


  1. 从源头构建 FFMPEG。

  2. 尝试查找与您的AMI实例兼容的RPM软件包或RPM存储库,并从中安装FFMPEG

  1. Build FFMPEG from sources. + you will have additional troubles with paths and permissions.
  2. Try to find RPM package or RPM repository compatible with your AMI instance and install FFMPEG from it

所以,我只是建议用Ubuntu重新构建你的实例。

So, I just recommend to re-build your instance with Ubuntu.

这篇关于轨道上的红宝石载波 - 视频ffmpeg AWS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆