2014-07-24 16 views
3

我想從sharepoint 2013視頻庫中提取縮略圖。我找到了一個可以使用ffmpeg提取的鏈接。這是鏈接: [How can I save first frame of a video as image?FFmpeg代碼不能用於縮略圖提取的http url

filename = "http://siteurl/" + items["FileRef"].ToString(); 

當我替換的SharePoint網站網址和視頻名稱輸入文件,那麼它不會產生任何縮略圖。我也給出了錯誤

ffmpeg.Start(); 
     ffmpeg.WaitForExit(); 
     ffmpeg.Close() 

我想了解如何使它爲http url工作。 如果無法在ffmpeg中使用url,任何人都可以提出另一種方法來實現縮略圖(因爲如果沒有手動設置,我想使用第一幀視頻自動設置縮略圖)

回答

0

我在參數他們工作。從遠程視頻中提取第一幀。

ffmpeg -i "http://techslides.com/demos/sample-videos/small.mp4" -f image2 -vframes 1 "e:\images\01\image%03d.jpg" 

提取從視頻的特定的持續時間(第一幀也許黑色)圖像使用-ss參數。 -ss 00:00:02表示在第2秒拍攝圖像。 (更具體的幀-ss 00:00:02.xxx XXX = 0到999毫秒)

ffmpeg -ss 00:00:02 -i "http://techslides.com/demos/sample-videos/small.mp4" -f image2 -vframes 1 "e:\images\01\image%03d.jpg" 

更新代碼How can I save first frame of a video as image?爲您的需要。

更新

下面的命令失敗,處理輸入時候,但你可以找到想-cookies-headers參數,以你的問題的解決方案中發現無效數據。 當需要驗證時-cookies-headers參數可用於如下。當您登錄到服務器時使用Fiddler獲取cookie並將它們添加到ffmpeg -cookies-headers參數。

ffmpeg -cookies "path=/; domain=domainname.com; cookiesgoeshere\r\n" -i "video url goes here" -f image2 -vframes 1 "e:\image%03d.jpg" 

ffmpeg -headers "Cookie: path=/; domain=domainname.com; cookiesgoeshere\r\n" -i "video url goes here" -f image2 -vframes 1 "e:\image%03d.jpg" 

相關主題

How to enable cookies in ffmpeg HLS - Stack Overflow

Zeranoe FFmpeg - View topic - Custom http headers

另一個選擇是運行的ffmpeg在Web服務器

+0

嗨,謝謝你的回覆。我獲得了http運行,但僅限於匿名SharePoint站點訪問。如果我使用需要登錄的SharePoint站點,則不會生成縮略圖。這就是我正在做的.static string filename =「http:// abc24:23478/FirstVideo%20list/Wildlife.wmv」; ffmpeg.StartInfo.Arguments =「-i」+ filename +「-an -ss 00:00:01」+ output; ffmpeg.StartInfo。FileName = @「D:\ Zeba \ VideoThumbnail \ ffmpeg.exe」; – user2240379