Extract frames from video files – The Code Project – Multimedia

 

Introduction

This class contains methods to use the IMediaDet interface, that can be found in Microsoft DirectShow.
The Media Detector object, among other things, can be used to extract still pictures from several file formats including .avi, .wmv and some .mpeg files. This class exposes the GetFrameFromVideo, GetVideoSize and SaveFrameFromVideo methods that can be used from any .net application. The class also takes care of translating HRESULTs returned from the functions to meaningful .net exceptions.

Using the code

Just add a reference to JockerSoft.Media.dll in your project (or include the source code). Remember also to distribute Interop.DexterLib.dll  All the methods are static, so to use them just do something like

try
{
    this.pictureBox1.Image = FrameGrabber.GetFrameFromVideo(strVideoFile, 0.2d);
}
catch (InvalidVideoFileException ex)
{
    MessageBox.Show(ex.Message, "Extraction failed");
}
catch (StackOverflowException)
{
    MessageBox.Show("The target image size is too big", "Extraction failed");
}

or

try
{
    FrameGrabber.SaveFrameFromVideo(strVideoFile, 0.2d, strBitmapFile);
}
catch (InvalidVideoFileException ex)
{
    MessageBox.Show(ex.Message, "Extraction failed");
}

Via Extract frames from video files – The Code Project – Multimedia

Read/Write App.Config

In .NET 2.0+ and with the help of Visual Studio Generated Settings.settings, you can do the following:

image

Load your settings programmatically:

Settings set = Settings.Default;

Read from your settings:

string str = set.testSetting;

Write to your settings:

set.testSetting = “xyz”;
set.Save();

Very Easy

LINQ, C# Rolls

 

What’s New in C# 

Community Web Sites and Downloads

Source from : Charlie Calvert’s Community Blog

del.icio.us Tags: ,