繁体   English   中英

使用C#从flv提取关键帧

[英]Extract keyframe from flv using C#

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

找不到直接的方法。

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

在这里,您可以找到一个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);

希望能帮助到你。

暂无
暂无

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

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