Bloodevil / sony_camera_api

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

Does not find HX60V, need to specify IP address #16

Closed mungewell closed 8 years ago

mungewell commented 8 years ago

Got my hands on a DSC-HX60V, and sample scripts do not find it by default as it allocates a different IP address/range.

Needed to include the actual IP address, after which it seems to work (see below)

-      camera = SonyAPI()
+      camera = SonyAPI(QX_ADDR='http://192.168.122.1:8080/')

simon@retrobox:~/sony_camera_api-git/src/example$ python pyLiveView.py -g -a -d using LiveView grabber Versions: {'result': [['1.0', '1.1', '1.2', '1.3', '1.4']], 'id': 1} API List: {'result': [['getVersions', 'getMethodTypes', 'getApplicationInfo', 'getAvailableApiList', 'getEvent', 'startRecMode', 'stopRecMode']], 'id': 1} Event: {'result': [{'type': 'availableApiList', 'names': ['getVersions', 'getMethodTypes', 'getApplicationInfo', 'getAvailableApiList', 'getEvent', 'stopRecMode', 'startMovieRec', 'startLiveview', 'stopLiveview', 'startLiveviewWithSize', 'actZoom', 'setShootMode', 'getShootMode', 'getAvailableShootMode', 'getSupportedShootMode', 'getExposureMode', 'getSupportedExposureMode', 'getExposureCompensation', 'getAvailableExposureCompensation', 'getSupportedExposureCompensation', 'getFNumber', 'getAvailableFNumber', 'getSupportedFNumber', 'getIsoSpeedRate', 'getAvailableIsoSpeedRate', 'getSupportedIsoSpeedRate', 'getLiveviewSize', 'getAvailableLiveviewSize', 'getSupportedLiveviewSize', 'getShutterSpeed', 'getAvailableShutterSpeed', 'getSupportedShutterSpeed', 'getWhiteBalance', 'getSupportedWhiteBalance', 'getAvailableWhiteBalance', 'getFocusMode', 'getAvailableFocusMode', 'getSupportedFocusMode', 'setZoomSetting', 'getAvailableZoomSetting', 'getZoomSetting', 'getSupportedZoomSetting', 'getStorageInformation', 'setLiveviewFrameInfo', 'getLiveviewFrameInfo']}, {'type': 'cameraStatus', 'cameraStatus': 'IDLE'}, {'zoomPositionCurrentBox': 0, 'zoomNumberBox': 2, 'zoomIndexCurrentBox': 0, 'type': 'zoomInformation', 'zoomPosition': 0}, {'liveviewStatus': False, 'type': 'liveviewStatus'}, None, [], [], None, None, None, [{'recordableTime': 125, 'recordTarget': True, 'storageID': 'Memory Card 1', 'type': 'storageInformation', 'numberOfRecordableImages': -1, 'storageDescription': 'Storage Media'}], None, {'cameraFunctionCandidates': ['Contents Transfer', 'Remote Shooting'], 'type': 'cameraFunction', 'currentCameraFunction': 'Remote Shooting'}, None, None, None, None, None, {'currentExposureMode': 'Intelligent Auto', 'type': 'exposureMode', 'exposureModeCandidates': ['Intelligent Auto']}, {'currentPostviewImageSize': '2M', 'type': 'postviewImageSize', 'postviewImageSizeCandidates': ['Original', '2M']}, None, {'currentShootMode': 'movie', 'type': 'shootMode', 'shootModeCandidates': ['movie']}, None, None, None, None, None, {'fNumberCandidates': [], 'type': 'fNumber', 'currentFNumber': '3.5'}, {'type': 'focusMode', 'focusModeCandidates': [], 'currentFocusMode': 'AF-C'}, {'currentIsoSpeedRate': 'AUTO', 'type': 'isoSpeedRate', 'isoSpeedRateCandidates': []}, None, {'type': 'programShift', 'isShifted': False}, {'shutterSpeedCandidates': [], 'currentShutterSpeed': '1\/30', 'type': 'shutterSpeed'}, {'checkAvailability': True, 'currentColorTemperature': -1, 'type': 'whiteBalance', 'currentWhiteBalanceMode': 'Auto WB'}, None], 'id': 1} adjusted width from 800 to 640 adjusted height from 512 to 360 started capture Stopped capture: frames = 505 , delta = 20.754361 , fps = 24.3322355239 terminating... terminated

mungewell commented 8 years ago

Should also note that the 'remote control' function of this camera is one of Sony's PlayMemories Apps running on the camera.The list of current support features may be interesting: https://www.playmemoriescameraapps.com/portal/usbspec.php?eid=IS9104-NPIA09014_00-F00002

Bloodevil commented 8 years ago

in case of QX10, it was 'http://10.0.0.1:10000' so if there are no params, default is 10.0.0.1:10000. I can fix this like below:

mungewell commented 8 years ago

In terms of specify the IP/URL of camera manual, I agree it's a useful ability and can 'just' be done on the command line.

The camera(s) supposedly have a uPNP characteristic which should allow them to be automatically discovered. There's a big long write up on how someone solved this here: http://stackoverflow.com/questions/21340286/windows-compatibility-with-the-sony-camera-remote-api

Bloodevil commented 8 years ago

SonyAPI class had upnp but that upnp is not work on my mac that day. So I commented to there 'it is not work' i should test again. Thanks your comment it looks useful

mungewell commented 8 years ago

Found a few other projects on GitHub which had implemented the uPNP stuff and 'borrowed' some code from this one (under the MIT license). https://github.com/storborg/sonypy/blob/master/sonypy/discovery.py

Not fully tested as don't have HX60 with me this week, but you might like to try: https://github.com/mungewell/sony_camera_api/tree/new_discover

Theres a new script in the examples folder.

mungewell commented 8 years ago

Closing bug as automatic uPNP detection now works on HX60.