Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VideoCaptureContext #14

Open
hknox opened this issue Sep 18, 2016 · 10 comments
Open

VideoCaptureContext #14

hknox opened this issue Sep 18, 2016 · 10 comments

Comments

@hknox
Copy link

hknox commented Sep 18, 2016

Hello. I am trying to control a Nikon D750 from a Python script. I want to be able to start video recording, wait for something to happen elsewhere in my script, then stop the video recording. I have tried something like this:

import gphoto2cffi as gp
camera = gp.Camera()
context = gp.gphoto2.VideoCaptureContext(camera)
#... wait for something, even as simple as time.sleep(7)
context.stop()

This causes the camera to record video for 1 second then stop. When the code gets to "context.stop()", it hangs.

Any thoughts about what I might be doing wrong?
Python 2.7.12
libgphoto2 2. 5.10
gphoto2cffi 0.3~a1-1

Thanks, Hank

@jbaiter
Copy link
Owner

jbaiter commented Sep 19, 2016

Can you configure the logger to use the DEBUG loglevel and run you script again? I mapped the internal logger of libgphoto2 to the Python logging system, so any errors/warnings should show up there.
Just add the following two lines to the beginning of your script:

import logging
logging.basicConfig(level=logging.DEBUG)

@hknox
Copy link
Author

hknox commented Sep 19, 2016

The test script looks like this:

import time
import gphoto2cffi as gp
import logging

logging.basicConfig(level = logging.DEBUG)

camera = gp.Camera()
context = gp.gphoto2.VideoCaptureContext(camera)
time.sleep(5)
context.stop()

When I run python test_camera.py, the camera takes a 1 second video which is saved to the camera memory card. There is no output at all until about 10 seconds after the camera has clicked a second time, then I get:

DEBUG:root:Timeout while waiting for event.
DEBUG:root:Timeout while waiting for event.
DEBUG:root:Timeout while waiting for event.
DEBUG:root:Timeout while waiting for event.
DEBUG:root:Timeout while waiting for event.
DEBUG:root:Timeout while waiting for event.
DEBUG:root:Timeout while waiting for event.
DEBUG:root:Timeout while waiting for event.
DEBUG:root:Timeout while waiting for event.
DEBUG:root:Timeout while waiting for event.
DEBUG:root:Timeout while waiting for event.

Until I hit Ctl-C.

I can use the gphoto2 command line to record an unlimited video:

gphoto2 --set-config movie=1 --wait-event --set-config movie=0

will record video until I hit Ctl-C.

@jbaiter
Copy link
Owner

jbaiter commented Sep 19, 2016

Thank you for the details, I will have a look at the gphoto2 source code and see if I'm doing anything different/wrong when recording videos.

@hknox
Copy link
Author

hknox commented Sep 19, 2016

I have debug output from the command line if that would help.

Hank

Sent from an iPhone....

On Sep 19, 2016, at 07:53, Johannes Baiter notifications@github.com wrote:

Thank you for the details, I will have a look at the gphoto2 source code and see if I'm doing anything different/wrong when recording videos.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.

@jbaiter
Copy link
Owner

jbaiter commented Sep 19, 2016

Since I don't have your camera at home, that would help a great deal :-)

@hknox
Copy link
Author

hknox commented Sep 19, 2016

Here is a link
(https://drive.google.com/open?id=1vAS6DpY0K_-gkGKF5M1FZdXD7Sr4sUU8thlIsLspBBs)
to the debug output from the following command:

gphoto2 --set-config movie=1 --wait-event --set-config movie =0 --debug

Hank

On 2016-09-19 8:29 AM, Johannes Baiter wrote:

Since I don't have your camera at home, that would help a great deal :-)


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#14 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABNb1aRyWimEZ2SIuw736l_5FIIY9qamks5qroANgaJpZM4J_7iF.

@hknox
Copy link
Author

hknox commented Sep 26, 2016

Is there a way to capture the debug info from libgphoto2 using the cffi wrapper? The logging command I used above only seems to get the Python log output. It would be useful to see what the underlying library is doing.

@jbaiter
Copy link
Owner

jbaiter commented Sep 26, 2016

You're right! I was convinced that I had already implemented this, but it turns out I did only half the work: The logging callback was defined, but never registered with the library! I now fixed this, so please install the latest version from github, set your logging level to DEBUG and see what the library says :-)

@hknox
Copy link
Author

hknox commented Sep 26, 2016

Here is a link to debug output: https://docs.google.com/document/d/1EEEvzcrGHz7WSdN93y9vYzE0lXtBVnCtELTX7zlJL80/edit?usp=sharing

There is an INFO:root log message where I instantiate the VideoCaptureContext, then another after that call returns. There are over 100 pages of output between the 2 root log messages, I'm not sure how to read it quickly! Does this help??

@jbaiter
Copy link
Owner

jbaiter commented Feb 16, 2017

@hknox Sorry for not responding to your issue, I got a bit swamped in September/October and unfortunately this issue fell under the table :-( Could you please re-upload your log?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants