See morw...

Tuesday, January 31, 2012

Why am I getting Paperclip::CommandNotFoundError

If you are dealing with the videos and paperclip, then you probably faced to above error while uploading and converting. this is how to solve the problem.


install imagemagick
    sudo apt-get install imagemagick


check the converter
   which converter


above command will give the path of converter resides. for example /usr/bin/convert. open the ruby on rails development.rb file and enter the following line.


Paperclip.options[:command_path] = "/usr/bin"


restart the server and you should be able to upload the videos. 


is still getting the errors, then open the terminal and see the server logs. if you see following errors on the logs ,





[paperclip] ffmpeg -itsoffset -4 -i "/tmp/stream20120201-2998-djfnsu.mp4" -y -vcodec mjpeg -vframes 1 -an -f rawvideo -s 72x72 "/tmp/stream20120201-2998-djfnsu.jpg20120201-2998-1ecbagd" 2>/dev/null
[paperclip] An error was received while processing: #
[paperclip] ffmpeg -itsoffset -4 -i "/tmp/stream20120201-2998-djfnsu.mp4" -y -vcodec mjpeg -vframes 1 -an -f rawvideo -s 120x120 "/tmp/stream20120201-2998-djfnsu.jpg20120201-2998-r01kob" 2>/dev/null
[paperclip] An error was received while processing: #
[paperclip] ffmpeg -itsoffset -4 -i "/tmp/stream20120201-2998-djfnsu.mp4" -y -vcodec mjpeg -vframes 1 -an -f rawvideo -s 200x200 "/tmp/stream20120201-2998-djfnsu.jpg20120201-2998-1s3s6z9" 2>/dev/null
[paperclip] An error was received while processing: #



then go back to terminal and run the following commnad.


sudo apt-get install ffmpeg


restart the server and check the uploads. if still not lucky again check the logs for error. you might be get following error.


Unknown encoder 'libmp3lame'


then run the following command. 


sudo apt-get install ffmpeg libavcodec-extra-53 
or
sudp apt-get install ffmpeg libavcodex-extra-52


now you should be fine. if not please contact me. 


happy coding.

No comments: