gphoto / gphoto2

The gphoto2 commandline tool for accessing and controlling digital cameras.
GNU General Public License v2.0
682 stars 118 forks source link

Support for Sony A7 R4 #272

Open abrock opened 4 years ago

abrock commented 4 years ago

I have a Sony A7 R4 and encountered some weird bugs. Since it is not listed as supported I thought I'd use the "new camera" template, I hope that's correct.

Name of the camera

Sony Alpha 7 R IV / ILCE-RM4

USB IDs

Bus 002 Device 013: ID 054c:0ccc Sony Corp. ILCE-7RM4

full output of "lsusb -v"

camera summary output

summary.txt

camera configuration output

list-all-config.txt

test capture

Here comes the weird bugs:

  1. I tried to capture and download an image:

time env LANG=C gphoto2 --debug --debug-logfile=capture-image-and-download.txt --capture-image-and-download

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

real 0m38.650s user 0m1.530s sys 0m1.071s

capture-image-and-download.zip

But the camera definitely did capture an image and stored it to the SD card, I can look at it on the camera despite setting the "Still Img. Save Dest." option on the camera to "PC Only".

  1. I tried to capture an image and NOT download it, just to see what happens:

time env LANG=C gphoto2 --debug --debug-logfile=capture-image.txt --capture-image

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

real 0m38.630s user 0m1.506s sys 0m1.073s

capture-image.zip

Again, the camera captured an image and stored it to the SD card.

  1. I thought I'd try entangle. It works nicely, I can capture and download images. Then I closed entangle and tried again using gphoto2 and suddenly it worked for one image:

time env LANG=C gphoto2 --debug --debug-logfile=capture-image-and-download-after-entangle2.txt --capture-image-and-download New file is in location /capt0000.arw on the camera
Saving file as capt0000.arw Deleting file /capt0000.arw on the camera

real 0m5.764s user 0m2.362s sys 0m0.802s

I can't show you the logfile since it's >500MB and doesn't zip well. I tried to set the camera to "APSC-Crop" and "Compressed RAW", manual mode with the shortest posssible exposure time, aperture closed and lens hood on the lens hoping it would compress better but it didn't get below the size limit for github files. So I manually deleted most of the seemingly repetitive stuff in the middle of the file, I marked it with "#################### Stripped #######################"

capture-image-and-download-after-entangle7-apsc-shortened.txt

but when I tried once more I got the same error as before:

time env LANG=C gphoto2 --debug --debug-logfile=capture-image-and-download-after-entangle5.txt --capture-image-and-download ERROR: Could not capture image.
ERROR: Could not capture.

real 0m38.644s user 0m1.723s sys 0m1.078s

capture-image-and-download-after-entangle5.zip

Thoughts:

When I connect the camera to the PC the camera monitor shows a little text "-PC-". When I start entangle that disappears and I can no longer switch to the view where I see the images stored on the camera.. I think entangle somehow makes the camera "ready" for remote operation. When I close entangle the text doesn't re-appear but it does re-appear after using gphoto2 to capture and download an image. Seems to me that this text on the camera monitor indicates if it's ready to capture an image.

msmeissn commented 4 years ago

its hard to say what makes entangle special... did you switch ion preview there? Perhaps that is one thing? If you enabled preview and then captured in entangle, do gphoto2 --capture-preview --capture-image-and-download

abrock commented 4 years ago

I did not switch to live preview for the tests. I tried it now and within entangle the live preview works as expected. When I close entangle I can get one preview image from the camera:

time env LANG=C gphoto2 --debug --debug-logfile=capture-preview-after-entangle.txt --capture-preview capture-preview-after-entangle.txt capture_preview

If I try once more (or before using entangle) the capture preview fails: time env LANG=C gphoto2 --debug --debug-logfile=capture-preview.txt --capture-preview capture-preview.txt

I wanted to see what entangle does so I ran it with ltrace and found that it gets the summary of the camera. That gave me the idea to use the gphoto2 shell like this:

env LANG=C ltrace -l libgphoto2.so.6 -l libgphoto2_port.so.12 gphoto2 --debug --debug-logfile=shell.log --shell 2> gphoto2-ltrace.txt

In the shell I executed "summary" and "capture-image", then closed the shell. After each action I added a line to both logfiles to mark where the action starts / stops, you can find them by searching for "#####"

gphoto2-ltrace.txt shell.log

I found that the command "capture-image" actually downloads the image but doesn't put it in a file, so the log is >500MB, i cut the part where all the data is transferred.

I also found out that I can't capture an image too early after running the "summary" command, the camera needs a second or two after the summary command finishes, if I don't wait I get the same error as in my original bugreport.

msmeissn commented 4 years ago

it might SDRAM capture, so try --capture-image-and-download

msmeissn commented 4 years ago

the second capture preview reports "PTP Access Denied" on accessing the preview. we might not be waiting long enough ... does it help to do multiple capture previews ?

gphoto2 --capture-preview --capture-preview --capture-preview

chubun commented 4 years ago

Sorry for an out of topic question. Just wonder if we "bribe" the developers with a A7R4 camera, will it makes support for this camera goes faster?

MichaelBMF commented 4 years ago

I'm currently also trying to get a A7 R IV working with gphoto: gphoto2 --capture-preview --capture-preview --capture-preview will capture a preview image

P.S.: I'm completely new to gphoto 😄

tphakala commented 3 years ago

I am also chiming in on this thread, having same issues as OP. Gphoto2 triggers A7R4 to take a image(s) but it does not download them.

$ time env LANG=C gphoto2 --debug --debug-logfile=sony-a7r4-log.txt --capture-image-and-download ERROR: Could not capture image. ERROR: Could not capture.

real 0m39.642s user 0m1.556s sys 0m1.111s

summary.zip list-all-config.zip sony-a7r4-log.zip

How can I help to debug this further?

msmeissn commented 3 years ago

can you try to do a 3 second wait before each capture

gphoto2 --wait-event=3s --capture-image-and-download

and see if that helps?

tphakala commented 3 years ago

Thank you, it indeed did fix the issue!

$ time env LANG=C gphoto2 --debug --debug-logfile=sony-a7r4-log.txt --wait-event=3s --capture-image-and-download Waiting for 3 seconds for events from camera. Press Ctrl-C to abort. UNKNOWN PTP Property 0000 changed UNKNOWN PTP Property 0000 changed UNKNOWN PTP Property 0000 changed New file is in location /capt0000.arw on the camera Saving file as capt0000.arw Deleting file /capt0000.arw on the camera New file is in location /capt0001.arw on the camera Saving file as capt0001.arw Deleting file /capt0001.arw on the camera New file is in location /capt0002.arw on the camera Saving file as capt0002.arw Deleting file /capt0002.arw on the camera New file is in location /capt0003.arw on the camera Saving file as capt0003.arw Deleting file /capt0003.arw on the camera New file is in location /capt0004.arw on the camera Saving file as capt0004.arw Deleting file /capt0004.arw on the camera New file is in location /capt0005.arw on the camera Saving file as capt0005.arw Deleting file /capt0005.arw on the camera

I have hi+ continuous shooting mode enabled and with these settings camera seems to take 4 or 5 images with one go. I tested 1 and 2 sec delays, either of those does not work, 3 sec delay seems to be required.

Here is a fresh log file, I removed data from image part in the log so that I could upload it.

sony-a7r4-log.zip

tomhuntley commented 3 years ago

Hi, do you think this issue would be solvable with some time (and funding?) or is it a limitation of the camera itself?

Thanks