gphoto / gphoto2

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

LiveView Streaming stops after few minutes on Nikon D7000 #449

Closed Artiom-M closed 3 years ago

Artiom-M commented 3 years ago

I am using Nikon D7000 with gphoto2 --capture-movie --stdout and it works but after some time the shutter is closed. I don't have any setting to set this timeout in the camera. In this project https://github.com/puhitaku/mtplvcap they included a workaround :

watch the shutter and open it automatically when it's closed.

Would it be possible with GPhoto? I can see a lot of untranslated settings in the list, but among human readable I don't see any one that controls shutter.

msmeissn commented 3 years ago

after how many seconds does this happen?

usually we try to restart liveview in our code if its not running, so it should work already.

if it does not for you , can you try to extract a debuglogfile
gphoto2 --capture-movie --debug-logfile=preview.log --debug --stdout | ..

you might need to discard the first part truncate the logfile befvore the shutter goes down

Artiom-M commented 3 years ago

So I have explored the issue and this was not gphoto2. I was starting it from udev rule (so when I turn camera on it starts streaming to v4l device) and as it is not detaching itself it was killed by udev. So I've changed udev rule to start systemd unit instead and it works now. For reference, udev rule for Nickon D7000:

ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="04b0", ATTR{idProduct}=="0428", 
  GROUP="usb", TAG+="systemd",\
  ENV{SYSTEMD_WANTS}="nikon-v4l@usb:D7000.service"

and matching systemd unit:

[Unit]
Description=Nikon DSLR streaming

[Service]
Type=simple
GuessMainPID=false
ExecStart=/bin/sh /usr/local/bin/gphoto_vcam.sh

The shell script contains just one line mentioned earlier.