开发者

Extract keyframe from flv using C#

开发者 https://www.devze.com 2023-01-21 14:14 出处:网络
Is there a way to extract a keyframe from开发者_运维技巧 flv file using C#?Can\'t find a direct way of doing this.

Is there a way to extract a keyframe from开发者_运维技巧 flv file using C#?


Can't find a direct way of doing this.

However you can use FFmpeg.exe in C#.

Here you can find a C# wrapper to easily use FFmpeg in C#:

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

The following code is taken from their sample page. Seems like you can extract frames and create thumbnails from them in the following manner:

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

Use converter.AVPrope.Decode(-1) to decode the next frame and converter.AVPrope.CurrentPicture to get the thumbnail picture. Use converter.AVPrope.SaveCurrentFrame(fileName) to save current frame to the file 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);

Hope it helps.

0

精彩评论

暂无评论...
验证码 换一张
取 消