Results 1 to 7 of 7

Thread: BMP to AVI/MPEG

  1. #1

    Thread Starter
    Member
    Join Date
    Mar 2006
    Posts
    45

    BMP to AVI/MPEG

    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?
    VB.2003

  2. #2

    Thread Starter
    Member
    Join Date
    Mar 2006
    Posts
    45

    Re: BMP to AVI/MPEG

    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.
    VB.2003

  3. #3

    Thread Starter
    Member
    Join Date
    Mar 2006
    Posts
    45

    Arrow Re: BMP to AVI/MPEG

    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:
    1. '// FIRST CREATE ALL THE VARIABLES AND CLASSES YOU NEED
    2.         Dim fr As UInt32 'set up a uint32 for frame rate
    3.         fr = Convert.ToUInt32(FRAME_RATE) 'set frame rate (from a constant in this case)
    4.         Dim AW As AviWriter = New AviWriter
    5.         Dim BM as Bitmap
    6.         BM = AW.Open("replay.avi", fr, pbField.Width, pbField.Height)
    7.         Dim canvas as Graphics = Graphics.FromImage(BM)
    8.  
    9.  
    10.         '// THEN WRITE TO THE AVI FILE
    11.         For i = 0 To FRAME_COUNT 'loop through writing each frame one at a time
    12.                 canvas.Clear(Color.White) 'clear the canvas
    13.                 ' THEN DRAW SHAPES ON TO THE CANVAS (using standard GDI+ code e.g. canvas.FillRectangle(...) etc.)
    14.                 ' I think you could also use BM = BM.FromFile(filename) to load bitmaps one at a time from the hard drive
    15.                 AW.AddFrame() 'add the bitmap (BM) to the AVI file
    16.         Next
    17.  
    18.         AW.Close() 'clear resources
    Attached Files Attached Files
    Last edited by Mecharius; Mar 30th, 2006 at 04:15 AM.
    VB.2003

  4. #4
    New Member
    Join Date
    Sep 2008
    Posts
    1

    Thumbs up Re: BMP to AVI/MPEG

    It really help me, thx

  5. #5
    Addicted Member
    Join Date
    Jan 2008
    Location
    Essex, UK
    Posts
    149

    Re: BMP to AVI/MPEG

    Anyone have a working .NET sample of the 'BMP to AVI' code?. I tried what was detailed above and it didnt work.
    Development Enviroment: Visual Studio 2008, VB.NET

    Recommend Winspector, far better then SPY++
    http://www.windows-spy.com/

  6. #6
    New Member
    Join Date
    Jun 2009
    Posts
    9

    Re: BMP to AVI/MPEG

    to appolospb.....have u found anything to sort out this problem...it would be really helpful if postback positively....

  7. #7
    Addicted Member
    Join Date
    Jan 2008
    Location
    Essex, UK
    Posts
    149

    Re: BMP to AVI/MPEG

    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 :-(
    Development Enviroment: Visual Studio 2008, VB.NET

    Recommend Winspector, far better then SPY++
    http://www.windows-spy.com/

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width