ruby-on-rails – FFMPEG说文件不存在,但它存在

我通过streamio-FFMPEG Rails gem-
https://github.com/streamio/streamio-ffmpeg使用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 > 

任何帮助,将不胜感激.

最佳答案 它看起来无法找到ffmpeg二进制文件本身,而不是您指定的文件.在调用构造函数之前,尝试设置FFMPEG的完整路径:

FFMPEG.ffmpeg_binary = '/usr/local/bin/ffmpeg'
点赞