Paperclip Transcoder not working on remote server

I can download videos on a local computer. Videos are processed using paperclip, and all metadata is saved correctly. When I tried to download the video using our remote server, I received an error message:

Av::UnableToDetect (Unable to detect any supported library) 

I installed ffmpeg using LinuxBrew . It says that everything is installed correctly (check which brew and which ffmpeg , as well as check the correct installation of the gem).

When I have a model in my model for video (this is what allows you to store meta-information and control its loading), it does not work remotely.

 has_attached_file :video, path: "/posts/:id/:style.:extension", :styles => { :medium => { :geometry => "493x877", :format => 'flv' }, :thumb => { :geometry => "100x100#", :format => 'jpg', :time => 10 }, # :mobile => {:geometry => "640X480", :format => 'mp4', :streaming => true} }, :processors => [:transcoder] 

However, when I remove this from my model and have:

 has_attached_file :video, path: "/posts/:id/:style.:extension" 

The video is uploaded to S3 (without the data or styles I need).

Any help would be greatly appreciated. I think AV is having trouble finding ffmpeg, but I'm not sure why and how to fix it. Thank you in advance for any advice.

+7
ruby-on-rails ffmpeg amazon-s3 video paperclip
source share
1 answer

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!

+11
source share

All Articles