我想轉換AVI文件爲FLV服務器上使用FFMPEG格式,但它給我的問題爲FLV。轉換時,文件轉換爲flv格式,但沒有數據(0 kb大小的文件)。試圖調試代碼,但不能。 ffmpeg的安裝CentOS中,在目錄/ usr/bin中/ ffmpeg的,和我使用下面的命令進行轉換:視頻轉換使用FFMPEG得0尺寸
$srcFile = "/home/mydomain/public_html/demo/test/sample.avi"; $destFile = "/home/mydomain/public_html/demo/test/sample_again.flv"; $ffmpegPath = "/usr/bin/ffmpeg"; $flvtool2Path = "/usr/local/bin/flvtool2"; $command = $ffmpegPath . " -y -i " . $srcFile . " -ar 32000 -ab 32000 -f flv -s 320x240 ". $destFile . " | " . $flvtool2Path . " -U stdin " . $destFile; exec($command, $output); print_r($output);
我試圖做:
exec("which ffmpeg");
而且它給我的路/ usr/bin/ffmpeg,但在執行代碼時出現以下錯誤:
Array ( [0] => ERROR: undefined method `timestamp' for nil:NilClass [1] => ERROR: /usr/local/cpffmpeg/lib/ruby/site_ruby/1.8/flv/stream.rb:285:in `lasttimestamp' [2] => ERROR: /usr/local/cpffmpeg/lib/ruby/site_ruby/1.8/flv/stream.rb:274:in `duration' [3] => ERROR: /usr/local/cpffmpeg/lib/ruby/site_ruby/1.8/flvtool2/base.rb:181:in `add_meta_data_tag' [4] => ERROR: /usr/local/cpffmpeg/lib/ruby/site_ruby/1.8/flvtool2/base.rb:137:in `update' [5] => ERROR: /usr/local/cpffmpeg/lib/ruby/site_ruby/1.8/flvtool2/base.rb:47:in `send' [6] => ERROR: /usr/local/cpffmpeg/lib/ruby/site_ruby/1.8/flvtool2/base.rb:47:in `execute!' [7] => ERROR: /usr/local/cpffmpeg/lib/ruby/site_ruby/1.8/flvtool2/base.rb:46:in `each' [8] => ERROR: /usr/local/cpffmpeg/lib/ruby/site_ruby/1.8/flvtool2/base.rb:46:in `execute!' [9] => ERROR: /usr/local/cpffmpeg/lib/ruby/site_ruby/1.8/flvtool2/base.rb:206:in `process_files' [10] => ERROR: /usr/local/cpffmpeg/lib/ruby/site_ruby/1.8/flvtool2/base.rb:44:in `execute!' [11] => ERROR: /usr/local/cpffmpeg/lib/ruby/site_ruby/1.8/flvtool2.rb:168:in `execute!' [12] => ERROR: /usr/local/cpffmpeg/lib/ruby/site_ruby/1.8/flvtool2.rb:228 [13] => ERROR: /usr/local/bin/flvtool2:2:in `require' [14] => ERROR: /usr/local/bin/flvtool2:2 )
可能是什麼問題。這是Flvtool2的問題,如果是的話那麼它是什麼。請建議一些
指令與命令行 – andho
不,我是從瀏覽器 –
任何人的任何解決方案執行PHP文件直跑,它不是在所有 –