Bloodevil / sony_camera_api

sony camera remote api
http://developer.sony.com/develop/cameras/
MIT License
244 stars 60 forks source link

Add/Confirm support for RX0 #40

Open mungewell opened 6 years ago

mungewell commented 6 years ago

Kind of a wish list item, I don't know for certain that the RX0 actually supports the Sony Remote API (as the API pages have note been updated).

However the Android 'Playmemories' app has:

6.1.0

  • Supports RX0.
  • By connecting RX0 to a smartphone via Wi-Fi and using the app, you can now remotely check up to 5 view angles at the same time from Live View, and also take photos or apply settings at once.

The spec page for the camera talks about some pretty nice features (shame the camera can only record video as 1080P). http://www.sony.ca/en/electronics/cyber-shot-compact-cameras/dsc-rx0/specifications#features

mungewell commented 6 years ago

Well I found the manual for the camera: https://www.sony.co.uk/electronics/support/res/manuals/4690/46902871M.pdf

Single camera connection looks pretty much the same as normal.

The multi-camera functionality is NOT the same as used on other cameras; rx0_multi_camera

However it later goes on to describe how the "group owner" uses "WPS Push" to connect to the other cameras. Is the "Group Owner" behaving as it was a LiveView-Remote, and relaying it's start/stop commands?

mungewell commented 6 years ago

Looks like the latest version of PlayMemories (v6.1.0) has a load of undocumented functions included it it. I wonder whether these are specific to Rx0. I added them (getSupported...() and getAvailable...() methods) here: https://github.com/mungewell/sony_camera_api/tree/undoc_functions

mungewell commented 6 years ago

Although my Korean language skills are non-existent, this video is interesting (and should prove no difficulties for Bloodevil ;-) : https://www.youtube.com/watch?v=zwrgCdYgogg

Most interesting is the 'power off' action at the end of the clip.

mungewell commented 6 years ago

More information on how the 'Group Owner; RX0 behaves wrt playmemories and 'Client' cameras: https://support.d-imaging.sony.co.jp/www/disoft/int/playmemories-mobile/en/multi/dsc-rx0.html

Bloodevil commented 6 years ago

i'll take a look at it later. thanks. 👍 How did you find that video lol

mungewell commented 6 years ago

Visited my local camera store (*) and was able to try out a RX-0. Good news, "pygameLiveview" demo worked out of the box! Was able to show the sales guys a working liveview screen on laptop.

Didn't get too much time to play before it's battery died on me. "Dump_camera_capabilities" attached, it seems that there are a few new commands

getNearModeInPF
setNearModeInPF
getAvailableNearModeInPF
getSupportedNearModeInPF
getTemporarilyUnavailableApiList

Looks like we've got a little adjustment to do... rx0_first_try.txt

PederBennedsen commented 6 years ago

I have a customer that is very interested in using the RX0 for a large project. Are there any signs that it will be possible to control the RX0 directly via USB?

mungewell commented 6 years ago

The 'Sony Remote API' (which we use) is WiFi only,

The question of USB remote is camera specific, there was mention on "DIY-Drones" forum that Sony had developed a USB remote control capable sensor, this same technology may have be included with the RX0.

There is a YouTube clip showing the menu of the RX0, at this point it shows "PC Remote Settings" option which the clip does not elaborate on: https://youtu.be/xGux6jjCwo0?t=75

I suggest a trip to your local camera store ;-)

mungewell commented 6 years ago

https://support.d-imaging.sony.co.jp/imsoft/Win/rcc/us.html

Applicable products

Refer to here for details. DSC-RX0, DSC-RX1RM2(1,2), DSC-RX10M2(2), DSC-RX10M3(2), DSC-RX10M4(2), DSC-RX100M4, DSC-RX100M5 DSLR-A700 , DSLR-A850 , DSLR-A900 ILCA-68, ILCA-77M2, ILCA-99M2(1) ILCE-5000, ILCE-5100, ILCE-6000, ILCE-6300, ILCE-6500, ILCE-7, ILCE-7M2, ILCE-7R, ILCE-7RM2(1), ILCE-7S, ILCE-7SM2(1), ILCE-9(1 3) SLT-A58 , SLT-A99/A99V

