简体   繁体   English

FFmpeg代码无法在http url上进行缩略图提取

[英]FFmpeg code not working on http url for thumbnail extraction

I am trying to extract thumbnail from sharepoint 2013 video library. 我正在尝试从sharepoint 2013视频库中提取缩略图。 I found a link which can extract using ffmpeg. 我发现了一个可以使用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. 当我用sharepoint网站网址和视频名称替换输入文件时,它不会产生任何缩略图。 I also gives error on 我也给出了错误

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

I would like to understand how make it work for http url. 我想了解如何使其适用于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) 如果在ffmpeg中无法使用url,那么任何人都可以提出另一种方法来实现缩略图。(因为如果不手动设置,我希望使用视频的第一帧自动设置缩略图)

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参数。 -ss 00:00:02 means take image at 2th second. -ss 00:00:02表示在第2秒拍摄图像。 (more specific frame -ss 00:00:02.xxx xxx=0 to 999 milliseconds) (更具体的框架-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"

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. 下面的命令失败, 处理输入时发现无效数据,但您可以通过尝试-cookies-headers参数找到问题的解决方案。 When authentication is required -cookies or -headers arguments can be used as below. 当需要身份验证时,可以使用-cookies-headers参数,如下所示。 When you log in to server use Fiddler to get cookies and add them to ffmpeg -cookies or -headers parameters. 登录服务器时,使用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"

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 如何在ffmpeg HLS中启用cookie - Stack Overflow

or Zeranoe FFmpeg - View topic - Custom http headers Zeranoe FFmpeg - 查看主题 - 自定义http标头

another option is run ffmpeg in your web server 另一个选项是在您的Web服务器中运行ffmpeg

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM