mirror of
https://github.com/Brandon-Rozek/website.git
synced 2024-11-25 17:46:32 -05:00
New Posts
This commit is contained in:
parent
5b8aee2c97
commit
2945159b41
2 changed files with 71 additions and 0 deletions
36
content/blog/fakewebcam.md
Normal file
36
content/blog/fakewebcam.md
Normal file
|
@ -0,0 +1,36 @@
|
|||
---
|
||||
title: "V4l2 Webcam"
|
||||
date: 2020-05-25T23:49:08-04:00
|
||||
draft: false
|
||||
tags: []
|
||||
---
|
||||
|
||||
In Linux you can create a fake webcam by making use of the `v4l2loopback` kernel module.
|
||||
|
||||
To install,
|
||||
|
||||
```bash
|
||||
sudo apt install v4l2loopback-dkms
|
||||
```
|
||||
|
||||
If you already had an existing module, remove it so we can customize it.
|
||||
|
||||
```bash
|
||||
sudo modprobe -r v4l2loopback
|
||||
```
|
||||
|
||||
Then create the file `/etc/modprobe.d/fakecam.conf` and add the following line
|
||||
|
||||
```
|
||||
options v4l2loopback devices=1 video_nr=20 card_label=fakecam exclusive_caps=1
|
||||
```
|
||||
|
||||
The value of `video_nr` must be larger than the amount of cameras in your system. I wouldn't have more than 10 webcams plugged into my system, so I set it to 20.
|
||||
|
||||
Then load back up the kernel module
|
||||
|
||||
```bash
|
||||
sudo modprobe v4l2loopback
|
||||
```
|
||||
|
||||
Now when you open up Chrome, Skype, etc, you should see a new device labeled "fakecam".
|
35
content/blog/obswebcam.md
Normal file
35
content/blog/obswebcam.md
Normal file
|
@ -0,0 +1,35 @@
|
|||
---
|
||||
title: "OBS Webcam"
|
||||
date: 2020-05-25T23:53:56-04:00
|
||||
draft: false
|
||||
tags: []
|
||||
---
|
||||
|
||||
[Open Broadcaster Software](https://obsproject.com/) is a great piece of software for recording and live streaming different video content. It would be nice to use the same level of professional software in video calling software as well.
|
||||
|
||||
Now there already exists a [OBS plugin](https://github.com/CatxFish/obs-v4l2sink) for this purpose, but it does require recompiling OBS with this plugin. This post will outline a possible technique to get around this, at a cost of performance.
|
||||
|
||||
To see discussion around this topic, check out this [Github thread](https://github.com/CatxFish/obs-virtual-cam/issues/17).
|
||||
|
||||
OBS has two different options, streaming and recording. Since I want the ability to record a high fidelity version of my feed, we will use streaming to push video to a local RTMP server. This local RTMP server will then re-encode the video to a [v4l2 video device](https://brandonrozek.com/blog/fakewebcam/).
|
||||
|
||||
We will use `ffmpeg` as our RTMP server
|
||||
|
||||
```bash
|
||||
ffmpeg -hwaccel vdpau -fflags nobuffer -listen 1 -i rtmp://localhost:12345/live/app/ -f v4l2 /dev/video20
|
||||
```
|
||||
|
||||
| Flag | Description |
|
||||
| ------------------ | ------------------------------------------------------------ |
|
||||
| `-hwaccel vdpau` | (Optional) Allows `ffmpeg` to use GPU for acceleration |
|
||||
| `-fflags nobuffer` | Tells `ffmpeg` to not bother buffering the video and work with the latest frame possible. |
|
||||
| `-listen 1` | Starts a server to listen for video. |
|
||||
|
||||
Then from OBS you will want to use the Auto-Configuration wizard to have it figure out the right set of parameters to use for the lowest latency. Once that is set you can hit the stream button and you are all set to use the fake video device for your calls! Depending on your hardware, you might notice a few seconds of latency.
|
||||
|
||||
To quickly verify that you can see your OBS video from the video device.
|
||||
|
||||
```bash
|
||||
ffplay -fflags nobuffer /dev/video20
|
||||
```
|
||||
|
Loading…
Reference in a new issue