PederBennedsen commented 6 years ago

Sounds promising. I'll buy a camera and start experimenting...

mungewell commented 6 years ago

If you can try our little project on it we'd love to get bug reports/etc....

emg82 commented 5 years ago

Sounds promising. I'll buy a camera and start experimenting...

Hello Peder,

Almost one year later, did you manage to do something with the RX0 ? I wondering if the "old" API works or if you found a way to control it via micro USB.

Thanks a lot ;-)

jwoodrow commented 5 years ago

Hi guys, I have an RX0 but I am unable to run any of the examples with it.

At first I had it connected via USB using "PC Control" mode, but after looking around it seems you sony_camera_api needs wifi to work ? So anyway I configured the wifi and it still leaves me with a "No camera found" error.

I can provide pictures of the menu and try some things out to try and get it to work out.

I am trying to use this only for a live view in my code (hoping I could get a better fps than using gphoto2 which seems to give me something close to ~3fps on my macbook pro...) so then I could use the multiport connexion to charge the camera using a usb cable end and trigger it using a 3.5mm jack end (which would be connected to another piece of hardware that has been validated for use with a RX0).

If I can both help you validate functionality for the RX0 and get my project moving along it's a win-win for me.

Bloodevil commented 5 years ago

At first I had it connected via USB using "PC Control" mode, but after looking around it seems you sony_camera_api needs wifi to work ? So anyway I configured the wifi and it still leaves me with a "No camera found" error.

when you connect playmemories mobile, still have same message? cuse playMemories mobile use wifi only.

if you wanna high speed fps you need to check stream view data speed. you can check the send data size. (code have that data header and size) I need to improve the code that now we check that screen every n(0.1..?) seconds but I should change it if have enough data that can see picture then show- but need to test the data transfer speed.

I don't have RX0 so can't check detail tings. i'll ask and rent from my friend that have RX0.

jwoodrow commented 5 years ago

