Skip to main content

External SDK / API

Middle Control exposes a TCP API that lets any external device or software send commands to Middle Control — and read back live camera and gimbal data.

This is useful if you want to:

  • Trigger presets, start/stop recording, or control a gimbal from a custom device or script
  • Integrate Middle Control into a broadcast automation workflow
  • Build a custom control panel (hardware or software) that talks directly to Middle Control
note

There is no SDK that communicates directly with APC-R units. All commands go through the Middle Control app running on your computer.

How it works

Your device or software sends plain-text TCP commands to the computer running Middle Control. Each command is a short string (e.g. CAM3, PRESET1, P500) terminated by a newline character.

TCP connection details

Host : IP address of the computer running Middle Control (use 127.0.0.1 if your software runs on the same machine)

Port : 11581

End character : \n (LF or CRLF)

Complete list of TCP commands

General actions

Select which camera/gimbal Middle Control should target. By default, the commands below apply to the currently selected camera ID.

CAM1 : Select camera/gimbal number 1
CAM2 : Select camera/gimbal number 2
CAM3 : Select camera/gimbal number 3
…. all the way up to CAM99


Gimbal actions (variable axis)

These actions will be applied to the currently selected camera ID.

Pxx : Pan speed command, xx between -2048 and +2048 (INT16)
Txx : Tilt speed command, xx between -2048 and +2048 (INT16)
Rxx : Roll speed command, xx between -2048 and +2048 (INT16)
Zxx : Zoom command, xx between -2048 and +2048 (INT16)

ZSxx : Zoom speed command, xx between 1 and 100 (INT8)
PTSxx : Pan/Tilt speed command, xx between 1 and 100 (INT8)

aFxx : Focus command, xx between 0.0 and 1.0 (FLOAT)
aIxx : Iris command, xx between 1.5 and 9 (FLOAT)
aWBxx : White Balance command, xx between 2500 and 10000 (INT16)
aTINTxx : Tint command, xx between -50 and +50 (INT8)
aISOxx : ISO command, xx between -12 and +36 (INT8)


Gimbal actions (absolute positions)

Send the gimbal to a precise position in a single command. These actions apply to the currently selected camera ID.

Use this frame format:

aGLOB;aPxx;aTxx;aRxx;aZxx;ss
PartDescription
aGLOBMust be at the start of the frame
aPxxAbsolute Pan position, in 1/10th of a degree (INT16)
aTxxAbsolute Tilt position, in 1/10th of a degree (INT16)
aRxxAbsolute Roll position, in 1/10th of a degree (INT16)
aZxxAbsolute Zoom position, between 0 and 4096 (INT16)
ssTransition duration in seconds

Example: move to Pan 20°, Roll 2°, Tilt 7.5°, Zoom mid-range, over 5 seconds:

aGLOB;aP200;aR20;aT75;aZ2500;5

Gimbal actions (for buttons)

These commands work like button presses and apply to the currently selected camera ID.

PAN_L : Pan the gimbal left
PAN_R : Pan the gimbal right
TILT_U : Tilt the gimbal up
TILT_D : Tilt the gimbal down
ROLL_L : Roll the gimbal left
ROLL_R : Roll the gimbal right

Stop commands required

After each movement command above, you must send the matching stop command after a delay of at least 70ms:

MovementStop command
PAN_L / PAN_RPAN_IDLE
TILT_U / TILT_DTILT_IDLE
ROLL_L / ROLL_RROLL_IDLE

ZOOM+ : Zoom in by a step
ZOOM- : Zoom out by a step
SPEED+ : Increase the pan/tilt speed
SPEED- : Decrease the pan/tilt speed
ZSPEED+ : Increase the zoom speed
ZSPEED- : Decrease the zoom speed
GIMBALAUTOCALIB : Start Gimbal Autocalibration (Autotune)
MOTORAUTOCALIB : Start Focus Motor Autocalibration
GIMBALSLEEP : Sleep Gimbal
GIMBALWAKE : Wake Gimbal
ACTIVETRACK : Active Track Enable / Disable
RECENTER : Recenter the gimbal


Camera actions

These actions will be applied to the currently selected camera ID. Works with Blackmagic cameras controlled by the ATEM or paired to the APC-R via Bluetooth, and Sony cameras.

AUTOFOCUS : Triggers autofocus
AUTOIRIS : Triggers auto iris
COLORBARS : Show Color Bars
ZEBRA : Show Zebra Guide
FALSECOLORS : Show False Color Guide
STATUSVIEW : Show the status view on the HDMI out of the camera
DIGITAL_ZOOM : Toggle Digital Zoom (Sony)

