ruby on rails 3 - Cannot allocate memory error while uploading large video on AWS instance -
i working on ror website , upload media files (like mp3,pdf,images , video) on website. website hosted on aws , using s3 bucket upload media files.
when upload video firstly save video in public folder of project on aws instance website hosted , create thumbnail of video using ffmpeg , duration using ffmpeg-streamio , remove video after creating thumbnail. it's working fine until uploading large video when try upload large video through error i. e.
errno::enomem (cannot allocate memory - /usr/local/bin/ffmpeg -i /var/www/html/proj/public/13/nvc_trim.mov):
path = "public/" + @admin.id.to_s + "/" + params[:video].original_filename dirpath = "public/" + @admin.id.to_s fileutils.mkdir_p dirpath afile = file.new(path, "w") afile.write(open(params[:video]).read) afile.close system"/usr/local/bin/ffmpeg -itsoffset -4 -i /var/www/html/proj/#{path} -vcodec mjpeg -vframes 1 -an -f rawvideo /var/www/html/proj/#{dirpath}/thumb.png" #calculate video duration ffmpeg.ffmpeg_binary = '/usr/local/bin/ffmpeg' movie = ffmpeg::movie.new("/var/www/html/proj/#{path}")
am missing in code? idea or in highly appreciated.
thanks in advance :)
Comments
Post a Comment