Page 1 of 1

Einbindung Webcam Stream in GUI

Posted: 30 Nov 2022, 06:54
by Ahk_fan
Hallo,

basierend auf viewtopic.php?f=76&t=58510 habe ich noch bischen was erweitert, dazu muss VLC installiert werden inkl des Plugins.

Code: Select all

CamName := "HD Capture Cam"
vlc1        =C:\Program Files\VideoLAN\VLC\vlc.exe
tempSnap	:=  "99_temp\snapshot"
Gui,2:default
Gui,2: Color, Black
Gui,2:Color,ControlColor, Black
xxb=VideoLAN.VLCPlugin.2 
Gui,2:Add,ActiveX, x5 y50 w1600 h900 vVlcx,%xxb%
F3:= "dshow://" 
F5 := " :dshow-vdev=" CamName  " :dshow-adev= :dshow-size=1920x1080 :dshow-aspect-ratio=16\:9 :dshow-chroma= :dshow-fps=0 :no-dshow-config :no-dshow-tuner :dshow-tuner-channel=0 :dshow-tuner-frequency=0 :dshow-tuner-country=0 :dshow-tuner-standard=0 :dshow-tuner-input=0 :dshow-video-input=-1 :dshow-video-output=-1 :dshow-audio-input=-1 :dshow-audio-output=-1 :dshow-amtuner-mode=1 :dshow-audio-channels=0 :dshow-audio-samplerate=0 :dshow-audio-bitspersample=0 :live-caching=100 "
  ifexist,%vlc1%
    {
    vlcx.playlist.stop()
    vlcx.playlist.items.clear()
    vlcx.playlist.add(F3,"",F5)
    vlcx.playlist.play()
    }
Gui,2: Add, Button, x10 y10 gSnap, Snapshot
Gui,2: Show , x0  y0
return

Snap:
	setworkingdir,%tempSnap%
	ttt := vlcx.video.takeSnapshot()
	setworkingdir,%a_scriptdir%
return

2Guiclose:
xx=vlc.exe
process,exist,%xx%
pid:=errorlevel
if pid<>0
  Process,close,%Pid%
 Gui, 2: Destroy
 return