【问题标题】:FFmpeg code not working on http url for thumbnail extractionFFmpeg 代码不适用于用于缩略图提取的 http url
【发布时间】:2014-09-15 12:23:10
【问题描述】:

我正在尝试从 sharepoint 2013 视频库中提取缩略图。我找到了一个可以使用 ffmpeg 提取的链接。这是链接: [How can I save first frame of a video as image?

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

当我用共享点站点 url 和视频名称替换输入文件时,它不会产生任何缩略图。我也给出了错误

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

我想了解如何使它适用于 http url。 如果无法在 ffmpeg 中使用 url,任何人都可以建议另一种方法来实现缩略图。(因为如果没有手动设置,我希望使用视频的第一帧自动设置缩略图)

【问题讨论】:

    标签: sharepoint video ffmpeg image-extraction


    【解决方案1】:

    我测试了他们工作的以下参数。从远程视频中提取第一帧。

    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

    【讨论】:

    • 您好,感谢您的回复。我运行了 http,但仅用于匿名共享点站点访问。如果我将它与需要登录的共享点站点一起使用,它不会生成缩略图。这就是我正在做的。static string filename = "abc24:23478/FirstVideo%20list/Wildlife.wmv"; ffmpeg.StartInfo.Arguments = "-i " + 文件名 + " -an -ss 00:00:01 " + 输出;ffmpeg.StartInfo.FileName = @"D:\Zeba\VideoThumbnail\ffmpeg.exe";
    猜你喜欢
    • 2011-06-21
    • 2018-11-27
    • 2012-07-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-04-14
    相关资源
    最近更新 更多