Vlc.DotNet.Forms.VlcControl cc = new Vlc.DotNet.Forms.VlcControl(); cc.Width = 500; cc.Height = 400; cc.Top = 100; cc.Left = 100; Vlc.DotNet.Core.Medias.MediaBase media = new Vlc.DotNet.Core.Medias.LocationMedia("dshow:// "); media.AddOption(":dshow-size=1600*1200"); media.AddOption(":dshow-vdev=USB CAM2"); cc.Play(media); this.Controls.Add(cc); cc.BringToFront(); //cc.TakeSnapshot("D:\\111.jpg", 1600, 1200);//截图
注意
Vlc.DotNet.Core.Medias.MediaBase media = new Vlc.DotNet.Core.Medias.LocationMedia("dshow:// ");初始化MediaBase 时只需
"dshow:// "即可 选择哪个相机需要AddOption
,选择分辨率之类的参数也要AddOption 但不支持相机index,必须相机name,可以参考使用AForge.NET Framework打开摄像头 C#获取对应index的name
时间: 2024-10-18 01:46:11