Click here to Skip to main content
15,888,527 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
Hi, does anyone have a working code for capture and save video from an integrated camera via Aforge? Who could share it? Thank you

What I have tried:

I tried directx.capture

Public Class Form1
    Public cap As Capture
    Public f As Filters

    Public Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        f = New Filters

        cap = New Capture(f.VideoInputDevices(0), f.AudioInputDevices(0))
        cap.FrameRate = 29.997
        cap.FrameSize = New Size(640, 480)

        cap.AudioSamplingRate = 44100
        cap.AudioSampleSize = 16
        'cap.AudioChannels = 1
        cap.PreviewWindow = PictureBox1


    End Sub

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Timer1.Start()
        cap.Filename = "test.mp4"
        cap.Cue()
        cap.Start()
    End Sub

    Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
        cap.Stop()
        'cap.Dispose()

    End Sub

    Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
        'Process.Start("start.avi")
        Form2.AxWindowsMediaPlayer1.URL = "test.mp4"
        Form2.ShowDialog()

    End Sub

    Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
        Application.Exit()
    End Sub


End Class
Posted
Updated 21-Nov-18 2:55am

1 solution

Maybe you can use the VideoCaptureDevice Class, see example: VideoCaptureDevice Class[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900