Jump to content
pboom

VISCA SONY Camera Control

Recommended Posts

Posted (edited)

Attached is a full Controller for SONY Cameras using the VISCA protocol, written in AutoIt. Everything required to build a EXE file is included.

I wrote this software because I couldn't find decent control software for these cameras, I tried at least a dozen packages. So in my mind, anyway, it is better than anything else out there.

The software will also controls several other pieces of AV equipment. The software is very specific to my application but should be easy to adapt and would make a good starting point for someone else trying to roll there own Audio Video control program.

It features the following;

  • Unlimited number of presets
  • Macros to combine recall of presets
  • Supports JoyStick control
  • Supports up to 7 cameras in Daisy chain configuration.
  • Unique Pan Tilt control pad provides variable speed control by dragging Mouse on pad, makes the cameras easy to control.
  • Web Server allows Macros to be activated from OBS Studio
  • Modular structure should make the code adaptable to other camera control protocols.
  • Modular structure should make additional hardware support easy to add or remove.
  • Will show errors during start up if hardware is not present but it will run.
  • Serial ports configured with included INI file.
  • Joystick response can be adjusted through settings in the INI file.
  • Lots of documentation on how things are setup the various source modules.

Lots more documentation available wiring instructions, protocol documents for hardware etc. but that would exceed file upload size. PM me if you are interested.

And thanks to everyone on this forum that provided the many libraries and bits of software used to make this project work. I couldn't have done it without the many contributors to this forum. I did my best to give the appropriate credit in each module.

 

GeorgeController.zip Operation Instructions.pdf

SampleScreen.jpg

