在 ASP.NET 中获取 FLV 缩略图而不更改服务器权限的简单方法?

发布于 2024-07-07 09:40:09 字数 384 浏览 7 评论 0原文

我正在寻找一种简单的方法来获取 ASP.NET 中的 FLV 缩略图,而无需更改服务器上的任何权限/设置。 理想情况下,服务器计算机上不安装任何内容,但如果有必要,可以使用 FFmpeg 等小型工具。

我已经尝试使用带有 Process.Start 的命令行工具来使用 FFmpeg,但是在 Windows 窗体应用程序中和命令提示符中运行的相同命令在 ASP.NET 中不起作用(可能是因为权限的原因)。

我也尝试过使用 TAO.FFmpeg,它似乎在大多数情况下都能工作,但会随机失败,并且直到机器重新启动后才会再次开始工作。 即使我使用示例代码 (decoder.cs),当我尝试在单个请求中打开多个视频时,有时也会失败。

如果这不可能以干净/直接的方式实现,我愿意接受其他建议。

I'm looking for a simple way to grab thumbnails of FLVs in ASP.NET, without having to change any permissions/settings on the server. Ideally, nothing is installed on the server machine, but if necessary, small tools such as FFmpeg are fine.

I've tried FFmpeg using the command-line tool with Process.Start, but the same command that works in a Windows Forms application and from the command prompt does not work in ASP.NET (presumably because of permissions).

I've also tried using TAO.FFmpeg, and it seems to be working most of the time, but fails randomly, and does not start working again until the machine is restarted. Even when I use the sample code (decoder.cs), it sometimes fails when I try to open multiple videos in a single request.

If this isn't possible in a clean/straightforward way, I'm open to other suggestions.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

花开半夏魅人心 2024-07-14 09:40:09

如果您可以在页面上嵌入 Flash,则显示 FLV 缩略图的最简单方法是在舞台上放置一个视频对象,通过 ActionScript 中的 NetStream 将视频附加到该对象,然后放入一个事件处理程序来暂停该视频对象。开始播放后立即移动。

例如,如果舞台上有一个名为“myVideo”的视频对象,并且您尝试显示“someVideo.flv”的缩略图,请尝试使用此 ActionScript (2.0) 代码,

var connection_nc:NetConnection = new NetConnection();
connection_nc.connect(null);
var stream_ns:NetStream = new NetStream(connection_nc);
myVideo.attachVideo(stream_ns);
stream_ns.play("someVideo.flv");
stream_ns.seek(0);

stream_ns.onStatus = function(info)
{
    if(info.code = "NetStream.Play.Start")
    {

        stream_ns.pause();
    }
}

就您的 ASPX 与 Flash 的对话而言,您可以通过 FlashVars 将 FLV 视频名称传递给 Flash,以便您的 SWF 知道要显示什么缩略图。

If you can embed Flash on a page, the easiest way to show a thumbnail of a FLV is to put a video object on the stage, attach a video to it through a NetStream in actionscript, and then put in an event handler to pause the move immediately after it starts playing.

For example, if you have a video object on the stage called "myVideo", and you're trying to show a thumbnail of "someVideo.flv", try this actionscript (2.0) code,

var connection_nc:NetConnection = new NetConnection();
connection_nc.connect(null);
var stream_ns:NetStream = new NetStream(connection_nc);
myVideo.attachVideo(stream_ns);
stream_ns.play("someVideo.flv");
stream_ns.seek(0);

stream_ns.onStatus = function(info)
{
    if(info.code = "NetStream.Play.Start")
    {

        stream_ns.pause();
    }
}

In terms of your ASPX talking to your Flash, you could pass the FLV video name to Flash via FlashVars so that your SWF would know what thumbnail to show.

温柔戏命师 2024-07-14 09:40:09

请访问 http://www.all4dotnet.com/ 试用 Media Manager Pro

Try Media Manager Pro at http://www.all4dotnet.com/

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文