2013-12-08 50 views
4

我通過streamio-FFMPEG Rails的寶石使用FFMPEG - https://github.com/streamio/streamio-ffmpegFFMPEG說文件不存在,但是,它的存在

出於某種原因,想轉碼的視頻文件(該文件的確存在)時, 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/[email protected]/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/[email protected]/gems/railties-3.2.8/lib/rails/commands/console.rb:47:in `start' 
    from /Users/my-comp/.rvm/gems/[email protected]/gems/railties-3.2.8/lib/rails/commands/console.rb:8:in `start' 
    from /Users/my-comp/.rvm/gems/[email protected]/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

你能顯示movie.rb嗎? –

+0

當然,它是其中的一部分寶石 - 可以在這裏查看:https://github.com/streamio/streamio-ffmpeg/blob/master/lib/ffmpeg/movie.rb – cmw

+0

這真的很奇怪,因爲你已經完成file.exists? => true。不知道我可以幫忙,但我會投票 –

回答

2

看起來它無法找到ffmpeg二進制本身,而不是您指定的文件。嘗試在調用構造函數之前設置FFMPEG的完整路徑:

FFMPEG.ffmpeg_binary = '/usr/local/bin/ffmpeg' 
+0

這是問題 - 安裝顯然沒有按計劃進行。我清理了一些東西,安裝了自制軟件,確保路徑正確,一切按計劃進行。 – cmw

相關問題