jrgifford / delayed_paperclip

Process your Paperclip attachments in the background with delayed_job or Resque.
http://www.jstorimer.com/ruby/2010/01/30/delayed-paperclip.html
MIT License
402 stars 155 forks source link

FFMPEG hangs/stalls when converting large files #195

Closed passabilities closed 8 years ago

passabilities commented 8 years ago

Large videos always seem to get hung up at a certain point: (the first file is being converted from the second file, and the third file is being converted from the fourth file)

v2@web1 ~/divshare-v2 $ ls -alh /tmp
-rw-------  1 v2   v2    70M Sep 10 00:01 2158940a8739e7219125179e0d1528c120160909-14061-8dqfx020160909-14061-egeyeq.mp4
-rw-------  1 v2   v2   515M Sep  9 23:57 2158940a8739e7219125179e0d1528c120160909-14061-8dqfx0.mp4
-rw-------  1 v2   v2   145M Sep  9 23:33 76ba144beb8a14b6cf542225ef885a7c20160909-12733-1ui03vo20160909-12733-y7ywn.mp4
-rw-------  1 v2   v2   604M Sep  9 23:27 76ba144beb8a14b6cf542225ef885a7c20160909-12733-1ui03vo.mp4

I have tried uploading a couple times and with different files. Always gets caught around the same point. However everything works perfectly when smaller videos (~100-200M).

This is the command being ran:

v2@web1 ~/divshare-v2 $ ps ux | grep ffmpeg
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
v2       14588 26.4  2.9 849840 240524 ?       Sl   Sep09  12:00 ffmpeg -i /tmp/2158940a8739e7219125179e0d1528c120160909-14061-8dqfx0.mp4 -acodec aac -strict experimental -vcodec libx264 -vb 1000k -profile:v baseline -vf scale=-2:480 -acodec aac -ab 128k -preset slow -threads 0 -movflags faststart -y /tmp/2158940a8739e7219125179e0d1528c120160909-14061-8dqfx020160909-14061-egeyeq.mp4

Any sort of help debugging this would be awesome.

NOTE: I copied the above command and manually ran the command so that I could see some logs from ffmpeg, and worked seamlessly.

bdewater commented 8 years ago

Have you tried running Paperclip from master? It has this PR included which might help for large files: https://github.com/thoughtbot/paperclip/pull/2290