FFMPEG 说文件不存在,但是它存在

cmw*_*cmw 5 ffmpeg ruby-on-rails ruby-on-rails-3

我通过streamio-FFMPEG Rails gem \xe2\x80\x93 使用 FFMPEG https://github.com/streamio/streamio-ffmpeg

\n\n

由于某种原因,当尝试对视频文件(确实存在)进行转码时,FFMPEG 表示该文件不存在。

\n\n

这是 Rails 控制台的一些输出,展示了我的头痛之处:

\n\n
1.9.3p125 :001 > File.exist?("/Applications/MAMP/htdocs/video-app/public/uploads/tmp/20131208-1416-1234-0984/videotest.mp4")\n => true \n\n1.9.3p125 :002 > FFMPEG::Movie.new("/Applications/MAMP/htdocs/video-app/public/uploads/tmp/20131208-1416-1234-0984/videotest.mp4")\nErrno::ENOENT: No such file or directory - ffmpeg -i /Applications/MAMP/htdocs/video-app/public/uploads/tmp/20131208-1416-1234-0984/videotest.mp4\n  from /Users/my-comp/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/open3.rb:202:in `spawn\'\n  from /Users/my-comp/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/open3.rb:202:in `popen_run\'\n  from /Users/my-comp/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/open3.rb:90:in `popen3\'\n  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\'\n  from (irb):2:in `new\'\n  from (irb):2\n  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\'\n  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\'\n  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)>    \'\n  from script/rails:6:in `require\'\n  from script/rails:6:in `<main>\'\n1.9.3p125 :003 > \n
Run Code Online (Sandbox Code Playgroud)\n\n

任何帮助,将不胜感激。

\n

Geo*_* Y. 2

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

FFMPEG.ffmpeg_binary = '/usr/local/bin/ffmpeg'
Run Code Online (Sandbox Code Playgroud)