tags:

views:

194

answers:

4

how to convert avi file to an jpg's images array using .net , i need to develop a task that will take the avi file and save it as jpg images on another folder

+2  A: 

have a look at: http://ffmpegdotnet.codeplex.com/

Looking a bit further, it appears there is no download there, but found this too:

http://www.intuitive.sk/fflib/post/fflib-net-released.aspx

Mark Redman
A: 

.NET has no out-of-the-box way of managing audio or video. You'd have to use an external API. DirectX for example can handle .avi files.

Jonas B
+6  A: 

You can do this from the command line with ffmpeg. See this part of the documentation. For example,

ffmpeg -i infile.avi -f image2 image-%03d.jpg

will save all frames from infile.avi as numbered jpegs (image-001.jpg, image-002.jpg,...). You can then use other command line options to get just the frames you want or do some other post processing like resizing or deinterlacing.

You could just create a program in .NET that calls the ffmpeg executable with the right command line and moves the resulting files into the correct place. It would be much easier than trying to use some video library directly.

Jason
+1 I've done this before and it works beautifully
Josh Stodola
A: 

thx for your kind trying to help me, i need to automate the conversion process so i found that i need to use directshow also i found " splicer " (the little video/audio composition library that leverages DirectShow I add it and write a complete solution and thx God i finish my task ., i write a post on my blog for this task and how to use splicer to convert the avi to jpg files check it http://blog.waleedmohamed.net/2010/04/convert-avi-video-to-jpg-images-capture.html

also this is the small code that you need to write in your application to perform like these tasks

 static void Main(string[] args)
    {

        using (DefaultTimeline timeline = new DefaultTimeline())
        {
             timeline.AddVideoGroup(16, 664, 246).AddTrack(); // we want 320x240 24bpp sized images
            timeline.AddVideo("Test.avi"); // 8 second video clip
            List<double>thresholds = new List<double>() ;
            for (double i = 0; i < 5000; i++)
            {
                thresholds.Add(i);
            }
            ImagesToDiskParticipant participant = new ImagesToDiskParticipant(16, 664, 246, Environment.CurrentDirectory, thresholds.ToArray());
            using (NullRenderer render = new NullRenderer(timeline, null, new ICallbackParticipant[] { participant }))
            {
                render.Render();
            }
        }
    }
Waleed Mohamed