Tested out Playmemories Mobile by following their instructions (scanning the QRCode to pair the phone and the camera and it seems to work fine (the video feed occasionally freezes but it's not 3fps the rest of the time) so the connection can be made via mobile.

My issue comes with detecting the camera using any of the example scripts, where it doesn't seem to detect the rx0 when using my Macbook. Am I missing something to make it detect the rx0 ?

mungewell commented 5 years ago

From the first few posts in this bug, I was able to get a connection to the camera via WiFi (whilst at camera store - I don't have a RX0).

Can you please confirm that the 'scan_for_cameras.py' and 'dump_camera_capabilities.py' function and post the results?

Jumping in to get LiveView images streaming from the camera may be a little optimistic. ;-)

Q. Are you using the latest f/w on the camera? https://www.sony.ca/en/electronics/cyber-shot-compact-cameras/dsc-rx0-dsc-rx0g

jwoodrow commented 5 years ago

With both the macbook connected to the same wifi (I've got both 2.4GHz and 5GHz but the rx0 doesn't seem to work with 5GHz bands):

$ python scan_for_cameras.py
Available cameras: []
$ python dump_camera_capabilities.py
Searching for camera...
Traceback (most recent call last):
  File "dump_camera_capabilities.py", line 93, in <module>
    cameras =  search.discover()
TypeError: discover() takes exactly 2 arguments (1 given)

Going to check the firmware right now and then run the scripts again, see if anything changes.

Keep you up to date

EDIT: I've got to go to some appointments right now I'll give an update to my situation in roughly 3-4 hours sorry guys and thanks for helping me out here.

mungewell commented 5 years ago

For Remote-API WiFi connection the camera should be acting as the AP. ie computer connect direct to camera.

I did some experiments with one of my camera connected to my WiFi Router, but (IIRC) had discover issues.

jwoodrow commented 5 years ago

Here to give you an update (a bit late) I cannot seem to update the firmware from 1.0 to 3.0 using my Mac I keep encountering some issues so I've sent an email to Sony hopefully I'll get a quick reply to help me unblock this if this is causing my issues with the camera detection.

jwoodrow commented 5 years ago

I've managed to update the firmware to 3.0, the issue was with the fact that the firmware updater is not compatible with OSX 10.14 (Mojave).

After doing this I first tried what I did before (connect both the camera and the computer to the same wifi) and got the same result.

Then I tried what @mungewell said and connected my computer to the camera's wifi hotspot. This changed things but I am still unable to run the examples but here is the new output for scan_for_cameras.py (I had to change line 11 because the print method kept crashing because of formatting issues)

$ python scan_for_cameras.py
Available cameras: [('HTTP/1.1 200 OK\r\nCACHE-CONTROL: max-age=1800\r\nEXT: \r\nLOCATION: http://192.168.122.1:64321/dd.xml\r\nSERVER: UPnP/1.0 SonyImagingDevice/1.0\r\nST: urn:schemas-sony-com:service:ScalarWebAPI:1\r\nUSN: uuid:00000000-0005-0010-8000-b8d7af26a48f::urn:schemas-sony-com:service:ScalarWebAPI:1\r\nX-AV-Server-Info: av=5.0; hn=""; cn="Sony Corporation"; mn="SonyImagingDevice"; mv="1.0";\r\n\r\n', ('192.168.122.1', 34430))]

Checking Camera: ('HTTP/1.1 200 OK\r\nCACHE-CONTROL: max-age=1800\r\nEXT: \r\nLOCATION: http://192.168.122.1:64321/dd.xml\r\nSERVER: UPnP/1.0 SonyImagingDevice/1.0\r\nST: urn:schemas-sony-com:service:ScalarWebAPI:1\r\nUSN: uuid:00000000-0005-0010-8000-b8d7af26a48f::urn:schemas-sony-com:service:ScalarWebAPI:1\r\nX-AV-Server-Info: av=5.0; hn=""; cn="Sony Corporation"; mn="SonyImagingDevice"; mv="1.0";\r\n\r\n', ('192.168.122.1', 34430))
[ERROR] camera doesn't workcan only concatenate tuple (not "str") to tuple
mungewell commented 5 years ago

Glad you have something when using the Camera as the AccessPoint. This is how the connection should be made.

The discovery process is 2 stage; find the camera, and then download a file which details how to talk to it: https://github.com/Bloodevil/sony_camera_api/blob/master/src/pysony.py#L61 https://github.com/Bloodevil/sony_camera_api/blob/master/src/pysony.py#L88

Seems like the second is triggering a bug with how we parse the response, can you add a print statement to show the 'doc' sent to '_parse_device_definition()'?

It might be clear what needs to change...

jwoodrow commented 5 years ago

Adding print(doc) on line 92 doesn't print anything new maybe the function isn't even getting called ?

mungewell commented 5 years ago

Then I would suggest printing 'packets' returned here: https://github.com/Bloodevil/sony_camera_api/blob/master/src/pysony.py#L53

I'll also do the same against my devices when I get home this evening... for comparison.

jwoodrow commented 5 years ago

Still not printing anything new when running scan_for_cameras with the print(packets)

mungewell commented 5 years ago

Attached are some logs from a couple of cameras, so you can see what they should return. camera_test.txt

You are remembering to re-install the module after adding the 'print()'s, right?

jwoodrow commented 5 years ago

I did run python setup.py install but since I installed using pip initially I think it wasn't taking it into account. So I decided to try removing the pysony I installed via pip and reinstall via git (with the print part added to pysony.py) but it doesn't seem the installed worked like with pip.

$ python src/example/scan_for_cameras.py
Traceback (most recent call last):
  File "src/example/scan_for_cameras.py", line 5, in <module>
    cameras =  search.discover(5)
  File "build/bdist.macosx-10.14-x86_64/egg/pysony.py", line 53, in discover
  File "build/bdist.macosx-10.14-x86_64/egg/pysony.py", line 70, in _listen_for_discover
UnboundLocalError: local variable 'host' referenced before assignment
jwoodrow commented 5 years ago

Am I maybe doing something wrong during the setup process ?