问题
I am trying to extract thumbnail from sharepoint 2013 video library. I found a link which can extract using ffmpeg. this is the link: [How can I save first frame of a video as image?
filename = "http://siteurl/" + items["FileRef"].ToString();
When i replaced the input file with sharepoint site url and video name then it does not produce any thumbnail. I also gives error on
ffmpeg.Start();
ffmpeg.WaitForExit();
ffmpeg.Close()
I would like to understand how make it work for http url. If it is not possible to use url in ffmpeg can anyone suggest another method to achieve thumbnail.(as i want the thumbnail to be set automatically using 1st frame from of video if it not set manually)
回答1:
I tested below parameters they worked. to extract first frame from remote video.
ffmpeg -i "http://techslides.com/demos/sample-videos/small.mp4" -f image2 -vframes 1 "e:\images\01\image%03d.jpg"
to extract image from specific duration of the video (first frame maybe black) use the -ss parameter. -ss 00:00:02 means take image at 2th second. (more specific frame -ss 00:00:02.xxx xxx=0 to 999 milliseconds)
ffmpeg -ss 00:00:02 -i "http://techslides.com/demos/sample-videos/small.mp4" -f image2 -vframes 1 "e:\images\01\image%03d.jpg"
update the code How can I save first frame of a video as image? as your need.
Updates
Below commands failed with Invalid data found when processing input but you can find a solution to your question by trying -cookies or -headers parameters. When authentication is required -cookies or -headers arguments can be used as below. When you log in to server use Fiddler to get cookies and add them to ffmpeg -cookies or -headers parameters.
ffmpeg -cookies "path=/; domain=domainname.com; cookiesgoeshere\r\n" -i "video url goes here" -f image2 -vframes 1 "e:\image%03d.jpg"
or
ffmpeg -headers "Cookie: path=/; domain=domainname.com; cookiesgoeshere\r\n" -i "video url goes here" -f image2 -vframes 1 "e:\image%03d.jpg"
related topics
How to enable cookies in ffmpeg HLS - Stack Overflow
or Zeranoe FFmpeg - View topic - Custom http headers
another option is run ffmpeg in your web server
来源:https://stackoverflow.com/questions/24925369/ffmpeg-code-not-working-on-http-url-for-thumbnail-extraction