gphoto2 icon indicating copy to clipboard operation
gphoto2 copied to clipboard

Sony ERROR: Could not capture image.

Open WIsbrecht opened this issue 6 years ago • 4 comments

Hi,

so many Sony camera users have complained about sporadic freezes or resets while capturing images. My investigation suggest that it has to do with auto focus. These might be related issues: #117 #109 #111 #80 #83 gphoto/libgphoto2#161 Every time one issues a capture-image (capture-image-and-download) and the camera fails to auto focus correctly gphoto2 will timeout eventually. My Sony a58 will reset automatically after that.

For example - capturing with auto focus on:

➜  ~ gphoto2 --capture-image-and-download --interval=1 --force-overwrite
Time-lapse mode enabled (interval: 1s).                                        
Capturing frame #1...
New file is in location /capt0000.jpg on the camera                            
Saving file as capt0000.jpg
Deleting file /capt0000.jpg on the camera
not sleeping (3 seconds behind schedule)
Capturing frame #2...
New file is in location /capt0001.jpg on the camera                            
Saving file as capt0001.jpg
Deleting file /capt0001.jpg on the camera
not sleeping (2 seconds behind schedule)
Capturing frame #3...
New file is in location /capt0002.jpg on the camera                            
Saving file as capt0002.jpg
Deleting file /capt0002.jpg on the camera
not sleeping (2 seconds behind schedule)
Capturing frame #4...
New file is in location /capt0003.jpg on the camera                            
Saving file as capt0003.jpg
Deleting file /capt0003.jpg on the camera
not sleeping (2 seconds behind schedule)
Capturing frame #5...

in this run the camera failed to auto focus after the fourth image. While gphoto is waiting for a new event one could manually trigger a new photo by pressing the trigger button of the camera. If one fails to do so in a timely fashion gphoto will time out and throw this error message and the camera will reset.

ERROR: Could not capture image.
ERROR: Could not capture.

otherwise the timelapse will continue until the next failed attempt to auto focus or ctrl-c.

New file is in location /capt0004.jpg on the camera                            
Saving file as capt0004.jpg
Deleting file /capt0004.jpg on the camera
not sleeping (9 seconds behind schedule)
Capturing frame #6...
New file is in location /capt0005.jpg on the camera                            
Saving file as capt0005.jpg
Deleting file /capt0005.jpg on the camera
not sleeping (2 seconds behind schedule)
Capturing frame #7...
New file is in location /capt0006.jpg on the camera                            
Saving file as capt0006.jpg
Deleting file /capt0006.jpg on the camera
not sleeping (2 seconds behind schedule)
Capturing frame #8...

Here is a debug dump:

➜  ~ gphoto2 --capture-image --debug --debug-logfile gphoto_debug_af_failed.txt

... 35 sec hang, camera resets at this point ...

ERROR: Could not capture image.                                                
ERROR: Could not capture.

gphoto_debug_af_failed.zip

Followup: just searched the debug log and found this on line 700:

1.627239 camera_sony_capture         (2): during event.code=c203 Param1=0000d21d

event.code=c203 is PTP_EC_Sony_PropertyChanged and Param1=0000d21d is not defined anywhere.

https://github.com/gphoto/libgphoto2/blob/91a8425a4fa27def793fa9db2bcb4a71c26c927b/camlibs/ptp2/library.c#L3858-L3868

Here PTP_EC_Sony_PropertyChanged must be PTP_DPC_SONY_FocusFound but is instead 0xd21d This might indicate that the camara could not auto focus. But i might be wrong.

It all adds up to this: something goes horribly wrong after this line: https://github.com/gphoto/libgphoto2/blob/91a8425a4fa27def793fa9db2bcb4a71c26c927b/camlibs/ptp2/library.c#L3922 (relevant debug log lines: 491869 and following)

WIsbrecht avatar Apr 28 '18 11:04 WIsbrecht

Is there any improvement on this?

minw428 avatar Jan 06 '19 23:01 minw428

Same here, it's being 6 months trying to figure out a solution to this

enricopenzo avatar Feb 06 '19 09:02 enricopenzo

i think I fixed the problem with capture problems with out-of-focus on the weekend..

perhaps you can retest current libgphoto2 git?

msmeissn avatar Feb 12 '19 15:02 msmeissn

Hi, thanks for looking into this and sorry for the late reply. I installed the latest development version using gphoto2 updater (hopefully that will pull the libgphoto2 git repository). I still encounter the same problem with: gphoto2 --capture-image-and-download --interval=1 --force-overwrite

The process often stops randomly returning: ERROR: Could not capture image. ERROR: Could not capture.

This happened using a Sony RX100M5

Then I tried with a Sony RX0 and it always hangs after the first picture (no repeat shots). see output below: Time-lapse mode enabled (interval: 1s). Capturing frame #1... Downloading... |----------- \ 25.0% Downloading... |---------------------------- | 62.5% Downloading... |--------------------------------------- / 87.5% Downloading... |---------------------------------------------| 100.0% New file is in location /capt0000.jpg on the camera Saving file as capt0000.jpg Deleting file /capt0000.jpg on the camera

streakerau avatar Mar 29 '19 12:03 streakerau