在我的網站上,我有一個選項可以由用戶上傳視頻文件。我想創建該視頻的縮略圖。我曾嘗試在本地系統與一些編碼它工作正常。我嘗試了相同的代碼來維護它不起作用。我檢查了服務器中啓用的ffmpeg,它被禁用。他們是否有其他選擇在服務器中創建縮略圖,而不啓用ffmpeg?請幫我找到解決方案。從服務器的視頻在php中創建縮略圖圖像
3
A
回答
1
如果你不想使用ffmpeg,你也可以使用mencoder作爲替代。但最後你需要安裝ffmpeg/mencoder,然後使用它來渲染縮略圖,因爲PHP沒有內置的功能來處理視頻。
如果你是一個共享的虛擬主機提供商,你可能想看看像zencoder服務,會爲你生成轉換後的視頻,包括縮略圖的流:
+0
他說的是準確的。 +1 – kingmaple 2012-04-20 06:12:01
2
可以使用ffmpeg
(表格標記你我猜你知道)
你需要傳遞給ffmpeg的是什麼
-i = input file
-deinterlace = deinterlace pictures
-an = disable audio recording
-ss = start time in the video (seconds)
-t = duration of the recording (seconds)
-r = set frame rate
-y = overwrite existing file
-s = resolution size
-f = force format
實例
// where ffmpeg is located
$ffmpeg = '/usr/bin/ffmpeg';
//video dir
$video = 'path/to/video';
//where to save the image
$image = 'path/to/image.jpg';
//time to take screenshot at
$interval = 5;
//screenshot size
$size = '640x480';
//ffmpeg command
$cmd = "$ffmpeg -i $video -deinterlace -an -ss $interval -f mjpeg -t 1 -r 1 -y -s $size $image 2>&1";
exec($cmd);
或者嘗試
$second = 15;
$cmd = "$ffmpeg -itsoffset -$second -i $video -vcodec mjpeg -vframes 1 -an -f rawvideo -s $size $image";
exec($cmd);
想你也應該看看細節勸阻上可能存在的問題
相關問題
- 1. WCF服務創建視頻縮略圖
- 2. 從PHP文件,視頻,圖像創建縮略圖
- 3. php創建服務器上的圖像縮略圖
- 4. 從解析中保存的視頻創建縮略圖圖像
- 5. ffmpeg-php創建視頻縮略圖
- 6. 從路徑創建視頻縮略圖
- 7. 如何從服務器視頻獲取視頻縮略圖?
- 8. 從視頻網址創建縮略圖圖像!
- 9. 在django上傳視頻並從視頻創建縮略圖
- 10. 如何在xamp中創建ffmpeg的視頻縮略圖php
- 11. 從圖庫中挑選圖像並在圖像視圖中創建縮略圖
- 12. 如何創建嵌入視頻代碼的縮略圖圖像
- 13. 創建上傳到s3的圖像和視頻縮略圖?
- 14. 如何從我的服務器獲取視頻縮略圖?
- 15. 從視頻網址獲取視頻的縮略圖圖像
- 16. Android:從視頻URI創建視頻縮略圖
- 17. iPhone:創建視頻縮略圖
- 18. ASP.Net:上傳視頻,創建縮略圖
- 19. 創建HTML5視頻縮略圖
- 20. 爲視頻創建縮略圖
- 21. 從在不同的服務器上託管的視頻創建縮略圖在php
- 22. 生成視頻的縮略圖圖像
- 23. 使用ffmpeg生成視頻縮略圖;從RTMP服務器
- 24. 從視頻中生成縮略圖的服務
- 25. 從圖像創建視頻
- 26. 從視頻文件創建縮略圖返回null位圖
- 27. 如何在視頻上傳時創建縮略圖? [php/codeigniter]
- 28. 從asp.net中的視頻創建縮略圖
- 29. 如何在dmcloud.net上從上傳的視頻創建縮略圖
- 30. facebook視頻縮略圖圖像網址?
我不能在我的本地''EXEC創建截圖( 「ffmpeg -i $ remoteVideo -ss 00:00:01.000 -vframes 1 $ destImagePath」);' – Hitesh 2014-11-28 10:42:01
可以看看我的問題嗎?請http://stackoverflow.com/questions/27189948/ffmpeg-is-not -creating-screenshot-from-video – Hitesh 2014-11-28 13:52:04