視頻採集: 保存一个 AVI 文件

下面這個示例程序將介紹如何使用IC Imaging Control將一個圖像數據流保存為一個AVI文件。
語言:.NET C#/Visual Basic
版本:3.0.3
发布于:2005年4月7日
作者:IC Imaging Control 技術支持部
需求:IC Imaging Control >2.1
由WDM數據流類驅動程序驅動的相機、視頻轉換器或圖像採集卡

示例程序窗口如下圖所示:

The Testdialog of IC Imaging Control,

首先,向程序窗體中放置IC Imaging Control控件和兩個用於控制視頻錄製的按鈕。

程序開始運行後先調用內置對話框用於選擇一台視頻捕捉設備(.ShowDeviceSettingsDialog)。 而後,通過LiveStart顯示設備傳來的現場視頻數據流:

[C#]
private void Form1_Load(object sender, System.EventArgs e)
{
    icImagingControl1.ShowDeviceSettingsDialog();

    if( !icImagingControl1.DeviceValid )
    {
        Close();
        return;
    }

    btnStopCapture.Enabled = false;
    icImagingControl1.LiveStart();
}

用戶點擊"Start Capture AVI",程序停止顯示現場視頻(.LiveStop),創建一個AVI文件(.AviStartCapture)。

點擊"Stop Capture AVI"將關閉這個AVI文件(.AviStopCapture),開啟視頻數據流(.LiveStart):

[C#]
private void btnStartCapture_Click(object sender, System.EventArgs e)
{
    icImagingControl1.LiveStop();
    icImagingControl1.AviStartCapture( "video.avi", "DV Video Encoder" );

    btnStartCapture.Enabled = false;
    btnStopCapture.Enabled = true;
}

private void btnStopCapture_Click(object sender, System.EventArgs e)
{
    icImagingControl1.AviStopCapture();
    icImagingControl1.LiveStart();

    btnStopCapture.Enabled = false;
    btnStartCapture.Enabled = true;
}

相關源代碼示例

責任聲明
IC Imaging Control源代碼庫中的所有代碼均只用於教學目的,The Imaging Source Europe GmbH作為IC Imaging Control的開發製造商,不對任何由於使用本文或其中源代碼所產生的後果承擔責任。

该网站为The Imaging Source网络的一部分。其它的站点包括 公司, Imaging, 天文相機, Astronomy Cameras Blog, Blog caméras d'astronomie, 天文相機有獎競答, TX Text Control, LiveDocx, phpLiveDocxForum.