gphoto / libgphoto2

The libgphoto2 camera access and control library.
GNU Lesser General Public License v2.1
1.02k stars 323 forks source link

Focus manipulation during live streaming video #62

Open mfk-smart opened 8 years ago

mfk-smart commented 8 years ago

Hi,

I can stream live image from my EOS camera with the following command : gphoto2 --capture-movie --stdout | ffmpeg -i pipe:0 http://localhost:8080/feed1.ffm

Also I can do focus manipulation with the following command : gphoto2 --set-config-index manualfocusdrive=6

Is it technically possible to do these both at the same time in Python or C by using gphoto2?

Thanks! mfk

rlamarche commented 8 years ago

Hi,

I'm using libgphoto2 directly in C and by patching libgphoto2 I'm able to get live view while the camera is focusing. I'm using a Nikon D800.

I had to patch libgphoto2 because there is an explicit "sleep" in the libgphoto2 code when you ask autofocus. I suspect that not all camera send the liveview while focusing. But in my case, it works.

rlamarche commented 8 years ago

here the code I updated : https://github.com/gphoto/libgphoto2/blob/master/camlibs/ptp2/config.c#L5123 It seems to be Nikon specific code.

msmeissn commented 8 years ago

@mfk-smart technically you can only have 1 ptp session open with the device at any point in time as there is just one usb session concept (and it uses incrementing sequence numbers, so a new one will either not work, or abort the first). So for specific work in parallel you would need a single program that handles both.

@rlamarche the sleep was there to get the result of the focusing and if the camera returns busy it might not allow other operations ... it seems it does allow some operations, so the code might need to be revisitied

rlamarche commented 8 years ago

Thank you for the explanation @msmeissn . Indeed I'm able to get liveview while focusing, but I don't know if any other operation is possible. Moreover I've only a Nikon D800 to test. That's why I keep it as a patch for the moment.

smheidrich commented 3 years ago

Hmm so this is still not possible using only gphoto2's CLI application? Does anyone know an application built on top of libgphoto2 (as mentioned by @rlamarche) that allows to send commands (not just autofocus but in general) to the camera while streaming video? If not, would it be possible to implement this in gphoto2's CLI application, e.g. by having it listen for additional commands on a UNIX socket while streaming video? Or something like that...