gphoto / gphoto2

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

Cannot capture video with Nikkon D5000/D5100 on Rasbian system #182

Open MrGiskard opened 5 years ago

MrGiskard commented 5 years ago

Greetings to all

I have run into problems trying to capture video on a Nikkon D5000/D5100 with gphoto on a Rasberry Pi and I was wondering if any fellow user can offer some help on the matter. Keep in mind that I can capture images without any problem on both cameras (and other Nikkon models as well e.g D70)

I am trying to shoot video using the following gphoto2 command which i have seen in several tutorials/forums on the internet:

gphoto2 --debug --port=usb:001,017 --set-config movie=1 --wait-event=5s --set-config movie=0 --wait-event-and-download=2s --filename=test.avi --force-overwrite

and the following events happen:

  1. I get the message "Invalid Status" on screen
  2. I can hear the shutter of the camera open
  3. The following lines appear on-screen

Waiting for 5 seconds for events from camera. Press Ctrl-C to abort. UNKNOWN PTP Property d1a2 changed UNKNOWN PTP Property d1b1 changed UNKNOWN PTP Property d1b1 changed UNKNOWN PTP Property d1b1 changed Waiting for 2 seconds for events from camera. Press Ctrl-C to abort.

  1. I can hear the shutter of the camera close.

The time between the shutter openings appears to correspond to the time setting in my command but of course no movie file is created.

Following some more tests I have found the following:

  1. The "Invalid status" error appears even if my command is only gphoto2 --debug --port=usb:001,017 --set-config movie=1

  2. Following a list-all-config command I have found the "movie" setting on the camera but I can see that the current setting is "2" even though it has type "TOGGLE" so I expected a 1 or a 0 - I do not understand what that means. In any case if I try to use a different value than 1 or 0 in the --set-config movie I get a value error so it appears that only these are the accepted values

I have also produced a full debug trace which is too long to post here but I am pasting the part where the error appears:

0.458704 ptp_usb_getresp (2): Reading PTP_OC 0x920a (PTP_OC_NIKON_StartMovieRecInCard) response... 0.458721 gp_port_read (3): Reading 1024 = 0x400 bytes from port... 0.458835 gp_port_read (3): Read 12 = 0xc out of 1024 bytes from port: (hexdump of 12 bytes) 0000 0c 00 00 00 03 00 04 a0-0d 00 00 00 ............

0.458858 ptp_usb_getresp [usb.c:438] (0): PTP_OC 0x920a receiving resp failed: Invalid Status (0xa004) 0.458880 _put_Nikon_Movie config.c:5872: 'ptp_nikon_startmovie (params)' failed: 'Invalid Status' (0xa004) 0.458925 gp_context_error (0): Invalid Status

Error
Invalid Status 0.459136 camera_wait_for_event (2): waiting for events timeout 1000 ms 0.459168 ptp_usb_sendreq (2): Sending PTP_OC 0x90c7 (PTP_OC_NIKON_CheckEvent) request... 0.459185 gp_port_write (3): Writing 12 = 0xc bytes to port... 0.459256 gp_port_write (3): Wrote 12 = 0xc bytes to port: (hexdump of 12 bytes) 0000 0c 00 00 00 01 00 c7 90-0e 00 00 00 ............

Lastly I post my gphoto2 version details:

0.000892 main (2): gphoto2 2.5.10 0.000973 main (2): gphoto2 has been compiled with the following options: 0.001009 main (2): + gcc (C compiler used) 0.001045 main (2): + popt (mandatory, for handling command-line parameters) 0.001077 main (2): + exif (for displaying EXIF information) 0.001112 main (2): + no cdk (for accessing configuration options) 0.001142 main (2): + no aa (for displaying live previews) 0.001174 main (2): + jpeg (for displaying live previews in JPEG format) 0.001204 main (2): + no readline (for easy navigation in the shell)

Any assistance on the problem would be greatly appreciated

Thanks!

MrGiskard commented 5 years ago

UPDATE: I have discovered that when I insert an SD card in the Nikkon D5100 movie capture works fine with the command I originally posted with one change: --wait-event-and-download must be set to at least 4s. Anything below that appears to cause the file download to fail. I do not get any error messages whatsoever so I do not understand why that is happening but I'm guessing it's because anything below 4s is less than the time required to actually complete the file transfer.

So this issue appears to have been resolved although i would like to know whether it is possible to capture video without an SD card and also whether there is any way to capture video on a Nikkon D5000 - the "moviesound" setting i mentioned earlier appears to be simply a setting to determine whether the movie will have sound or not although it is useless if the actual movie capture setting is not visible.