gpt4 book ai didi

c# - 使用C#从flv中提取关键帧

转载 作者:太空宇宙 更新时间:2023-11-03 14:26:05 24 4
gpt4 key购买 nike

有没有办法使用 C# 从 flv 文件中提取关键帧?

最佳答案

无法找到执行此操作的直接方法。

但是您可以使用 FFmpeg.exe在 C# 中。

在这里,您可以找到一个 C# 包装器,以便在 C# 中轻松使用 FFmpeg:

http://www.ffmpeg-csharp.com/

以下代码取自他们的示例页面。似乎您可以通过以下方式提取帧并从中创建缩略图:

CAVConverter converter = new CAVConverter();
//...

使用converter.AVPrope.Decode(-1)解码下一帧,使用converter.AVPrope.CurrentPicture获取缩略图。使用 converter.AVPrope.SaveCurrentFrame(fileName) 将当前帧保存到文件 fileName。

//Load the file
converter.AVPrope.LoadFile(fileName, "");
//Decode the frame converter.AVPrope.Decode(-1);
//Get the thumbnail picture. It is a IPictureDisp object, do something as you need.
var thumbnail = converter.AVPrope.CurrentPicture;
//Save current frame to file fileName
converter.AVPrope.SaveCurrentFrame(fileName);

希望对您有所帮助。

关于c# - 使用C#从flv中提取关键帧,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3972469/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com