错误将视频上传至Heroku的时候 [英] Error when uploading video to heroku
问题描述
我是用我的Rails应用程序的曲别针和回形针-AV-跨codeR和我已经得到的地方,我可以上传本地视频点。但是,当我尝试在Heroku上我得到这个错误。大道:: UnableToDetect(无法检测到任何支持库):
我可能要添加的东西,使其与S3的工作,但我有它处理图像较早,所以一切都需要设置为S3。
这是在code在我的模型
类Classvideo<的ActiveRecord :: Base的
belongs_to的:用户
has_attached_file:视频:风格=> {
:中等=> {:几何=> 640×480,:格式=> FLV},
:拇指=> {:几何=> 100×100#,:格式=> JPG,:时间=> 10}
}:处理器=> [:反式codeR]
validates_attachment_content_type:视频:CONTENT_TYPE => [视频/ MP4,video.mov,视频/ MPEG,视频/ MPEG4,图像/ JPG,图像/ JPEG]
结束
我有同样的问题,刚刚过去的这个星期 - !试试这个
视频模式:
has_attached_file:视频,样式:{
:中等=> {
:几何=> 640×480,
:格式=> MP4
},
:拇指=> {:几何=> 160×120,:格式=> JPEG,:时间=> 10}
}:处理器=> [:反式codeR]
validates_attachment_content_type:视频,CONTENT_TYPE:/\Avideo\/.*\Z/
请确保你已经绑定:
宝石回形针,GT〜&; 4.3.1
创业板AWS-SDK','< 2.0
创业板回形针-AV-跨codeR'
宝石回形针-的ffmpeg,〜> 1.2.0
运行回形针迁移:
轨道摹回形针模型视频
请务必在post_controller.rb补充:
私有
高清bscenes_params
params.require(:岗位).permit(:视频)
结束
上传表单:
<%= f.file_field:视频%>
显示页面:
<%= video_tag bscene.video.url(:中等),控制:真正的,风格:最大宽度:100%; %>
在这一点上,你应该得到这个错误:
大道:: UnableToDetect(无法检测到任何支持库):
转到您的终端并键入:
BREW方案的ffmpeg
然后运行以下步骤来安装ffmpeg的:
BREW安装的ffmpeg --with-FDK-AAC --with-ffplay --with-FreeType的--with-frei0r --with-libass --with-的libvo-aacenc - -with-libvorbis --with-libvpx --with-的OpenCore-AMR --with-openjpeg --with-OPUS --with-rtmpdump --with-薛定谔--with-的Speex --with-Theora格式--with-工具
重新启动服务器并尝试现在上传视频!希望这有助于 - 编码快乐:)
I am using the paperclip and paperclip-av-transcoder in my rails app and I have gotten to the point where I can upload videos locally. But when I try it in heroku I get this error. Av::UnableToDetect (Unable to detect any supported library):
I may have to add something to make it work with s3 but I had it working with images earlier so everything should be setup for s3.
This is the code in my model
class Classvideo < ActiveRecord::Base
belongs_to :user
has_attached_file :video, :styles => {
:medium => {:geometry => "640x480", :format => 'flv'},
:thumb => { :geometry => "100x100#", :format => 'jpg', :time => 10 }
}, :processors => [:transcoder]
validates_attachment_content_type :video, :content_type => ["video/mp4", "video.mov", "video/mpeg","video/mpeg4", "image/jpg", "image/jpeg"]
end
I had the same issue just this past week - Try this!
Video model:
has_attached_file :video, styles: {
:medium => {
:geometry => "640x480",
:format => 'mp4'
},
:thumb => { :geometry => "160x120", :format => 'jpeg', :time => 10}
}, :processors => [:transcoder]
validates_attachment_content_type :video, content_type: /\Avideo\/.*\Z/
Make sure you already bundled:
gem 'paperclip', '~> 4.3.1'
gem 'aws-sdk', '< 2.0'
gem 'paperclip-av-transcoder'
gem "paperclip-ffmpeg", "~> 1.2.0"
Run the paperclip migration:
rails g paperclip model video
Be sure to add in post_controller.rb:
private
def bscenes_params
params.require(:post).permit(:video)
end
Upload form:
<%= f.file_field :video %>
Show page:
<%= video_tag bscene.video.url(:medium), controls: true, style: "max-width: 100%;" %>
At this point you should get this error:
Av::UnableToDetect (Unable to detect any supported library):
Go to your terminal and type in:
brew options ffmpeg
Then run the following to install ffmpeg:
brew install ffmpeg --with-fdk-aac --with-ffplay --with-freetype --with-frei0r --with-libass --with-libvo-aacenc --with-libvorbis --with-libvpx --with-opencore-amr --with-openjpeg --with-opus --with-rtmpdump --with-schroedinger --with-speex --with-theora --with-tools
Restart your server and try to upload a video now! Hope this helps - Happy coding :)
这篇关于错误将视频上传至Heroku的时候的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!