I had the same problem only last 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 are already connected:
gem 'paperclip', '~> 4.3.1' gem 'aws-sdk', '< 2.0' gem 'paperclip-av-transcoder' gem "paperclip-ffmpeg", "~> 1.2.0"
Run the clip migration:
rails g paperclip model video
Be sure to add post_controller.rb:
private def bscenes_params params.require(:post).permit(:video) end
Download 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 (cannot find any supported library):
For mac
Go to your terminal and type:
brew options ffmpeg
Then run ffmpeg:
For older versions of the brew recipe:
brew install ffmpeg --with-fdk-aac --with-ffplay --with-freetype --with-frei0r --with-libas
For newer versions of the brew recipe:
brew install ffmpeg --with-fdk-aac --with-sdl2 --with-freetype --with-frei0r --with-libass
For Linux Mint / Ubuntu / Debian based on Linux
Open a terminal (Ctrl + Alt + T) and run the following commands one by one to install ffmpeg.
sudo add-apt-repository ppa:mc3man/trusty-media sudo apt-get update sudo apt-get dist-upgrade sudo apt-get install ffmpeg
At this point, the video upload will work locally
Now for remote downloads you will need to install https://devcenter.heroku.com/articles/buildpacks
Now it will lead you to your mistake
Av :: UnableToDetect (Unable to detect any supported library)
You will need to create a Procfile in the root of your application directory for more information on Procfile here: https://devcenter.heroku.com/articles/procfile
touch Procfile
Hope this helps!