Custom button triggers (Sony): CUSTOM_C1 : Trigger Custom C1 function
CUSTOM_C2 : Trigger Custom C2 function
CUSTOM_C3 : Trigger Custom C3 function
CUSTOM_C4 : Trigger Custom C4 function
CUSTOM_C5 : Trigger Custom C5 function
CUSTOM_C6 : Trigger Custom C6 function

Camera menu navigation (Sony): BTN_MENU : Press Menu Button
BTN_OK : Press OK Button
BTN_LEFT : Press Left Button
BTN_RIGHT : Press Right Button
BTN_DOWN : Press Down Button
BTN_UP : Press Up Button
MULTISEL_LEFT : Press Left MultiSelector
MULTISEL_RIGHT : Press Right MultiSelector
MULTISEL_DOWN : Press Down MultiSelector
MULTISEL_UP : Press Up MultiSelector

FOCUS+ : Focus in by a step
FOCUS- : Focus out by a step
IRIS+ : Iris increase
IRIS- : Iris decrease
WB+ : White balance increase
WB- : White balance decrease
ISO+ : ISO Increase
ISO- : ISO Decrease
TINT+ : Tint increase
TINT- : Tint decrease
SHUTTER+ : Shutter Increase
SHUTTER- : Shutter Decrease
ND+ : ND Filter Increase
ND- : ND Filter Decrease

REC_START : Start recording (currently selected camera)
REC_STOP : Stop recording (currently selected camera)
REC_START_ALL : Start recording on all cameras
REC_STOP_ALL : Stop recording on all cameras


Preset actions

Trigger a preset on the currently selected camera ID:

PRESET1 : Trigger preset 1 of the currently selected camera ID
PRESET2 : Trigger preset 2 of the currently selected camera ID
PRESET3 : Trigger preset 3 of the currently selected camera ID … all the way up to PRESET12

Trigger or save a preset on a specific camera ID (regardless of which camera is currently selected):

PRESET1C5 : Trigger preset 1 of Camera ID 5 (preset 5.1 in Middle Control)
PRESET2C5 : Trigger preset 2 of Camera ID 5 (preset 5.2 in Middle Control) … all the way up to PRESET12C5

SPRESET1C5 : Save preset 1 of Camera ID 5 (preset 5.1 in Middle Control)
SPRESET2C5 : Save preset 2 of Camera ID 5 (preset 5.2 in Middle Control) … all the way up to SPRESET12C5


Targeting a specific camera ID

By default, all commands apply to the currently selected camera ID in Middle Control. To send a command to a specific camera ID regardless of what is currently selected, append @Cx at the end of the command, where x is the camera ID number.

This also allows you to send actions to multiple cameras simultaneously by sending several targeted commands in quick succession.

Examples:

REC_START@C2 : Start recording on Camera ID 2
AUTOFOCUS@C5 : Trigger autofocus on Camera ID 5
P500@C1 : Send Pan command to Camera ID 1

tip

You can combine multiple targeted commands to control several cameras at once — for example, send REC_START@C1, REC_START@C2 and REC_START@C3 in rapid succession to start recording on cameras 1, 2, and 3 simultaneously.


Read camera & gimbal state

Middle Control sends back a live status frame over the same TCP connection. This lets you read the current state of the gimbal and camera — useful for building feedback displays or reactive workflows.

note

Feedback is available when Middle Control is connected to an ATEM Switcher or to a camera over Wired LAN.

TCP Reply / Feedback Frame — format
{CAM`SELECTEDCAMID`;PTS`SELECTEDPANTILTSPEED`;ZS`SELECTEDZOOMSPEED`;PRESD`SELECTEDPRESETTRANSITIONDURATION`;aWB`WHITEBALANCE`;aF`FOCUS`;aI`IRIS`;aUI`IRISFN`;aTINT`TINT`;aISO`ISO`;aSAT`SATURATION`;aCONT`CONTRAST`;aBLACKLEV`BLACKLEVEL`;aMIDLEV`MIDLEVEL`;aWHITELEV`WHITELEVEL`;aSHUT`SHUTTER`;aPAN`PAN_ANGLE`;aTILT`TILT_ANGLE`;aROLL`ROLL_ANGLE`;aZOOM`ZOOMOTORPOSITION`;}
TCP Reply / Feedback Frame — example
{CAM5;PTS85;ZS24;PRESD3;aWB5600;aF0.45;aI6.5;aUI5.4;aTINT10;aISO800;aSAT50;aCONT50;aBLACKLEV0.4;aMIDLEV0.3;aWHITELEV0.4;aSHUT1/50;aPAN523;aTILT124;aROLL890;aZOOM3992;}

In this example: Camera ID 5 is selected, Pan/Tilt speed is 85, White Balance is 5600K, Focus is at 45%, Iris is f/6.5, ISO 800, Tint +10, Shutter 1/50, Pan angle 52.3°, Tilt 12.4°, Roll 89.0°.