Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate

Code To Capture From WebCam?


  • Please log in to reply
16 replies to this topic
  • Guests
  • Last active:
  • Joined: --
If its not too much to ask, I would like a script to capture webcam and save it to a file, upon clicking of a GUI button.

Ex
#Persistent
Gui, Add, Edit, w250 vSaveDir, %A_Desktop%\Capture(%A_Now%).jpg
Gui, Add, Button, w150 gCapture, Capture WebCam
Gui, Show
return

GuiClose:
ExitApp
return

Capture:
Gui, Submit, Nohide
IfExist, %SaveDir%
{
	; CAPTURE FROM WEB CAM ;
	; (Save To %SaveDir%)
}
return


  • Guests
  • Last active:
  • Joined: --
i don't know about the script but there is a program called windows media encoder, it is also for free

try it!

  • Guests
  • Last active:
  • Joined: --
Thanks :D

*System Monitor*
  • Guests
  • Last active:
  • Joined: --
No problem! :? :) :D :O :lol: :wink: :idea: :roll: :p :shock:

  • Guests
  • Last active:
  • Joined: --
That Thanks Post Wasnt Mine.. And Also. I need it to be an autohotkey script.. Are you sure theres no code?

*System*Monitor*
  • Guests
  • Last active:
  • Joined: --
sorry i don't know code for it

  • Guests
  • Last active:
  • Joined: --

sorry i don't know code for it

:( Does no one?

BoBo
  • Guests
  • Last active:
  • Joined: --
In the utilities section there's a tool to do that. Check it. 8)

  • Guests
  • Last active:
  • Joined: --
Sorry.. where??? Can you point me to a link??? What I need is a .exe that can be used with command parmaters.

BraindeadBoBo
  • Guests
  • Last active:
  • Joined: --
Well, you're not able to use a nick (regardless that you don't have to register for it), and I'm not able to recall where I saw that tool ... :shock:

BoBo
  • Guests
  • Last active:
  • Joined: --

Can you point me to a link???

Pahhh, I'm in a good mood, so here we go ... http://www.autohotke...orum/search.php

  • Guests
  • Last active:
  • Joined: --
I tried searching before posting this topic, i simply dont know which i should use. Some of the links are broken, and others dont have command lines.

BoBo
  • Guests
  • Last active:
  • Joined: --
I've searched it, and found it. And if you'd invest some time to read you'd see/find it as well. Have you checked the Utilities Section?

  • Guests
  • Last active:
  • Joined: --
Yeah i've looked but can't find a .exe with command line capture to file.

Video2Thumb - Wont save to file. Cross that.

Cambert - Doesnt suit my needs, but in the topic i found some more programs

Joecap - Link is broken, though it sounds perfect and simple :(

WCapture - No command line, but can capture to file

WebCam2000 - Not what im looking for, wont save to file. (Doesnt have command lies, either)

Dorgem - No command line for capturing screen, though it does have command lines for starting minimized

VFWGrab - Too many file requirements, several files (40+) + No command line

Heres some code found while browsing "WebCam" search results
Gui, Add, ListView, vCapDriversLV, Index|Name


;Gui, Add, Picture, w320 h240 HWNDhwndParent, C:\WINDOWS\winnt.bmp


Gui +LastFound
hwndParent := WinExist()
Gui, Show, w500 h400

msgbox Scanning available Webcam drivers...

Loop
{
  thisInfo := Cap_GetDriverDescription(A_Index-1)
  If thisInfo
    LV_Add("", A_Index-1, thisInfo)
  Else
    Break
}

msgbox Create capture window... (this crashes)

capHwnd := Cap_CreateCaptureWindow(hwndParent, 0, 0, 320, 240)

msgbox % capHwnd

Return

/*
'// The two functions exported by AVICap
Declare Function capCreateCaptureWindowA Lib "avicap32.dll" ( _
    ByVal lpszWindowName As String, _
    ByVal dwStyle As Long, _
    ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Integer, _
    ByVal hWndParent As Long, ByVal nID As Long) As Long
   
Declare Function capGetDriverDescriptionA Lib "avicap32.dll" ( _
    ByVal wDriver As Integer, _
    ByVal lpszName As String, _
    ByVal cbName As Long, _
    ByVal lpszVer As String, _
    ByVal cbVer As Long) As Boolean
*/

Cap_CreateCaptureWindow(hWndParent, x, y, w, h)
{
  WS_CHILD := 0x40000000
  WS_VISIBLE := 0x10000000
 
  lpszWindowName := "test"
 
  lwndC := DLLCall("avicap32.dll\capCreateCaptureWindowA"
                  , "Str", lpszWindowName
                  , "UInt", WS_VISIBLE | WS_CHILD ; dwStyle
                  , "Int", x
                  , "Int", y
                  , "Int", w
                  , "Int", h
                  , "UInt", hWndParent
                  , "Int", 0)
 
  msgbox % lwndC " | " errorlevel " | " lpszWindowName " | " hwndParent
  Return lwndC
}

Cap_GetDriverDescription(wDriver)
{
  VarSetCapacity(lpszName, 100)
  VarSetCapacity(lpszVer, 100)
  res := DLLCall("avicap32.dll\capGetDriverDescriptionA"
                  , "Short", wDriver
                  , "Str", lpszName
                  , "Int", 100
                  , "Str", lpszVer
                  , "Int", 100)
  If res
    capInfo := lpszName ; " | " lpszVer
  Return capInfo
}

!r::Reload

GuiClose:

ExitApp
Return

Heres also some HTML code I found
<html>

   <SCRIPT LANGUAGE="JavaScript">
      function Init() {
             cvcs.RemoteHost = "cameras ip address"
             cvcs.RemoteWeb = 80
             cvcs.RemotePort = 8481
             cvcs.Timeout = 5
             cvcs.AuthType = 1
             cvcs.PreviewFrameRate = 1
             cvcs.PreviewWidth = 320
             cvcs.PreviewHeight = 240
             cvcs.DeviceSerialNo = ""
             window.setInterval("ShowFrameRate()", 1000)
         }

   function ShowFrameRate() {
          if (1)
             {
                var fFrameRate = cvcs.FrameRate
                window.status = "Frame:" + fFrameRate.toString() + " fps"
             }
          cvcs.Play()
          cvcs.GetRealTimeData()
          CurrentTime.innerHTML = cvcs.TimeString
      }
   </SCRIPT>

   <BODY text=#000080 onload="Init()" onunload="cvcs.Stop()">

           <OBJECT ID="cvcs" WIDTH=320 HEIGHT=240
            CLASSID="CLSID:31150A86-0BBA-409f-BEB4-F3922D10BF34"
            CODEBASE="xplug.ocx#version=2,0,0,0" data="DATA:application/x-oleobject;BASE64,hgoVMboLn0C+tPOSLRC/NA==
">
           </OBJECT>
           
           <p> </p>

   
</html>

However, in all the webcam help topics I've found using the search tool, none of them have been solved :(

ralphh85
  • Members
  • 197 posts
  • Last active: Oct 30 2009 09:10 AM
  • Joined: 31 Jan 2006
i am trying to do this to.

but i want to capture the last few hours of driving. as i have a mini pc in my car and am putting as webcam in looking forward to.

you could do what your tryign to do with VirtualDub, its easy to fire the program up and then start it recording using key strokes.

alt F then p set it in to Capture mode.

then F5 starts capture and Esc stops capture.

hope this helps, if not when you sucsed i will be interested to know how!


Ralph