Hi, there are a number of sources (ONE, TWO and THREE) which show how to use VB6 to create a video file from BMPs, does anybody have any tutorials / links / suggestions for doing this in VB.NET?
Printable View
If anybody is interested, I have found a couple of examples of this in C#. I'm going to try (with very limited knowledge of C# at the moment!) to create some sort of DLL which will handle these functions.
Ok, here is what I have sorted out at the moment. I must stress that the AVI stuff isn't my code, its from http://www.adp-gmbh.ch/csharp/avi/write_avi.html.
Basically you open the attached VS 2003 C# project and compile it (its a DLL)...
Once you have added the DLL as a reference for your project you can use the following code fragment in your VB app to make an avi.
VB Code:
'// FIRST CREATE ALL THE VARIABLES AND CLASSES YOU NEED Dim fr As UInt32 'set up a uint32 for frame rate fr = Convert.ToUInt32(FRAME_RATE) 'set frame rate (from a constant in this case) Dim AW As AviWriter = New AviWriter Dim BM as Bitmap BM = AW.Open("replay.avi", fr, pbField.Width, pbField.Height) Dim canvas as Graphics = Graphics.FromImage(BM) '// THEN WRITE TO THE AVI FILE For i = 0 To FRAME_COUNT 'loop through writing each frame one at a time canvas.Clear(Color.White) 'clear the canvas ' THEN DRAW SHAPES ON TO THE CANVAS (using standard GDI+ code e.g. canvas.FillRectangle(...) etc.) ' I think you could also use BM = BM.FromFile(filename) to load bitmaps one at a time from the hard drive AW.AddFrame() 'add the bitmap (BM) to the AVI file Next AW.Close() 'clear resources
It really help me, thx
Anyone have a working .NET sample of the 'BMP to AVI' code?. I tried what was detailed above and it didnt work.
to appolospb.....have u found anything to sort out this problem...it would be really helpful if postback positively....
I ended up using Windows Media Encoder SDK to record video rather then going down the route of converting BMP images to AVI. I am not really satisfied with my solution but it was the best i could do with the information available on this subject.
I found it next to impossible to find any working examples of recording from the screen to .avi using Visual Basic.net . There are a couple of really old VB6 or C# examples floating about on the net but these just fail to compile or i am unable to update them to .NET standard due to the code being rocket science. There are also a lot of 'record from webcam' examples about but these are also useless and not what i wanted.
Windows Media Encoder SDK isnt great capture quality and doesnt support DivX Etc but its fairly easy to code (Poorly documented however). It allows you to record from the screen to .WMV which is better then nothing :-(