Results 1 to 11 of 11

Thread: Images to AVI

  1. #1

    Thread Starter
    Member
    Join Date
    Mar 2011
    Posts
    56

    Images to AVI

    Hello, im trying to make images to avi maker, now i watched this thread: http://www.vbforums.com/showthread.php?t=395812 And i downloaded that avilib and imported, so now im trying to use this code:
    Code:
    Dim fr As UInt32 'set up a uint32 for frame rate
            fr = Convert.ToUInt32(60) '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 4 'loop through writing each frame one at a time 
                BM = Image.FromFile("C:\Stopmo\1.bmp")
                BM = Image.FromFile("C:\Stopmo\2.bmp")
                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()
    On form load. So now when i run my program, then it just makes replay.avi file and there is just white background for 1 second, and why it doesn't adds my image: BM = Image.FromFile("C:\Stopmo\1.bmp") ?

  2. #2
    Fanatic Member namrekka's Avatar
    Join Date
    Feb 2005
    Location
    Netherlands
    Posts
    639

    Re: Images to AVI

    Quote Originally Posted by Daslee View Post
    Code:
                
    BM = Image.FromFile("C:\Stopmo\1.bmp")
    BM = Image.FromFile("C:\Stopmo\2.bmp")
    AW.AddFrame() 'add the bitmap (BM) to the AVI file
    In this case you overwrite 1.bmp.

  3. #3

    Thread Starter
    Member
    Join Date
    Mar 2011
    Posts
    56

    Re: Images to AVI

    Quote Originally Posted by namrekka View Post
    In this case you overwrite 1.bmp.
    So that will replaces 1.bmp with 2.bmp?

  4. #4
    Fanatic Member namrekka's Avatar
    Join Date
    Feb 2005
    Location
    Netherlands
    Posts
    639

    Re: Images to AVI

    Did you name the bitmap files:
    1.bmp
    2.bmp
    3.bmp
    .
    .
    .
    n.bmp

  5. #5

    Thread Starter
    Member
    Join Date
    Mar 2011
    Posts
    56

    Re: Images to AVI

    Yes and they are in C:\Stopmo folder

  6. #6

    Thread Starter
    Member
    Join Date
    Mar 2011
    Posts
    56

    Re: Images to AVI

    Don't i need to make canvas.DrawImage(...) Because in video are black background and i think its from canvas.clear(color.white) so i think i should to do canvas.DrawImage(...) But i don't know how to code it..

  7. #7

    Thread Starter
    Member
    Join Date
    Mar 2011
    Posts
    56

    Re: Images to AVI

    So no more answers? ;/

  8. #8
    Fanatic Member namrekka's Avatar
    Join Date
    Feb 2005
    Location
    Netherlands
    Posts
    639

    Re: Images to AVI

    Quote Originally Posted by Daslee View Post
    So no more answers? ;/
    Hmmm...

    I must admit I have no experience with this Avifil32, but have some remarks.

    You can see a video stream as a certain amounts of frames in a certain time. In this case you defined 60 frames/second. That means if you want to have a bitmap shown for 1 second, 60 frames must be added with the same bitmap.

    Its not clear for me how long a certain bitmap must be shown in this case. I'm also not sure if every bitmap must be in a frame now after explaining this.

    Please define this first more clearly. Also I'm not a code provider but I can give you advise and point you in the right directions.

  9. #9
    PowerPoster Radjesh Klauke's Avatar
    Join Date
    Dec 2005
    Location
    Sexbierum (Netherlands)
    Posts
    2,244


    If you found my post helpful, please rate it.

    Codebank Submission: FireFox Browser (Gecko) in VB.NET, Load files, (sub)folders treeview with Windows icons

  10. #10

    Thread Starter
    Member
    Join Date
    Mar 2011
    Posts
    56

    Re: Images to AVI

    Quote Originally Posted by namrekka View Post
    Hmmm...

    I must admit I have no experience with this Avifil32, but have some remarks.

    You can see a video stream as a certain amounts of frames in a certain time. In this case you defined 60 frames/second. That means if you want to have a bitmap shown for 1 second, 60 frames must be added with the same bitmap.

    Its not clear for me how long a certain bitmap must be shown in this case. I'm also not sure if every bitmap must be in a frame now after explaining this.

    Please define this first more clearly. Also I'm not a code provider but I can give you advise and point you in the right directions.
    So i need to make like 2 frames/second and add BM = image.fromfile(image) and again BM = image.fromfile(image) ?

  11. #11

    Thread Starter
    Member
    Join Date
    Mar 2011
    Posts
    56

    Re: Images to AVI

    Quote Originally Posted by Radjesh Klauke View Post
    Pff.. F**k that ffmpeg last **** i don't know how to install, but if i get that ffmpeg.exe, then my program process.start(blabla...) doesn't work with that ffmpeg, it just runs and closes that ffmpeg, so...

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