Edited by pboom
Added Sample Screen of Application

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By DrAhmed
      Hey everyone,
      I am looking for a simple function to take a single snapshot from webcam and save  it as a picture
      I've searched in google and most of UDF's I foud were outdated and not working, others are very complicated to use .
      It would be cool if it can control the quality of saved picture like in screenshots
      _ScreenCapture_SetJPGQuality($Quality) I would appreciate it If someone can help
      thanks in advance
    • By FireFox
      I recently bought an IP Camera to monitor my house. There is a web access to view the video stream but not to record it.

      Here is the IP Camera in question, it should work with every other similar product.

      So I made a simple example which does the job.

      Here is the code :
      #include <GUIConstants.au3> #include <WindowsConstants.au3> #include <StaticConstants.au3> #include <WinAPI.au3> #include <GDIPlus.au3> #include <Memory.au3> #region Global Vars Global Const $sProgramTitle = "IP Camera stream + record" ;EDIT THE FOLLOWING LINE ONLY: Global Const $iIPAddress = "192.168.1.99", $iPort = 99, $shtauth = "yourauth==" Global Const $STM_SETIMAGE = 0x0172 Global $blRecording = False, $blGUIMinimized = False Global Const $sRecordDir = @ScriptDir & "\ip_camera_stream" Global $bRecvtmp = Binary(""), $bStream = $bRecvtmp Global $iImgLen = 0, $iStreamLen = 0, $iWritten = 0, $iEOH = 0, $iContLenPos = 0, $hImgFile = 0, $pBuffer = 0, $iImgCount = 0 Global Const $iContLengthLen = StringLen("Content-Length: ") Global $sStream = "", $sTrim2ContLen = "" Global $hBMP = 0, $hGraphics = 0, $hHBITMAP2 = 0, $hFamily = 0, $hFont = 0, $tLayout = "", $hFormat = 0, $hBrush = 0 #endregion Global Vars TCPStartup() Global $iSocket = TCPConnect($iIPAddress, $iPort) If @error Then MsgBox(16, $sProgramTitle, "Could not connect !") Exit -1 EndIf TCPSend($iSocket, _ "GET /videostream.cgi HTTP/1.1" & @CRLF & _ "Host: " & $iIPAddress & ":" & $iPort & @CRLF & _ "Connection: keep-alive" & @CRLF & _ "Authorization: Basic " & $shtauth & @CRLF & @CRLF) #region GUI Global $hGUI = 0, $pPic = 0, $hPic = 0, $btnRecord = 0 $hGUI = GUICreate($sProgramTitle, 640, 525) $pPic = GUICtrlCreatePic("", 0, 0, 640, 480, $SS_BITMAP) GUICtrlSetState($pPic, $GUI_DISABLE) $hPic = GUICtrlGetHandle($pPic) $btnRecord = GUICtrlCreateButton("Record", 10, 490, 80, 26) GUIRegisterMsg($WM_SYSCOMMAND, "WM_SYSCOMMAND") GUISetState(@SW_SHOW, $hGUI) #endregion GUI _GDIPlus_Startup() $hFamily = _GDIPlus_FontFamilyCreate("Arial") $hFont = _GDIPlus_FontCreate($hFamily, 17) $tLayout = _GDIPlus_RectFCreate(10, 10, 100, 40) $hFormat = _GDIPlus_StringFormatCreate() $hBrush = _GDIPlus_BrushCreateSolid(0xAFFF0000) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $btnRecord If $blRecording Then GUICtrlSetData($btnRecord, "Record") Else If Not FileExists($sRecordDir) Then DirCreate($sRecordDir) GUICtrlSetData($btnRecord, "Stop recording") EndIf $blRecording = Not $blRecording EndSwitch $bRecvtmp = TCPRecv($iSocket, 4096, 1) ;4kb If @error Then ExitLoop If Not BinaryLen($bRecvtmp) Then ContinueLoop $bStream &= $bRecvtmp If $iImgLen = 0 Then $sStream = BinaryToString($bStream) $iContLenPos = StringInStr($sStream, "Content-Length: ", 2) $iEOH = StringInStr($sStream, @CRLF & @CRLF, 2, 1, $iContLenPos) If $iEOH = 0 Or $iContLenPos = 0 Then ContinueLoop $sTrim2ContLen = StringTrimLeft($sStream, $iContLenPos + $iContLengthLen - 1) $iImgLen = Number(StringLeft($sTrim2ContLen, StringInStr($sTrim2ContLen, @CR, 2) - 1)) $bStream = BinaryMid($bStream, $iEOH + 4) EndIf If $iImgLen = 0 Then ContinueLoop $iStreamLen = BinaryLen($bStream) If $iStreamLen < $iImgLen Then ContinueLoop If Not $blGUIMinimized Then $hBMP = Load_BMP_From_Mem($bStream) If $blRecording Then $hGraphics = _GDIPlus_ImageGetGraphicsContext($hBMP) _GDIPlus_GraphicsDrawStringEx($hGraphics, "[•REC]", $hFont, $tLayout, $hFormat, $hBrush) EndIf $hHBITMAP2 = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBMP) _WinAPI_DeleteObject(_SendMessage($hPic, $STM_SETIMAGE, 0, $hHBITMAP2)) _GDIPlus_ImageDispose($hBMP) If $blRecording Then _GDIPlus_GraphicsDispose($hGraphics) _WinAPI_DeleteObject($hHBITMAP2) EndIf If $blRecording Then $pBuffer = DllStructCreate("byte[" & $iImgLen & "]") If $iStreamLen > $iImgLen Then DllStructSetData($pBuffer, 1, BinaryMid($bStream, 1, $iImgLen)) $bStream = BinaryMid($bStream, $iImgLen) Else DllStructSetData($pBuffer, 1, $bStream) $bStream = Binary("") EndIf $hImgFile = _WinAPI_CreateFile($sRecordDir & "\snap_" & StringFormat("%.4d", $iImgCount) & ".jpg", 3, 4, 4) _WinAPI_WriteFile($hImgFile, DllStructGetPtr($pBuffer), $iImgLen, $iWritten) _WinAPI_CloseHandle($hImgFile) $iImgCount += 1 EndIf $iImgLen = 0 WEnd _GDIPlus_FontDispose($hFont) _GDIPlus_FontFamilyDispose($hFamily) _GDIPlus_StringFormatDispose($hFormat) _GDIPlus_BrushDispose($hBrush) _GDIPlus_Shutdown() TCPCloseSocket($iSocket) TCPShutdown() Func WM_SYSCOMMAND($hWnd, $iMsg, $wParam, $lParam) Local Const $SC_MINIMIZE = 0xF020, $SC_RESTORE = 0xF120 Switch BitAND($wParam, 0xFFF0) Case $SC_MINIMIZE, $SC_RESTORE $blGUIMinimized = Not $blGUIMinimized EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_SYSCOMMAND Func Load_BMP_From_Mem($bImage) ;_GDIPlus_BitmapCreateFromMemory2     ;Author: UEZ     ;Modified: ProgAndy, Yashied, FireFox     If Not IsBinary($bImage) Then Return 0     Local $memBitmap = Binary($bImage)     Local $iLen = BinaryLen($memBitmap)     Local $GMEM_MOVEABLE = 0x0002     Local $aResult = DllCall("kernel32.dll", "handle", "GlobalAlloc", "uint", $GMEM_MOVEABLE, "ulong_ptr", $iLen)     Local $hData = $aResult[0]     $aResult = DllCall("kernel32.dll", "ptr", "GlobalLock", "handle", $hData)     If @error Then Return 0     Local $tMem = DllStructCreate("byte[" & $iLen & "]", $aResult[0])     DllStructSetData($tMem, 1, $memBitmap)     DllCall("kernel32.dll", "bool", "GlobalUnlock", "handle", $hData)     If @error Then Return 0     $aResult = DllCall("ole32.dll", "int", "CreateStreamOnHGlobal", "handle", $hData, "int", True, "ptr*", 0)     $hStream = $aResult[3]     If @error Then Return 0     $aResult = DllCall($ghGDIPDll, "uint", "GdipCreateBitmapFromStream", "ptr", $hStream, "int*", 0)     If @error Then Return 0     DllCall('oleaut32.dll', 'long', 'DispCallFunc', 'ptr', $hStream, 'ulong_ptr', 8 * (1 + @AutoItX64), 'uint', 4, 'ushort', 23, 'uint', 0, 'ptr', 0, 'ptr', 0, 'str', '')     Return $aResult[2] EndFunc   ;==>Load_BMP_From_Mem _
      Advanced example :
      Preview :



      Attachment :
      IP Camera.au3
      IP Camera.au3 (Previous: 34 downloads)
       
      Enjoy, I'm watching U !
×
×
  • Create New...