相机 - 视频捕捉和保存VB.NET [英] Camera - video capture and save VB.NET

查看:109
本文介绍了相机 - 视频捕捉和保存VB.NET的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有人有通过Aforge从集成摄像头捕获和保存视频的工作代码?谁可以分享?谢谢



我尝试了什么:



我尝试过directx。捕获



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

推荐答案

也许你可以使用 VideoCaptureDevice Class ,参见示例: VideoCaptureDevice Class [ ^ ]
Maybe you can use the VideoCaptureDevice Class, see example: VideoCaptureDevice Class[^]


这篇关于相机 - 视频捕捉和保存VB.NET的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