The USB API is very popular with RICOH THETA cameras for use cases such as time lapse or high volume pictures with a device such as a Raspberry Pi. Although most people use the USB API from Linux, it is also possible to use it from the MacOS.
The main reason people use the USB API on Linux is due to the lower cost of hardware such as the Raspberry Pi or Jetson Nano. If you are comfortable using Linux, you may find more community support and examples for using the RICOH THETA USB API on Linux.
This article covers two different free and open source applications that run on MacOS that can configure the USB API of RICOH THETA cameras.
You can easily install gphoto2 on a Mac with
brew install gphoto2
If you do not have brew installed on your Mac, see this site:
If you run gphoto2 with no command, you can see the options.
On your Mac use gphoto2 --summary
gphoto2 --list-files
craig@craigs-air ~ % gphoto2 --capture-image
New file is in location /store_00020001/DCIM/101RICOH/R0020127.JPG on the camera
craig@craigs-air ~ %
This will delete the file from the RICOH THETA camera after downloading to your Mac.
gphoto2 --capture-image-and-download
New file is in location /store_00020001/DCIM/101RICOH/R0020128.JPG on the camera
Saving file as R0020128.JPG
Deleting file /store_00020001/DCIM/101RICOH/R0020128.JPG on the camera
craig@craigs-air Documents %
Verify download with RICOH THETA desktop application for Mac.
gphoto2 --get-config=batterylevel
Label: Battery Level
Readonly: 1
Type: TEXT
Current: 100%
END
craig@craigs-air Documents %
% gphoto2 --get-config=whitebalance
Label: WhiteBalance
Readonly: 0
Type: RADIO
Current: Automatic
Choice: 0 Automatic
gphoto2 --get-config=capturemode
Label: Still Capture Mode
Readonly: 0
Type: RADIO
Current: Unknown value 8002
Choice: 0 Single Shot
Choice: 1 Timelapse
gphoto2 --show-info 1
Information on file 'R0020117.JPG' (folder '/store_00020001/DCIM/101RICOH'):
File:
Mime type: 'image/jpeg'
Size: 8076696 byte(s)
Width: 6720 pixel(s)
Height: 3360 pixel(s)
Permissions: read/delete
Time: Tue Apr 26 09:09:08 2022
Thumbnail:
Mime type: 'image/jpeg'
Size: 10724 byte(s)
Width: 320 pixel(s)
Height: 160 pixel(s)
Audio data:
None available.
% gphoto2 --set-config=/main/other/d80e=1
gphoto2 --set-config=/main/other/d80e=0
gphoto2 –set-config=500e=1
With Exposure Program set to Manual.
gphoto2 --get-config /main/imgsettings/iso
Label: ISO Speed
Readonly: 0
Type: RADIO
Current: 100
Choice: 0 80
Choice: 1 100
Choice: 2 125
Choice: 3 160
Choice: 4 200
Choice: 5 250
Choice: 6 320
Choice: 7 400
Choice: 8 500
Choice: 9 640
Choice: 10 800
Choice: 11 1000
Choice: 12 1250
Choice: 13 1600
Choice: 14 2000
Choice: 15 2500
Choice: 16 3200
gphoto2 --get-config=5013
Label: Still Capture Mode
Readonly: 0
Type: MENU
Current: 32772
Choice: 0 1
Choice: 1 3
Choice: 2 32770
Choice: 3 32771
Choice: 4 32772
Choice: 5 32773
Choice: 6 32774
Choice: 7 32775
END
craig@craigs-air Documents % gphoto2 --set-config=5013=2
libptp2 is an alternative to gphoto2 and more popular on Linux for accessing the RICOH THETA USB API.
You can install libptp2 v1.1.10 using MacPorts.
https://ports.macports.org/port/libptp2/
Information on installing MacPorts is available here:
https://www.macports.org/install.php
I’m using Monterey.
ptpcam --set-property=0xD801 --val="23.532000,23.532000+999.00m@20210904T170429.0+0900,WGS84"
Camera: RICOH THETA Z1
'UNKNOWN' is set to: "23.532000,23.532000+999.00m@20210904T080429,WGS84"
Changing property value to 23.532000,23.532000+999.00m@20210904T170429.0+0900,WGS84 [(null)] succeeded.
craig@craigs-air tmp %
ptpcam --show-property=0xd801
Camera: RICOH THETA Z1
'UNKNOWN' is set to: "23.532000,23.532000+999.00m@20210904T080429,WGS84"
craig@craigs-air tmp %
craig@craigs-air tmp % ptpcam --set-property=0x501A --val=10
Camera: RICOH THETA Z1
'Timelapse Number' is set to: 0
Changing property value to 10 [(null)] succeeded.
craig@craigs-air tmp %
https://api.ricoh/docs/theta-usb-api/
I tested running USB API commands from my Mac laptop to control my THETA Z1 following the steps @craig laid out in this blog post.
I’m assuming that most developers would want to use the THETA USB API from Linux on a Jetson or Raspberry Pi. But to test the USB API easily, running it on my MacBook Air is handy.
brew install gphoto2
Updating Homebrew...
Probably 5 minutes. It was successfully installed. Here’s part of the output confirming that it was installed:My Z1 was connected to my MacBook Air with a USB-C to USB-C cable.
gphoto2 --summary
[truncated]
Summary: Installing Homebrew on the Mac in order to install ggphoto2 was straightforward. It’s great to be able to attach my Z1 directly to my MacBook Air and test the USB API. I have not installed the alternative to gphoto2, libptp2, yet.
Nice! Great that you got it working on the MacBook Air. Congratulations!
Once you get libptp installed, you can try
ptpcam
to set individual properties. I’m actually not sure how to do this gphoto2.OK, I followed through the second half of the blog post for using ptplib2 on a Mac.
I download MacPorts and ran ptplib2 on my MacBook Air. I’d say it’s as easy as ggphoto2, though the important difference is being able to set GPS with libptp2.
I also had one small problem, not really anything to do with libptp2. After installing libptp2, I had to set the path correctly to run the port command. Not a big deal.
I’m running Big Sur
Downloaded the package for MacPorts, installed successfully
It looked good, but then I tried to run
sudo port install libptp2
Got command not found.
Just need to set the path. Did
sudo vi /etc/paths
and added /opt/local/bin and /opt/local/sbinRestarted terminal, it works!
Checked camera information
Listing files
Checked to see if there was GPS info set, tested setting the GPS info, checked to see that it was set
Summary: No real problems installing libptp2 and controlling my Z1 over a USB cable. Very easy to test the USB API on my MacBook Air.
Congratulations! Nice job.
if you do
can you show the output?
Didn’t macports add in the proper path?
you can run it after installing macports with
source .zprofile
version of libptp2
Unfortunately, MacPorts seems to have installed an older version of libptp2, v 1.1.10.
The most recent version is 1.2.0
There may be some issues running the raw ptp commands to start/stop video. However, the settings should work.
Currently, the main limitation on the Mac would be starting and stopping the video.
This is how it works on a Jetson nano, but I couldn’t get the video start and stop to work on the Mac.