gphoto2 icon indicating copy to clipboard operation
gphoto2 copied to clipboard

Remote video recording using Nikon D7200

Open benjyl opened this issue 1 year ago • 4 comments

I am trying to create a python script that triggesr a video recording that saves to a Nikon D7200 SD card.

I tried using the command line code to see if the video could be recorded gphoto2 --set-config movie=1 --wait-event=10s --set-config movie=0 --wait-event-and-download=2s but received an error "Failed to se new configuration value 0 for configuration entry movie".

I also tried running the following python script:

import time
import subprocess
import signal, os

def killgphoto2():
    p = subprocess.Popen(['ps', '-A'], stdout=subprocess.PIPE)
    out,err = p.communicate()
    for line in out.splitlines():
        if b'gvfsd-gphoto2' in line:
            #kill process
            pid = int(line.split(None, 1)[0])
            os.kill(pid, signal.SIGKILL)

def record_video():
    subprocess.run(["gphoto2", "--set-config", "movie=1"])
    subprocess.run(["gphoto2", "--wait-event", "10s"])
    subprocess.run(["gphoto2", "--set-config", "movie=0"])

if __name__ == '__main':
    killgphoto2()
    record_video()

The script opens the camera, starts the recording and then stops the recording after around 1s of the wait event (I added a print statement after the wait event that only appeared after 10s) and it always happened after 1s, no matter how long I made the wait-event so something appears to be going wrong during this time.

The following came out in the terminal, I don't know if it is useful.

UNKNOWN PTP StoreAdded, Param1 00010001
UNKNOWN PTP Property 5003 changed
UNKNOWN PTP Property 5003 changed
UNKNOWN PTP Property 500a changed
UNKNOWN PTP Property d030 changed
UNKNOWN PTP Property d0a0 changed
UNKNOWN PTP Property d0a4 changed
UNKNOWN PTP Property d1a2 changed
UNKNOWN PTP Property d1a6 changed
UNKNOWN PTP Property d1a8 changed
UNKNOWN PTP Property d1a9 changed
UNKNOWN PTP Property d1ab changed
UNKNOWN PTP Property d1af changed
UNKNOWN PTP Property d1b1 changed
UNKNOWN PTP Property d20f changed
UNKNOWN PTP Property 500c changed
FILEADDED DSC_1419.MOV /store_00010001/DCIM/111D7200
UNKNOWN PTP Event 400c, Param1 00010001
UNKNOWN PTP Property d030 changed
UNKNOWN PTP Property d0a0 changed
UNKNOWN PTP Property d1b1 changed
UNKNOWN PTP Property d1b4 changed
UNKNOWN PTP Property d1f1 changed
UNKNOWN PTP Property d20f changed

Does anyone know what might be causing the issue and how to solve it?

Thanks

benjyl avatar Jan 11 '23 16:01 benjyl