Skip to content

a helper script for using your DSLR/other camera as a webcam

Notifications You must be signed in to change notification settings

slowbro/camera-capture

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 

Repository files navigation

camera-capture

demo

What is this?

A small script to assist with using a DSLR camera as a webcam, using gphoto2, ffmpeg, and v4l2loopback.

Why is this?

I got sick of not being able to control the camera while 'recording' - change focus, adjust aperture, etc, which comes in handy with changing lighting conditions and focus needs.

Installation

Install the needed gems, and run it:

gem install gphoto2 rmagick tty-prompt tty-spinner
./camera-capture

Written for ruby 2.7, but will probably work with as far back as 2.4 - untested, however.

What can I/can't I do with it?

Currently, you can:

  • Autofocus once (or more, if you're lucky!)
  • Manually focus
  • Adjust aperture
  • Adjust shutter speed
  • Send arbitrary gphoto2 configs
  • Restart the capture

Configuration

Configuration is stored in ~/.config/camera-capture.yml, or a file provided by -c or --config. The following keys are available:

output_device: String: Path to the output v4l2loopback device (or whatever you're using).

output_geometry_width: Int: Output width, in pixels.

output_geometry_height: Int: Output height, in pixels.

output_geometry_keep_aspect: Boolean: Should camera-capture keep the output aspect ratio?

wait_for_camera: Boolean: Should camera-capture wait for your camera to appear?

capture_timeout: Int: How long to keep capturing without any clients before disconnecting from the camera.

Known bugs

  • Autofocus. At least with my camera, it usually only ever focuses once. Attempting to 'cancel' and then re-focus has rarely, if ever, worked for me.
  • Adjustment of other camera properties nicely (feel free to use the raw gphoto configs though)

Tested Cameras

  • Canon EOS Rebel T3i
  • Canon EOS M50

Desired features/"roadmap I may or may not ever get to"

  • Bundle into a gem
  • Hotkeys for menus (less arrow/pgup/pgdn usage)
  • Fix autofocus
  • Better interface for changing aperture/etc
  • Feedback for what the current focus level is at (is that even possible..?)
  • Feedback in general (i.e. a "status line" or HUD) for what's going on
  • [-] More customizability in terms of ffmpeg options (i.e. device name, type, format)
    • change geometry/aspect at startup
    • change output geometry on the fly (seems to break the v4l2 device?)
    • change output device
    • change output format
    • sub-menu for ffmpeg status/options
  • Ability to mess with the video feed (add filters, frames, rotate...)
  • [-] Configuration
    • File
    • Saving/Restoring

About

a helper script for using your DSLR/other camera as a webcam

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages