How to use Fujifilm X-T3 as a webcam on Ubuntu 20.04

Summary

setup

First install the required packages

sudo apt-get install gphoto2 v4l2loopback-utils v4l2loopback-dkms ffmpeg

Check the current / dev / video * after the installation is complete

ll /dev/video*

The hand environment is a notebook PC with a built-in camera and the following display

crw-rw----+ 1 root video 81,0 august 25 15:00 /dev/video0
crw-rw----+ 1 root video 81,1 August 25 15:00 /dev/video1

Then add a dummy video device

sudo modprobe v4l2loopback exclusive_caps=1 max_buffers=2

Check the number of the added device

ll /dev/video*

The following display in the hand environment

crw-rw----+ 1 root video 81,0 august 25 15:00 /dev/video0
crw-rw----+ 1 root video 81,1 August 25 15:00 /dev/video1
crw-rw----+ 1 root video 81,2 August 26 09:45 /dev/video2

Dummy device with / dev / video2 added. Use this later

Check the information of the added device

v4l2-ctl --device=/dev/video2 --info

Such a display at hand

Driver Info:
        Driver name      : v4l2 loopback
        Card type        : Dummy video device (0x0000)
        Bus info         : platform:v4l2loopback-000
        Driver version   : 5.4.44
        Capabilities     : 0x85208000
                Video Memory-to-Memory
                Read/Write
                Streaming
                Extended Pix Format
                Device Capabilities
        Device Caps      : 0x85208000
                Video Memory-to-Memory
                Read/Write
                Streaming
                Extended Pix Format
                Device Capabilities

Connect the X-T3 to your PC via USB and run the following to gphoto2 stream the video to standard output. Write raw video with ffmpeg to / dev / video2 in yuv420p format.

gphoto2 --stdout --capture-movie | ffmpeg -i - -vcodec rawvideo -pix_fmt yuv420p -f v4l2 /dev/video2

Now, if you launch zoom and select dummy device as the video device X-T3 Webcam completed

Finish

It is troublesome to type the following command every time, so finish it so that it will be executed automatically

sudo modprobe v4l2loopback exclusive_caps=1 max_buffers=2

Create a module called dslr-webcam and put it in the list you want to load

cat << 'EOS' >> /etc/modprobe.d/dslr-webcam.conf
# Module options for Video4Linux, needed for our DSLR Webcam
alias dslr-webcam v4l2loopback
options v4l2loopback exclusive_caps=1 max_buffers=2
EOS

echo "dslr-webcam" >> /etc/modules

Postscript

After rebooting, / dev / video0 was a Dummy device.

Check with the following command

v4l2-ctl --device=/dev/video0 --info

I can't remember the command every time I start capturing, so I created a fuji command.

cat << 'EOS' > ~/bin/fuji
gphoto2 --stdout --capture-movie | ffmpeg -i - -vcodec rawvideo -pix_fmt yuv420p -f v4l2 /dev/video0
EOS
chmod +x ~/bin/fuji

Even after rebooting again, / dev / video0 was a Dummy device, so it seems that dslr-webcam is loaded before the laptop camera in my environment.

It can be used as a webcam on zoom, but it is black on Skype. When using with Skype, change the scale referring to the URL below -vf scale = 1024: 567 and it's OK.

gphoto2 --stdout --capture-movie | ffmpeg -i - -vcodec rawvideo -vf scale=1024:567 -pix_fmt yuv420p -f v4l2 /dev/video0

https://answers.microsoft.com/en-us/skype/forum/all/video-feed-from-capture-device-elgato-cam-link-4k/e596fff6-c7df-49b8-8d25-e19b5235aea4

Reference material

https://medium.com/nerdery/dslr-webcam-setup-for-linux-9b6d1b79ae22

Recommended Posts

How to use Fujifilm X-T3 as a webcam on Ubuntu 20.04
[Tips] How to use iPhone as webcam on Linux
A memorandum on how to use keras.preprocessing.image in Keras
How to use GitHub on a multi-person server without a password
How to build a new python virtual environment on Ubuntu
How to use Dataiku on Windows
Notes on how to use pywinauto
Notes on how to use featuretools
How to use homebrew on Debian
How to use cuML SVC as a Gridsearch CV classifier
How to register a package on PyPI (as of September 2017)
How to use a file other than .fabricrc as a configuration file
Notes on how to use doctest
How to install Go on Ubuntu
How to build a Python environment using Virtualenv on Ubuntu 18.04 LTS
How to deploy a web application on Alibaba Cloud as a freelancer
How to use mecab, neologd-ipadic on colab
How to use OpenVPN with Ubuntu 18.04.3 LTS
How to use Google Assistant on Windows 10
[Ubuntu] How to execute a shell script
Memorandum on how to use gremlin python
How to install php7.4 on Linux (Ubuntu)
How to test on a Django-authenticated page
How to disguise a ZIP file as a PNG file
A simple example of how to use ArgumentParser
[Latest] How to build Java environment on Ubuntu
How to use Python Kivy ④ ~ Execution on Android ~
How to run MeCab on Ubuntu 18.04 LTS Python
How to update security on Ubuntu 19.10 Eoan Ermine
How to live a decent life on 2017 Windows
How to build Java environment on Ubuntu (Linux)
[Linux] How to read .bashrc of general user as root user on WSL2 Ubuntu20.04
How to use xml.etree.ElementTree
How to use Python-shell
How to use tf.data
How to use virtualenv
How to use Seaboan
How to use image-match
How to use shogun
How to use Pandas 2
How to use Virtualenv
How to use numpy.vectorize
How to use pytest_report_header
How to use partial
How to use Bio.Phylo
How to use SymPy
How to use x-means
How to use WikiExtractor.py
How to use IPython
How to use virtualenv
How to use Matplotlib
How to use iptables
How to use numpy
How to use TokyoTechFes2015
How to use venv
How to use dictionary {}
How to use Pyenv
How to use list []
How to use python-kabusapi
How to use OptParse
How to use return