---
title: "How to use a camera as a webcam on linux"
date: "2020-03-31"
---


![Sony a7R II](pic.jpg)

When working from home it's important to have the best image quality when doing video chats.

It turns out you can use a high quality camera (DSLR, mirrorless camera, etc) as a webcam. The strategy is to use [gphoto2 and v4l2loopback](https://superuser.com/questions/870768/can-i-use-my-dslr-as-webcam-through-gphoto2-v4l2loopback).

You can get [v4l2loopback on github](https://github.com/umlaeute/v4l2loopback). It is also available as an AUR package on Arch Linux.

Meanwhile, [gphoto2](http://www.gphoto.org/) should be packaged with most linux distributions.

Anyway, here are the commands I use:

```bash
sudo modprobe v4l2loopback devices=1 exclusive_caps=1 card_label="pupcam"
gphoto2 --stdout --capture-movie | ffmpeg -i - -vcodec rawvideo -pix_fmt yuv420p -f v4l2 /dev/video0
```
