摄像头捕获控件videocap.ocx的调用示例,可以录制桌面

By admin at 2022-01-23 • 0人收藏 • 936人看过

image.png

前面发过一个09年的控件 , https://www.chengxu.xyz/t/538

这个和上面帖子里的很像, 我感觉就是这个团队自己重新组建团队另起炉灶 ,再原来的基础上增加了一些功能吧?....

这个功能更强, 录制视频, 录制桌面, 画中画 , 捕获摄像头.....等等

和上面一样这个控件测试也同样图像不能设置填充满屏 .


我这里只是将摄像头部分给弄出来使用, 其他的功能需要其他的dll , 我就没测试了 , 如果你需要其他功能, 可以下载官方试用版.

官方网站: http://www.viscomsoft.com/products/videocap

为了方便国内下载 , 百度盘:

链接:https://pan.baidu.com/s/1Blpy-Mot6emt8fBN7RLsDg 

提取码:ttmn


只是使用摄像头显示相关功能 , 不会有demo提示, 我测试了下, 应该没有使用限制, 

如果用上面图片中的viscomsoft virtual screen 虚拟屏幕功能会有demo提示

下面工程里有两个文件VirtualAudioSpeakerFilter.axVirtualScreenCaptureFilter.ax , 这个是虚拟声卡和虚拟屏幕, 我在代码里用regsvr32注册过了. 


当然你也可以只注册这个虚拟桌面捕获AX控件, 这样你就可以在其他摄像头软件里看到这个虚拟桌面摄像头来录制电脑屏幕了.


import win.ui;
/*DSG{{*/
mainForm = win.form(text="aardio工程2";right=498;bottom=506)
mainForm.add(
audioList={cls="combobox";left=158;top=472;right=295;bottom=498;db=1;dl=1;dr=1;edge=1;items={};mode="dropdown";z=4};
button={cls="button";text="<--打开此摄像头";left=297;top=472;right=439;bottom=498;db=1;dr=1;z=2};
button2={cls="button";text="属性";left=441;top=472;right=494;bottom=498;db=1;dr=1;z=5};
picturebox={cls="picturebox";left=0;top=0;right=499;bottom=466;bgcolor=8421376;db=1;dl=1;dr=1;dt=1;z=1};
videoList={cls="combobox";left=7;top=472;right=157;bottom=498;db=1;dl=1;edge=1;items={};mode="dropdown";z=3}
)
/*}}*/

import console
console.open()

import fsys;
import com.activeX;
//注册 摄像头捕获 控件
try{
	com.CreateObject("{AA408ECC-E50B-401F-8036-021E81B9E5A1}");
}
catch(e){
	io.appData("\videocap\videocap.lic",$"\res\videocap.lic");
	com.activeX.appData("\videocap\videocap.ocx",$"\res\videocap.ocx");  
}

//注册虚拟桌面摄像头和声卡
try{
	com.CreateObject("{251A0F60-62C4-40CC-A5E6-FA70BC0B6F1A}");
}
catch(e){
	com.activeX.appData("\videocap\VirtualAudioSpeakerFilter.ax",$"\res\VirtualAudioSpeakerFilter.ax");
	com.activeX.appData("\videocap\VirtualScreenCaptureFilter.ax",$"\res\VirtualScreenCaptureFilter.ax");
}


var video = mainForm.picturebox.createEmbedEx("{AA408ECC-E50B-401F-8036-021E81B9E5A1}",,{
	Click = function(){
		video._object.Click();
	};
	DblClick = function(){
		video._object.DblClick();
	};
	MouseMove = function(Button, Shift, x, y){
		video._object.MouseMove(Button, Shift, x, y);
	};
	Capturing = function(lFrame,lDropFrame,iSecond,iOnedecimalplace){
		video._object.Capturing(lFrame,lDropFrame,iSecond,iOnedecimalplace);
	};
	DeviceChange = function(){
		video._object.DeviceChange();
	};
});
//音频
for(i=0;video.GetAudioDeviceCount( )-1;1){
	mainForm.audioList.add(video.GetAudioDeviceName(i));
}
//视频
for(i=0;video.GetDeviceCount( )-1;1){
	mainForm.videoList.add(video.GetDeviceName(i));
}

//事件
video.Click = function(){
	console.log("Click")
}
video.DblClick = function(){
	console.log("DblClick")
	//全屏
	video.ClearFullScreenType = 1; //Mouse button
    video.ClearFullScreenMouseButton = 0; //Left Button Down
	video.ShowFullScreen(true)
}
video.Capturing = function(lFrame,lDropFrame,iSecond,iOnedecimalplace){
	console.log("Capturing --- lFrame,lDropFrame,iSecond,iOnedecimalplace")
}
video.DeviceChange = function(){
	console.log("DeviceChange")
}

//打开
mainForm.button.oncommand = function(id,event){
	video.Device = 	mainForm.videoList.selIndex - 1; //摄像头
	video.AudioDevice = mainForm.audioList.selIndex - 1; //音频设备
	video.Start(); // 开启
}

mainForm.onClose = function(hwnd,message,wParam,lParam){
    video.Stop();
    video.Unload();
}

mainForm.button2.oncommand = function(id,event){
	//弹出的摄像头属性窗口里所有的属性都可以单独代码设置
	//video.Brightness.Value=70 // 演示 亮度调节
	
	//打开摄像头属性窗口
	video.ShowVideoCapturePropertyPage(mainForm.hwnd);
}

mainForm.show();
return win.loopMessage();

aardio工程2.zip


登录后方可回帖

登 录
信息栏
 私人小站

本站域名

ChengXu.XYZ

投诉联系:  popdes@126.com



快速上位机开发学习,本站主要记录了学习过程中遇到的问题和解决办法及上位机代码分享

这里主要专注于学习交流和经验分享.
纯私人站,当笔记本用的,学到哪写到哪.
如果侵权,联系 Popdes@126.com

友情链接
Aardio官方
Aardio资源网


才仁机械


网站地图SiteMap

Loading...