Remote Live View using PTP/IP on Canon EOS Cameras
In the final post of the Exploring the PTP/IP Protocol
series, you will learn how to use Canon EOS cameras’ remote live view feature, including touch to focus.
Change Live View Output Mode
To change the live view output mode, use a SetPropValue operation with property code 0xd1b0
.
For my use case, I set the output mode to cameraAndHost
so the camera’s screen remains functional while the CineRemote app is connected.
Poll Live View Image
When the camera is in host
or cameraAndHost
live view mode, you can poll a preview image using the GetLiveViewImage
(0x9153) operation.
GetLiveViewImage Operation
The GetLiveViewImage
request takes three arguments whose meanings I am unaware of, but the values (0x00200000
, 0x0
, 0x0
) captured from a packet sent by the EOS Utility do the trick.
Like the GetEvent data operation discussed in a previous post, the camera responds with a StartDataPacket
indicating the data size and an EndDataPacket
containing a live view image.
Extracting the Live View Payload
The response payload comprises multiple segments containing the image bytes and additional data. Like the GetEventData
response, a payload segment starts with length and ID, followed by its content.
The image segment from the Canon EOS 70D is about 160 kb in size and represents a jpeg-encoded image with a resolution of 960x540px. In the CineRemote app, I use an interval of 200ms to poll the live view image, which results in a choppy 5fps preview.
Touch Autofocus
When using a Canon EOS camera in live view mode, it supports touch to focus. After touching the screen, the camera tracks the subject and attempts to keep it in focus. While active, the display shows a rectangle around the tracked target. Additionally, the camera provides the tracking data within the live view payload.
Parse Touch Autofocus Segment
The TouchAutofocus segment contains a status field and the tracking area.
The status field describes the tracking mode, e. g. 0x30
for tracking or 0x20
for face tracking.
The tracking area is described by its top left corner coordinates, width, and height. The X and Y coordinates range between zero and the sensor width or height, respectively. Width and height are also represented as a length in pixels since the tracking rectangle can vary in size.
Set Touch Autofocus
Using a 0x915b
operation (SetTouchAfPosition), you can alter the position of the touch autofocus rectangle.
As parameters, the operation takes a constant of unknown meaning (0x03
) and the center of the new tracking point as X and Y coordinates. The bounds of the tracking point coordinates are between zero and the sensor width or height, respectively.
With the information of the current and previous posts at your disposal, you should be able to wirelessly remote control a Canon EOS camera using PTP/IP.
Unless I stumble on another interesting operation, this has been the last post of the series. Next, I want to integrate support for Canon EOS R cameras into the CineRemote app. Luckily, these cameras support Canon’s modern and well-documented wireless API CCAPI.