By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,117 Members | 2,142 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,117 IT Pros & Developers. It's quick & easy.

video from static images

P: n/a
Hello,

I have a program that renders an animation. I would like the program
to be able to save this animation to a popular video file. Is there
a .NET API for doing this? I looked into DirectShow, but I could not
determine if it can be used to capture data from the screen.
Oct 21 '08 #1
Share this Question
Share on Google+
4 Replies


P: n/a
On Mon, 20 Oct 2008 22:34:22 -0700, <cr*****@gmail.comwrote:
Hello,

I have a program that renders an animation. I would like the program
to be able to save this animation to a popular video file. Is there
a .NET API for doing this? I looked into DirectShow, but I could not
determine if it can be used to capture data from the screen.
DirectShow is not supported in .NET. But there is an open-source project
providing a managed-code wrapper for it, called DirectShow.NET.

As far as whether it supports screen capture, it doesn't. But if your own
program is generating the animation, it should be simple enough to divert
the images being displayed to the screen to a source filter for a video
compression graph in DirectShow.

If it's not your own program generating the animation and you need to
capture from the screen, I'm pretty sure there are existing third-party
programs that do that. I seem to recall Fraps having this feature, for
example.

Pete
Oct 21 '08 #2

P: n/a
As far as whether it supports screen capture, it doesn't. But if your own
program is generating the animation, it should be simple enough to divert
the images being displayed to the screen to a source filter for a video
compression graph in DirectShow.
Thanks for your reply. My own program is generating the animation and
this is probably what I want to do. If you are familiar with this,
can you elaborate more on what needs to be done or at least give the
DShow interface names so I can start looking them up on MSDN?

Is a source filter basically an array of images?
[...]
>
Pete
Oct 21 '08 #3

P: n/a
On Mon, 20 Oct 2008 23:16:11 -0700, <cr*****@gmail.comwrote:
Thanks for your reply. My own program is generating the animation and
this is probably what I want to do. If you are familiar with this,
can you elaborate more on what needs to be done or at least give the
DShow interface names so I can start looking them up on MSDN?
Sorry...I haven't done this stuff recently enough to have the relevant
interface names off the top of my head. Basically, though...you'll want
to set up a graph with the appropriate encoder and file writer as the
renderer, and your own pull source filter as the input.

Looking at the built-in "File Source (Async)" filter, it looks like a good
start would be the IBaseFilter and IAsyncReader filter interfaces (the
latter being implemented by the output pin of your IBaseFilter).

If you want more details, I recommend the DirectShow specific forums, such
as microsoft.public.win32.programmer.directx.video. There's also
microsoft.public.multimedia.directx.dshow.programm ing...I don't recall
that newsgroup, but it looks like it's been around since '97. I don't
know what the difference between the two might be, other than that the
"video" newsgroup is likely to be more specific to video-related
questions, while the other is probably more general.
Is a source filter basically an array of images?
In DirectShow, the entire process is set up as a directed graph. Each
node in the graph is a "filter". Every filter exposes input pins, output
pins, or both. The pins are the logical connection between one filter and
another.

Different filters do different things. Source filters provide data,
transformation filters change the data, and renderers write data. Sources
can be files, video cameras, or programmatically generated, for example.
Transformations including codecs, color-space conversion, video effects,
etc. Renderers can be video cards, files, network i/o, etc.

Source filters have only output pins, renderers have only input pins.

So, when I write "source filter", I mean that you'll implement a filter
with an output pin that will present each image in sequence to the
DirectShow graph that you've set up to write the file. You'll use as the
renderer an appropriate codec writing into the "File Writer" filter. When
I describe the filter as a "pull" filter, that means that the downstream
input pin is responsible for requesting each video frame as needed. A
"push" filter is one where the source controls the flow. "Pull" is
generally more appropriate when you want the renderer to go as fast as it
can (such as when writing a file).

This is all already pretty off-topic. Hopefully the above is enough to
get you pointed in the right direction, and you can get more help in the
more directly related forums as needed. (They may even clear up whatever
mistakes I've made in the above...as I said, it's been awhile and I may be
a bit rusty).

Pete
Oct 21 '08 #4

P: n/a
On Oct 21, 2:16*am, cron...@gmail.com wrote:
Thanks for your reply. *My own program is generating the animation and
this is probably what I want to do. *If you are familiar with this,
can you elaborate more on what needs to be done or at least give the
DShow interface names so I can start looking them up on MSDN?
I would also look at the DirectShowLib stuff on SourceForge.
http://sourceforge.net/project/showf...roup_id=136334

We've been using that with C# for a couple of years now without
problems. Most of the code is in C# but we have a few custom filters
written in C++. As long as you have some familiarity with C++ and COM
you can easily create a source filter to take a series of bitmaps from
your application and pump them through the filter. I would look into
using the ASFWriter fitler to start with for creating .wmv files since
there are examples for that and it works pretty well. The examples
that come with direct show SDK already have a simple bitmap array
pumper and I believe a sample graph that dumps to .wmv format.
Oct 21 '08 #5

This discussion thread is closed

Replies have been disabled for this discussion.