Close

Use an EOS RP as a webcam on Linux

A project log for Silly software wishlist

Motivation to do some software projects by writing them down.

lion-mclionheadlion mclionhead 05/14/2020 at 00:540 Comments

This only works with the very latest cameras, manely the EOS RP.  The journey begins by compiling the v4l2 loopback device.

https://github.com/umlaeute/v4l2loopback

insmod v4l2loopback.ko

This creates a new /dev/video device which can be simultaneously written & read.  The same device is used for writing & reading.

Then, with the camera turned on, run

gphoto2 --stdout --capture-movie | ffmpeg -i - -vcodec rawvideo -pix_fmt rgb24 -threads 0 -f v4l2 /dev/video1

Take note of the frame size.  The same frame size must be used for capturing.

Then, in the case of Cinelerra, recording must be configured to use uncompressed RGB, Video4Linux2, /dev/video1, 960x640, 15fps, frames to buffer in device: 2.  If the framerate is too high, it'll studder.   If it's too low, it'll studder less but be bearable.  The kernel driver has a bug in its double buffering, as most double buffering newbies tend to have.

Who knows what settings will get invoked with browser based video conferencing.  An ideal video conferencing system would have gphoto2 send frames to a program that performed some realtime effects, defishing, sharpening, color correction.  

ffmpeg can perform defishing with some convoluted command line parameters.


-vf "lenscorrection=cx=0.5:cy=0.5:k1=-0.1:k2=-0.1"

It uses nearest neighbor scaling & looks absolutely horrid.  1 of the lion kingdom's 2 computers only captures video with the camera in still photo mode.  Another captures video with the camera in video mode.  It's either a gphoto2 version problem or a USB problem.  In still photo mode, the autofocus is disabled.

After a while, the lion kingdom decided the EOS RP wasn't worth the trouble & went back to an old fashioned webcam for video conferencing.

Discussions