我通过streamio-FFMPEG Rails gem使用FFMPEG - https://github.com/streamio/streamio-ffmpeg
出于某种原因,当试图对视频文件(确实存在)进行转码时,FFMPEG表示该文件不存在。
以下是Rails控制台的一些输出,显示了我的头痛:
1.9.3p125 :001 > File.exist?("/Applications/MAMP/htdocs/video-app/public/uploads/tmp/20131208-1416-1234-0984/videotest.mp4")
=> true
1.9.3p125 :002 > FFMPEG::Movie.new("/Applications/MAMP/htdocs/video-app/public/uploads/tmp/20131208-1416-1234-0984/videotest.mp4")
Errno::ENOENT: No such file or directory - ffmpeg -i /Applications/MAMP/htdocs/video-app/public/uploads/tmp/20131208-1416-1234-0984/videotest.mp4
from /Users/my-comp/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/open3.rb:202:in `spawn'
from /Users/my-comp/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/open3.rb:202:in `popen_run'
from /Users/my-comp/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/open3.rb:90:in `popen3'
from /Users/my-comp/.rvm/gems/ruby-1.9.3-p125@video-app/gems/streamio-ffmpeg-1.0.0/lib/ffmpeg/movie.rb:17:in `initialize'
from (irb):2:in `new'
from (irb):2
from /Users/my-comp/.rvm/gems/ruby-1.9.3-p125@video-app/gems/railties-3.2.8/lib/rails/commands/console.rb:47:in `start'
from /Users/my-comp/.rvm/gems/ruby-1.9.3-p125@video-app/gems/railties-3.2.8/lib/rails/commands/console.rb:8:in `start'
from /Users/my-comp/.rvm/gems/ruby-1.9.3-p125@video-app/gems/railties-3.2.8/lib/rails/commands.rb:41:in `<top (required)> '
from script/rails:6:in `require'
from script/rails:6:in `<main>'
1.9.3p125 :003 >
任何帮助都将不胜感激。
答案 0 :(得分:2)
看起来它找不到ffmpeg
二进制文件本身,而不是您指定的文件。在调用构造函数之前,尝试设置FFMPEG的完整路径:
FFMPEG.ffmpeg_binary = '/usr/local/bin/ffmpeg'