Closed mfk-smart closed 8 years ago
python-gphoto2 should support everything libgphoto2 does, so the real question is how to do movie capture (with your camera model) in libgphoto2. It may be that the gphoto2 command line application is doing something else, e.g. capturing a sequence of preview stills. I can't find any examples of movie capture with libgphoto2 - they're all using the command line program. Asking on the gphoto2 mailing list might help - no need to mention Python as once we know how to do it in C/C++ it should be easy to write the Python equivalent.
Looking at gphoto sources, it seams that --capture-movie
is an infinite loop of capture previews, which can be done with gp.gp_camera_capture_preview(camera)
(as used in the preview image example).
For everyone coming here later:
import gphoto2 as gp
from subprocess import Popen, PIPE
camera = gp.Camera()
camera.init()
ffmpeg = Popen(['ffmpeg', '-i', '-', '-vcodec', 'rawvideo', '-pix_fmt', 'yuv420p', '-f', 'v4l2', '/dev/video1'], stdin=PIPE)
while True:
capture = camera.capture_preview()
filedata = capture.get_data_and_size()
data = memoryview(filedata)
ffmpeg.stdin.write(data.tobytes())
Hi,
I'm trying to capture movie to stdout and pipe it to ffmpeg to stream video to another computer. I can do it from shell with the following command in shell :
gphoto2 --capture-movie --stdout | ffmpeg -i pipe:0 http://localhost:8080/feed1.ffm
As first step I tried to capture a movie :
gp.gp_camera_capture(camera, gp.GP_CAPTURE_VIDEO, context)
but i got the following error:
Is capturing video not supported in python-gphoto2?