I am making a Ruby on Rails application and am trying to allow video files to be uploaded through the application.
I'm using the paperclip gem to handle the attachment of files, paperclip-av-transcoder gem (as suggested) to handle the transcoding. I also have the aws-sdk gem installed, but that's irrelevant at the moment because I can't even get the uploading to work on my local system.
I've followed all the instructions to prepare the application to handle video uploading: I've installed necessary gems, created the actual paperclip for the Video model (I named the paperclip "film"), ran the migration, and added the association to my Video model itself. I also whitelisted the :film attribute in my video controller parameters, and I have the correct field for :film in my new video form.
When I run my local server I go to my videos#new page and fill out the form, attach the file for :film, and submit the form. It takes about 10 seconds until it loads the following error:
Av::UnableToDetect in VideosController#create
Unable to detect any supported library
Extracted source (around line #10):
@video = Video.new(video_params)
I have no idea what's going on here. When I look at other people who have had the exact same error message "Unable to detect any supported library", they always simply forgot to run the paperclip migration or something like that. I've followed all of those necessary steps.
Here is my :film related code in my Video.rb model
has_attached_file :film, styles: {
:medium => {
:geometry => "640x480",
:format => 'mp4'
},
:thumb => { :geometry => "160x120", :format => 'jpeg', :time => 10}
}, :processors => [:transcoder]
validates_attachment_content_type :film, content_type: /\Avideo\/.*\Z/
and here's my strong parameters in my videos_controller
def video_params
params.require(:video).permit(:title, :description, :film, :preview_image,
award_attributes: [:id, :title, :body, :award_image])
end
And here is the database schema relevant to my video model. Preview image is a separate paperclip (its an image), which I've had for a few weeks and it works completely fine.
create_table "videos", force: :cascade do |t|
t.string "title"
t.string "description"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.string "preview_image_file_name"
t.string "preview_image_content_type"
t.integer "preview_image_file_size"
t.datetime "preview_image_updated_at"
t.string "film_file_name"
t.string "film_content_type"
t.integer "film_file_size"
t.datetime "film_updated_at"
end
I also have a feeling it may have something to do with my gems, here's my gemfile:
gem 'paperclip', :git=> 'https://github.com/thoughtbot/paperclip', :ref => '523bd46c768226893f23889079a7aa9c73b57d68'
gem 'aws-sdk'
gem 'paperclip-av-transcoder'
I've already tried it with just the plain 'paperclip' gem, with no reference to git. It still doesn't work
Thanks in advance for any help you all can give me!