Skip to content
This repository has been archived by the owner on Mar 15, 2021. It is now read-only.

Hello CatxFish... Any way to install OBS-virtual-cam on ubuntu? #17

Open
pixel-one opened this issue Nov 4, 2017 · 70 comments
Open

Hello CatxFish... Any way to install OBS-virtual-cam on ubuntu? #17

pixel-one opened this issue Nov 4, 2017 · 70 comments

Comments

@pixel-one
Copy link

Hello. Hope youre doing fine. I was reading your other post that you said obs works with genymotion. then i realized i can't even stream. I mean it was complicated. Then i found out that youre talking about obs-virtualcam but i have obs studio. are these 2 different softwares? Sorry im alittle noobish.
If not so can i install obs-virtual cam on linux? Or can i do teh same with on obs studio? I have obs studio but i dunno how to stream internal. i want to use it as genymotion camera . but obs studio wants to conenct to a server and wants server keys and such. so i cant start streaming even to test to see if genymotion detects teh cam or not.
Could you please help me? Thanks alot

@CatxFish
Copy link
Owner

CatxFish commented Nov 5, 2017

Hi , OBS-Virtualcam is a plugin of OBS-Studio on Windows, which means you have to install OBS-Studio first ,then install this project to get addition features , and it's only on windows. You can check in obs-studio plugins.

And since it is a lack of cross-platform solutions to simulate a device , the project dose not support linux or mac version now. But some simulators on Windows would transform the windows camera device to an inner camera ,like Genymotion.

I am sorry I can't provide a workable solution for you , but I do get an information about someone use v4l2loopback to do a virtual device trick on linux. I don't know how exactly this works, but maybe you can search in this way.

@paulerickson
Copy link

@pixel-one Here's a proof of concept using v4l2loopback on Ubuntu to get output from OBS into a virtual device. The performance is terrible, because of the fifo, and I was only able to detect the device in Firefox, not Chrome, due to some issue with "capabilities" metadata.
For better performance, you might try setting up a local RTMP proxy server with nginx; that's the best I could come up with, unless it's possible to write directly to some virtual file created by v4l.

Cheers!

# Install packages
sudo apt install v4l-utils v4l2loopback v4l2loopback-utils ffmpeg obs-studio

# Create loopback device
sudo modprobe v4l2loopback devices=1 card_label="loopback 1" exclusive_caps=1,1,1,1,1,1,1,1
# Note: Chrome doesn't detect this device; exclusive_caps is supposed to fix, but doesn't

# Create fifo to channel obs output to ffmpeg
mkfifo /tmp/pipe

# Open OBS, go to Settings->Output->Recording, set Type to "Custom Output (FFmpeg)", Container Format to "flv"; Apply and Start Recording
obs

# Send obs output to the virtual device
ffmpeg -re -f live_flv -i "/tmp/pipe" -f v4l2 /dev/video1

@pixel-one
Copy link
Author

pixel-one commented Nov 17, 2017

Thank you paulerickson . could you test it on Genymotion?
i get this error upon installing...
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package v4l2loopback

@paulerickson
Copy link

Sorry, I don't have that.

I originally did this on an older Ubuntu, so I think you can use v4l2loopback-dkms now. Also, I realized you can write to UDP, so

sudo apt install v4l-utils v4l2loopback-utils obs-studio v4l2loopback-dkms
sudo rmmod v4l2loopback #if you need to reload it for some reason
sudo modprobe v4l2loopback devices=1 card_label="loopback 1" exclusive_caps=1,1,1,1,1,1,1,1
ffmpeg -re -f live_flv -i udp://localhost:12345 -f v4l2 /dev/video1

And then in OBS "record to file" udp://localhost:12345 with flv. Other containers work too, some with worse latency, but I have had no luck with rawvideo.

@pixel-one
Copy link
Author

pixel-one commented Nov 17, 2017

Hello again, Thanks for teh help. I entered the commands and it stopped at third... Please have a look...
Thanks again for helping, I appreciate this really
none@none-Latitude:~$ sudo apt install v4l-utils v4l2loopback-utils obs-studio v4l2loopback-dkms [sudo] password for none: Reading package lists... Done Building dependency tree Reading state information... Done v4l2loopback-dkms is already the newest version. obs-studio is already the newest version. The following extra packages will be installed: libv4l2rds0 The following NEW packages will be installed: libv4l2rds0 v4l-utils v4l2loopback-utils 0 upgraded, 3 newly installed, 0 to remove and 17 not upgraded. Need to get 150 kB of archives. After this operation, 609 kB of additional disk space will be used. Do you want to continue? [Y/n] y Get:1 http://archive.ubuntu.com/ubuntu/ trusty/main libv4l2rds0 amd64 1.0.1-1 [15.9 kB] Get:2 http://archive.ubuntu.com/ubuntu/ trusty/universe v4l-utils amd64 1.0.1-1 [123 kB] Get:3 http://archive.ubuntu.com/ubuntu/ trusty/universe v4l2loopback-utils all 0.8.0-1 [11.0 kB] Fetched 150 kB in 5s (29.7 kB/s) Selecting previously unselected package libv4l2rds0:amd64. (Reading database ... 1514548 files and directories currently installed.) Preparing to unpack .../libv4l2rds0_1.0.1-1_amd64.deb ... Unpacking libv4l2rds0:amd64 (1.0.1-1) ... Selecting previously unselected package v4l-utils. Preparing to unpack .../v4l-utils_1.0.1-1_amd64.deb ... Unpacking v4l-utils (1.0.1-1) ... Selecting previously unselected package v4l2loopback-utils. Preparing to unpack .../v4l2loopback-utils_0.8.0-1_all.deb ... Unpacking v4l2loopback-utils (0.8.0-1) ... Processing triggers for man-db (2.6.7.1-1ubuntu1) ... Setting up libv4l2rds0:amd64 (1.0.1-1) ... Setting up v4l-utils (1.0.1-1) ... Setting up v4l2loopback-utils (0.8.0-1) ... Processing triggers for libc-bin (2.19-0ubuntu6.13) ... none@none-Latitude:~$ sudo rmmod v4l2loopback rmmod: ERROR: Module v4l2loopback is not currently loaded none@none-Latitude:~$ sudo modprobe v4l2loopback devices=1 card_label="loopback 1" exclusive_caps=1,1,1,1,1,1,1,1 modprobe: FATAL: Module v4l2loopback not found. none@none-Latitude:~$ sudo modprobe v4l2loopback devices=1 card_label="loopback 1" exclusive_caps=1,1,1,1,1,1,1,1 modprobe: FATAL: Module v4l2loopback not found. none@none-Latitude:~$ sudo rmmod v4l2loopback rmmod: ERROR: Module v4l2loopback is not currently loaded none@none-Latitude:~$

@paulerickson
Copy link

k, I didn't mean to confuse things — just skip the rmmod command, but that is how you would unload the module if you needed to recreate the device. If you can get this device to show up in Firefox (for instance, test at https://appr.tc/) but not in Genymotion, then I bet you'll need to figure out how those capability flags work (I have no clue).

@pixel-one
Copy link
Author

Thanks again Paul. I loaded up OBS after running this command.. ffmpeg -re -f live_flv -i udp://localhost:12345 -f v4l2 /dev/video1
Then tried to follow your post. and i dont understand this part .... >>>>

And then in OBS "record to file" udp://localhost:12345 with flv. Other containers work too, some with worse latency, but I have had no luck with rawvideo.

<<<<
Could you please explain again what do i do after i open OBS. i dont see record to file" in obs recording settong. .
Also i just entered your secong set of commands. I didnt do this one ..

mkfifo /tmp/pipe

. Could you please once more type all the steps in one post? I got confused which post to follow.
Thanks much

@paulerickson
Copy link

Forget about the fifo. You already did

sudo apt install v4l-utils v4l2loopback-utils obs-studio v4l2loopback-dkms
sudo modprobe v4l2loopback devices=1 card_label="loopback 1" exclusive_caps=1,1,1,1,1,1,1,1
ffmpeg -re -f live_flv -i udp://localhost:12345 -f v4l2 /dev/video1

So now go into OBS and click Settings. Click on the Output section, and then choose Advanced from the dropdown. Go to the Recording tab, change the Type to "Custom Output (ffmpeg)", and the FFmpeg Output Type to "Save to URL". In the "File path or URL" input, type "udp://localhost:12345" and choose "flv" from the Container format dropdown. Hit OK and then from the main screen try "Start Recording" (not "Start Streaming").

@pixel-one
Copy link
Author

Thank you again for your time. Here is 2 problem i get...
First when i enter the command""" sudo modprobe v4l2loopback devices=1 card_label="loopback 1" exclusive_caps=1,1,1,1,1,1,1,1 """" I get modprobe: FATAL: Module v4l2loopback not found.
And i ignore it so i contonue doing the next command and then open the OBS and i do the changes in setting too then when i click on start recording OBS hangs and closes fast... Here is teh logs in the terminal... ( Because i should open obs with this command " LIBGL_ALWAYS_SOFTWARE=1 obs"" otherwise it wont open. so anyway...
I get this error when ops crashes..
none@none-Latitude:~$ LIBGL_ALWAYS_SOFTWARE=1 obs Attempted path: share/obs/obs-studio/locale/en-US.ini Attempted path: /usr/share/obs/obs-studio/locale/en-US.ini Attempted path: share/obs/obs-studio/locale.ini Attempted path: /usr/share/obs/obs-studio/locale.ini Attempted path: share/obs/obs-studio/themes/Default.qss Attempted path: /usr/share/obs/obs-studio/themes/Default.qss Attempted path: share/obs/obs-studio/license/gplv2.txt Attempted path: /usr/share/obs/obs-studio/license/gplv2.txt info: CPU Name: Intel(R) Core(TM) i5 CPU M 560 @ 2.67GHz info: CPU Speed: 1599.000MHz info: Physical Cores: 2, Logical Cores: 4 info: Physical Memory: 7781MB Total, 357MB Free info: Kernel Version: Linux 4.4.0-98-generic info: Distribution: "Ubuntu" "14.04" info: Portable mode: false QMetaObject::connectSlotsByName: No matching signal for on_advAudioProps_clicked() QMetaObject::connectSlotsByName: No matching signal for on_advAudioProps_destroyed() info: OBS 20.1.0 (linux) info: --------------------------------- info: --------------------------------- info: audio settings reset: samples per sec: 44100 speakers: 2 info: --------------------------------- info: Initializing OpenGL... info: OpenGL version: 3.3 (Core Profile) Mesa 11.2.0 error: glGetIntegerv(GL_MAX_TEXTURE_ANISOTROPY_MAX) failed, glGetError returned 0x500 error: glGetIntegerv(GL_MAX_TEXTURE_ANISOTROPY_MAX) failed, glGetError returned 0x500 error: glGetIntegerv(GL_MAX_TEXTURE_ANISOTROPY_MAX) failed, glGetError returned 0x500 error: glGetIntegerv(GL_MAX_TEXTURE_ANISOTROPY_MAX) failed, glGetError returned 0x500 error: glGetIntegerv(GL_MAX_TEXTURE_ANISOTROPY_MAX) failed, glGetError returned 0x500 error: glGetIntegerv(GL_MAX_TEXTURE_ANISOTROPY_MAX) failed, glGetError returned 0x500 error: glGetIntegerv(GL_MAX_TEXTURE_ANISOTROPY_MAX) failed, glGetError returned 0x500 error: glGetIntegerv(GL_MAX_TEXTURE_ANISOTROPY_MAX) failed, glGetError returned 0x500 error: glGetIntegerv(GL_MAX_TEXTURE_ANISOTROPY_MAX) failed, glGetError returned 0x500 error: glGetIntegerv(GL_MAX_TEXTURE_ANISOTROPY_MAX) failed, glGetError returned 0x500 error: glGetIntegerv(GL_MAX_TEXTURE_ANISOTROPY_MAX) failed, glGetError returned 0x500 error: glGetIntegerv(GL_MAX_TEXTURE_ANISOTROPY_MAX) failed, glGetError returned 0x500 error: glGetIntegerv(GL_MAX_TEXTURE_ANISOTROPY_MAX) failed, glGetError returned 0x500 error: glGetIntegerv(GL_MAX_TEXTURE_ANISOTROPY_MAX) failed, glGetError returned 0x500 error: glGetIntegerv(GL_MAX_TEXTURE_ANISOTROPY_MAX) failed, glGetError returned 0x500 error: glGetIntegerv(GL_MAX_TEXTURE_ANISOTROPY_MAX) failed, glGetError returned 0x500 error: glGetIntegerv(GL_MAX_TEXTURE_ANISOTROPY_MAX) failed, glGetError returned 0x500 error: glGetIntegerv(GL_MAX_TEXTURE_ANISOTROPY_MAX) failed, glGetError returned 0x500 error: glGetIntegerv(GL_MAX_TEXTURE_ANISOTROPY_MAX) failed, glGetError returned 0x500 error: glGetIntegerv(GL_MAX_TEXTURE_ANISOTROPY_MAX) failed, glGetError returned 0x500 info: --------------------------------- info: video settings reset: base resolution: 680x420 output resolution: 680x420 downscale filter: Bicubic fps: 30/1 format: NV12 info: Audio monitoring device: name: Default id: default info: --------------------------------- libDeckLinkAPI.so: cannot open shared object file: No such file or directory info: No blackmagic support error: glTexParameteri failed, glGetError returned 0x500 error: device_load_texture (GL) failed info: VLC found, VLC video source enabled info: --------------------------------- info: Loaded Modules: info: vlc-video.so info: text-freetype2.so info: rtmp-services.so info: obs-x264.so info: obs-transitions.so info: obs-outputs.so info: obs-libfdk.so info: obs-filters.so info: obs-ffmpeg.so info: linux-v4l2.so info: linux-pulseaudio.so info: linux-jack.so info: linux-decklink.so info: linux-capture.so info: linux-alsa.so info: image-source.so info: frontend-tools.so info: --------------------------------- info: ==== Startup complete =============================================== info: All scene data cleared info: ------------------------------------------------ error: glGetIntegerv(GL_MAX_TEXTURE_ANISOTROPY_MAX) failed, glGetError returned 0x500 error: glTexParameteri failed, glGetError returned 0x500 error: device_load_texture (GL) failed error: glTexParameteri failed, glGetError returned 0x500 error: device_load_texture (GL) failed info: pulse-input: Server name: 'pulseaudio 4.0' error: pulse-input: An error occurred while getting the source info! info: pulse-input: Server name: 'pulseaudio 4.0' error: pulse-input: An error occurred while getting the source info! info: [Media Source 'Media Source']: settings: input: /home/none/Videos/WPS Pixie Dust Attack Manual RalinkBroadcom (OLDER).mp4 input_format: (null) is_looping: no is_hw_decoding: yes is_clear_on_media_end: yes restart_on_activate: yes close_when_inactive: no info: Switched to scene 'Scene' info: ------------------------------------------------ info: Loaded scenes: info: - scene 'Scene': info: - source: 'Media Source' (ffmpeg_source) info: - scene 'Scene 2': info: ------------------------------------------------ info: adding 92 milliseconds of audio buffering, total audio buffering is now 92 milliseconds error: glTexParameteri failed, glGetError returned 0x500 error: device_load_texture (GL) failed error: glTexParameteri failed, glGetError returned 0x500 error: device_load_texture (GL) failed info: ==== Recording Start =============================================== Segmentation fault (core dumped) none@none-Latitude:~$

@MikkoMMM
Copy link

MikkoMMM commented May 1, 2018

Since I couldn't get it to work with the webcam, I also tried it without setting up my webcam to make things simpler.

I have File path or URL set to "udp://localhost:12345" and Container Format as flv. I do these steps:

[mikko@localhost lvdata]$ sudo rmmod v4l2loopback
[mikko@localhost lvdata]$ sudo modprobe v4l2loopback devices=1 card_label="loopback 1" exclusive_caps=1,1,1,1,1,1,1,1
[mikko@localhost lvdata]$ ffmpeg -re -f live_flv -i udp://localhost:12345 -f v4l2 /dev/video0
ffmpeg version 3.4.2 Copyright (c) 2000-2018 the FFmpeg developers
  built with gcc 7.3.0 (GCC)
  configuration: --prefix=/usr --disable-debug --disable-static --disable-stripping --enable-avisynth --enable-avresample --enable-fontconfig --enable-gmp --enable-gnutls --enable-gpl --enable-ladspa --enable-libass --enable-libbluray --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libiec61883 --enable-libmodplug --enable-libmp3lame --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libv4l2 --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxcb --enable-libxml2 --enable-libxvid --enable-shared --enable-version3 --enable-omx
  libavutil      55. 78.100 / 55. 78.100
  libavcodec     57.107.100 / 57.107.100
  libavformat    57. 83.100 / 57. 83.100
  libavdevice    57. 10.100 / 57. 10.100
  libavfilter     6.107.100 /  6.107.100
  libavresample   3.  7.  0 /  3.  7.  0
  libswscale      4.  8.100 /  4.  8.100
  libswresample   2.  9.100 /  2.  9.100
  libpostproc    54.  7.100 / 54.  7.100

Then I start recording in OBS.

However, none of ffplay, Cheese or Chromium seem to recognize the stream.

[mikko@localhost lvdata]$ ffplay /dev/video0
ffplay version 3.4.2 Copyright (c) 2003-2018 the FFmpeg developers
  built with gcc 7.3.0 (GCC)
  configuration: --prefix=/usr --disable-debug --disable-static --disable-stripping --enable-avisynth --enable-avresample --enable-fontconfig --enable-gmp --enable-gnutls --enable-gpl --enable-ladspa --enable-libass --enable-libbluray --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libiec61883 --enable-libmodplug --enable-libmp3lame --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libv4l2 --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxcb --enable-libxml2 --enable-libxvid --enable-shared --enable-version3 --enable-omx
  libavutil      55. 78.100 / 55. 78.100
  libavcodec     57.107.100 / 57.107.100
  libavformat    57. 83.100 / 57. 83.100
  libavdevice    57. 10.100 / 57. 10.100
  libavfilter     6.107.100 /  6.107.100
  libavresample   3.  7.  0 /  3.  7.  0
  libswscale      4.  8.100 /  4.  8.100
  libswresample   2.  9.100 /  2.  9.100
  libpostproc    54.  7.100 / 54.  7.100
[video4linux2,v4l2 @ 0x7f0144000b80] Not a video capture device.
/dev/video0: No such device
    nan    :  0.000 fd=   0 aq=    0KB vq=    0KB sq=    0B f=0/0

Have you got any ideas on this?

@notfood
Copy link

notfood commented May 20, 2018

This solution used to work but v4l2 updated and now I'm getting this error

[v4l2 @ 0x55d4d1400fc0] ioctl(VIDIOC_G_FMT): Invalid argument
Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument
Error initializing output stream 0:0 -- 
Conversion failed!```

Any ideas?

@notfood
Copy link

notfood commented Jun 3, 2018

It was due to this issue. Ignore me.

umlaeute/v4l2loopback#172

@CatxFish
Copy link
Owner

I make a experimental repository for this feature.

Repository owner deleted a comment from andraanyana Aug 24, 2018
@grigio
Copy link

grigio commented Feb 7, 2019

I get this crash

Stream mapping:
  Stream #0:1 -> #0:0 (flv1 (flv) -> rawvideo (native))
Press [q] to stop, [?] for help
[v4l2 @ 0x563fbb7b3cc0] ioctl(VIDIOC_G_FMT): Invalid argument
Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument
Error initializing output stream 0:0 --

@tsankuanglee
Copy link

@CatxFish Is it possible to make use of https://github.com/webcamoid/akvcam , which is used as webcamoid's virtual webcam?

@CatxFish
Copy link
Owner

@tsankuanglee
Maybe it will work if it implement all the v4l2 standard the output plugin need.
I really don't know, why wouldn't you try yourself and share your result?

@tsankuanglee
Copy link

Reporting back about akvcam I mentioned above:

However, I can't get the latency below 5 seconds in either method.

@CatxFish, the reason I mentioned akvcam is that webcamoid has very low latency, so I wonder whether there's a way to do the same in your obs-v4l2sink can. I wish I knew enough about this to contribute.

@tsankuanglee
Copy link

OK, I made some progress and got the latency down to less than 0.5 sec. Quite practical for real-time streaming. Steps:

  1. Create a V4L2 virtual cam with akvcam. Let's say it's /dev/video2 (for capturing). (I used udev rule to make it /dev/video0 so it's the first choice for software that only supports the first device, but we don't need to do this here.)

  2. In OBS Settings -> output -> Recording, set type to Custom Output (FFmpeg), Output to URL, and use file:///dev/video2 as the URL. Container set to rawvideo (Video), and the codec also set to rawvideo.

Since akvcam works fine with this line,
ffmpeg -i video.webm -s 640x480 -r 30 -f v4l2 -vcodec rawvideo -pix_fmt rgb24 /dev/video2

I added video_size=640x480 framerate=30 pixel_format=rgb24 as the Video Encoder Settings. (according to ffmpeg's format doc).

Audio should automatically be disabled.

(Side note: Some times rawvideo (Video) doesn't show up in Container Format drop down. I have no idea why. My trial and error workaround: choose Null as the container, and rawvideo as the encoder. Apply. Quit OBS. Re-open OBS. Now it's in the menu. A bug?)

Now the latency is low, but the resolution is wrong. There are 3x2 of my output in the receiving end. Like this:
3x2 output

I feel we are closer. Hopefully this is the right direction, and somebody can figure this out.

@josephsamela
Copy link

I don't like changing the recording settings because then I can't stream while recording to disk simultaneously. Here's a solution that allows both.

First install the software.

sudo apt install v4l-utils v4l2loopback-utils obs-studio v4l2loopback-dkms

Create a loopback video device - for example loopback 1.

sudo modprobe v4l2loopback devices=1 card_label="loopback 1" exclusive_caps=1,1,1,1,1,1,1,1

Start ffmpeg as an rtmp server passing video to the loopback 1 video device you just created.

ffmpeg -f flv -listen 1 -i rtmp://localhost:1935/live/test -f v4l2 -vcodec rawvideo /dev/video1

Finally, configure obs to stream to the rtmp server you just created.

image

Now loopback 1 shows up as a video device. Here's it working in discord - there's ~2sec latency.

screen

@tsankuanglee
Copy link

@josephsamela Good job!

I pursued the akvcam route because that gave me a <0.5s latency, which doesn't create too big a problem for audio-video syncing, which is essential for video conferencing. However, I got stuck at that the 6 screen problem mentioned above.

Did you figure out a way to deal with the audio sync problem with this method?

I do have a simple workaround under Linux that works for me in video conferencing, although it's resource heavy.
http://blog.tklee.org/2019/04/streaming-custom-videos-in-google.html

@xxRockOnxx
Copy link

Successfully managed to use OBS stream as a webcam source on Linux (Arch to be specific).

First, add another device using modprobe:

sudo modprobe v4l2loopback devices=1 video_nr=1 card_label="RTMP server" exclusive_caps=1

To understand what the parameters are, just see the original documentation.

I put video_nr=1 because /dev/video0 is already used by Droidcam which allows an android device to be used as a webcam. exclusive_caps "seems" to be required also to be detected by browsers

Second, start an RTMP server using ffmpeg forwarding the output to /dev/video1

ffmpeg -listen 1 -i rtmp://127.0.0.1:1935/live -f v4l2 -vcodec rawvideo /dev/video1

Note: I tried @josephsamela's answer first and was confused why it was not working. For some reason OBS can't find localhost but can access 127.0.0.1

Third, use the created RTMP server (rtmp://127.0.0.1:1935/live) and start streaming on your OBS..

If your application does not find the new virtual device, try restarting it.

@shalkam
Copy link

shalkam commented Jun 25, 2019

@josephsamela Your solution is working perfectly, but the image is flipped horizontally

@shalkam
Copy link

shalkam commented Jun 25, 2019

fixed by adding -vf hflip

ffmpeg -f flv -listen 1 -i rtmp://localhost:1935/live/test -vf hflip -f v4l2 -vcodec rawvideo /dev/video0

@KishCom
Copy link

KishCom commented Jul 15, 2019

Thanks to the excellent work of @josephsamela I was able to replicate his setup and get latency down to around 1 second.

ffmpeg -an -probesize 32 -analyzeduration 0 -listen 1 -i rtmp://localhost:1935/live/test -f v4l2 -vcodec rawvideo /dev/video2

I believe the issue is that FFMPEG does a bunch of stuff after the stream starts but before it starts to push out to /dev/videoX -- part of which is it analyzes the stream to figure out how it's encoded. I decreased the amount of time it tries to do that (-probesize 32 -analyzeduration 0), but ideally: how can this probe be disabled? We know the incoming stream. Secondly, disabling audio altogether (-an). For our purposes we only care about video.

@nweldev
Copy link

nweldev commented Jul 24, 2019

After having tried a lot of different approaches, I never managed to get latency under ~1s... And I think it's impossible, due to some limitations with ffmpeg.

But, latency around 1s isn't really a big issue by itself for video conferencing (for me), as we often see people with bigger network latency. It's problematic only because it makes the sound out of sync with the video. So, why not also use the sound from OBS Studio!

Here is the alias I use for that:

alias obscam="sudo modprobe v4l2loopback devices=1 video_nr=10 card_label=\"OBS Cam\" exclusive_caps=1 \
    && sudo modprobe snd-aloop index=10 id=\"OBS Mic\" \
    && pacmd 'update-source-proplist alsa_input.platform-snd_aloop.0.analog-stereo device.description=\"OBS Mic\" ' \
    && ffmpeg -probesize 32 -analyzeduration 0 -listen 1 -i rtmp://127.0.0.1:1935/live/test -map 0:1 -f v4l2 -vcodec rawvideo /dev/video10 -map 0:0 -f alsa hw:10,1"

And here is the full step-by-step (on Arch Linux):

0. install required packages

sudo pacman -S obs-studio v4l-utils
git clone https://aur.archlinux.org/v4l2loopback-dkms.git
cd v4l2loopback-dkms
makepkg -scCi

1. add a virtual webcam

sudo modprobe v4l2loopback devices=1 video_nr=10 card_label="OBS Cam" exclusive_caps=1

👉 #17 (comment) for parameters details - I use video_nr=10 in order to always avoid conflict

2. add a virtual audio card

sudo modprobe snd-aloop index=10 id="OBS Mic"

Here, again, I use index=10 in order to avoid any conflict with existing sound cards, and id="OBS Mic" in order to identify it more easily in VC softs & pavucontrol.

👉 ArchLinux doc
👉 Module-aloop doc

3. rename your new mic

By default, the new sound card is named "Built-in Audio Analog Stereo" is pulse audio, which makes it complicated to differentiate it from your real build-in sound card in pavucontrol, chrome, or any VC software.

pacmd 'update-source-proplist alsa_input.platform-snd_aloop.0.analog-stereo device.description=\"OBS Mic\" '

👉 https://unix.stackexchange.com/questions/316067/change-what-pulseaudio-calls-a-device

4. Configure OBS

❓ I'm new to OBS, so if any of you think some other settings would permit to reduce latency...

  1. set streaming server

⚠️ same thing than #17 (comment): use 127.0.0.1, not localhost

image

  1. streaming output settings

image

  1. enable your mic

image

5. test streaming

❓ any better solution for that? I don't know how to use ffprobe for this kind of use case.

  1. run a "test" ffmpeg server
ffmpeg -an -probesize 32 -analyzeduration 0 -listen 1 -i rtmp://127.0.0.1:1935/live/test -f v4l2 -vcodec rawvideo /dev/video10
  1. start streaming in OBS Studio

image

  1. look at ffmpeg output and identify which streams are used by audio & video
Stream #0:0: Audio: aac, 44100 Hz, stereo, 163 kb/s
Stream #0:1: Video: h264 (Constrained Baseline), yuv420p, 1280x720, 2560 kb/s, 30 fps, 30 tbr, 1k tbn, 60 tbc
  1. stop the ffmpeg server & stop streaming in OBS Studio

6. run the (real) ffmpeg server

ffmpeg -probesize 32 -analyzeduration 0 -listen 1 -i rtmp://127.0.0.1:1935/live/test -map 0:1 -f v4l2 -vcodec rawvideo /dev/video10 -map 0:0 -f alsa hw:10,1

-map permits to differenciate audio and video streams.

👉 ffmpeg advanced options
👉 ffmpeg wiki Map page

7. start streaming in OBS

8. sync audio & video

ℹ️ FYI, I'm also using IP Webcam with my Galaxy S8 here, which add ~400ms delay. So, the real delay to consider here should be the one between your mic and your webcam. For me, it's around ~200ms but you can assume it's near 0 for you. There is a good chance you don't need this step if you only need to use OBS as a webcam + mic.

Do some tests (for example using https://webcamera.io and clapping).

A. sound ahead of video

Change your mic sync offset accordingly:
image

Advanced Audio Properties

image

B. video ahead of sound

  1. right-click on the video source > filters
  2. click on + > select Video Delay (async)
  3. set your delay value

image

@MikkoMMM
Copy link

@noelmace The video stream works fine, but I'm having trouble getting desktop audio to play in my stream in addition to microphone audio after following your steps and making a script for ones that need to be redone:

#!/bin/bash -u

sudo modprobe snd-aloop index=9 id="OBS Mic"
pacmd update-source-proplist alsa_input.platform-snd_aloop.0.analog-stereo device.description=\"OBS Mic\"
ffmpeg -probesize 32 -analyzeduration 0 -listen 1 -i rtmp://127.0.0.1:1935/live -map 0:1 -f v4l2 -vcodec rawvideo /dev/video9 -map 0:0 -f alsa hw:9,1

Under Advanced Audio Properties I've put both sources to output only to track one. I've also tried having the tracks with Monitor and Output. The desktop audio should be unmuted as well, and I do see the bars in Audio Mixer fluctuating when there's desktop audio.

Do you have any ideas? Also, my webcam image comes from a DSLR's live view with another script, but I'm doubting it has anything to do with this.

@MikkoMMM
Copy link

Hmm, wait. The desktop audio does seem to work now in the stream. Weird, this thing. Well, if the issue returns maybe I'll get better understanding of what is causing it.

@hjacobs
Copy link

hjacobs commented Mar 16, 2020

After trying suggestions in this thread (ffmpeg etc), I found that the "v4l2-sink" plugin works flawlessly (~0 latency) on Ubuntu 19.10 for my use case (Google Meet). Here the blog post about my setup: https://srcco.de/posts/using-obs-studio-with-v4l2-for-google-hangouts-meet.html

@MikkoMMM
Copy link

@hjacobs Seems to work on Arch Linux as well, though it doesn't magically resolve the latency of (I believe) getting the image from my DSLR's live view to the computer, so it remained at around 300 milliseconds which it was also with the ffmpeg method. And I still needed to use ffmpeg for rerouting the audio output from OBS to a new virtual device.

@KovalevArtem
Copy link
Contributor

obsproject/rfcs#15

@dszryan
Copy link

dszryan commented May 5, 2020

Setup Description

  1. running arch linux host
  2. running windows 10 guest
  3. to the output/live steam you want to add
    • the windows 10 guest's speaker and video output (eg: your want to stream the video+audio for your xbox based jackbox games)
    • the linux hosts mic and camera output (so that people can see you and hear you in the stream as well)

Solution Description

  1. setup an audio loopback device
    • configure the loopback speaker as 'OBS Speaker', this will capture the output of the windows guest
    • configure the mic as 'OBS Mic'; this will be the live stream device
  2. have a headset connected to the linux host
    • this will function as the monitor device for the steam feed
    • you will be able to hear the windows 10 guest and your mic output on this device
    • do NOT monitor on a speaker, HAS TO BE A HEADSET (to avoid a positive feedback loop)

Setup Steps:

NOTE: the order of the steps is CRITICAL.

0. Install the following packages

  • obs-studio
  • v4l-utils
  • v4l2loopback-dkms (aur package; dkms will require linux-headers installed)
  • obs-v4l2sink (aur package)

1. Connect physical hardware

  • this is where you ensure your monitor headset and the physical mic you want to use and connected to the linux host
  • and they are functioning properly
    • you can hear audio and in the headset
    • the mic is picking up sounds
  • if your devices don't show after connecting them or they are not functioning properly
    • run the following command (as the stream user) and then close/reopen the sound setting window
    • "systemctl --user restart pulseaudio.service"

2. Setup virtual loop back device

  • as root:
    • modprobe v4l2loopback devices=1 video_nr=10 card_label="OBS Cam" exclusive_caps=1 #ref here for instructions to bake it into the initial ramdisk
    • modprobe snd-aloop index=10 id="OBS Mic"
  • as the stream user (the non-elevated normal user):
    • pacmd 'update-source-proplist alsa_input.platform-snd_aloop.0.analog-stereo device.description="OBS Mic"'
    • pacmd 'update-sink-proplist alsa_output.platform-snd_aloop.0.analog-stereo device.description="OBS Speaker"'
    • ffmpeg -probesize 32 -analyzeduration 0 -listen 1 -i rtmp://127.0.0.1:1935/live -map 0:1 -f v4l2 -vcodec rawvideo /dev/video10 -map 0:0 -f alsa hw:10,1 #(if you have installed obs-v4l2sink, will not encode the video through ffmpeg)
    • ffmpeg -probesize 32 -analyzeduration 0 -listen 1 -i rtmp://127.0.0.1:1935/live -map 0:0 -f alsa hw:10,1 #(but we need it to mux the audio streams)

3. Configure the linux host

  • go the system sounds menu (Note: I am using gnome, at the time of writing this it is v3.26.2)
  • select the following devices
    • OUTPUT: "Analog Output - Built-in Audio", this is your loopback "OBS Speaker" device, for some reason gnome does not show the device description
    • INPUT: your preferred connected physical mic you want to use

4. Start the windows 10 guest

  • this will automatically route the audio to the "OBS Speaker" since it is your default audio device
  • do NOT be concerned if you are not able to hear it now - this is by design
  • if you are using virtualbox, install the extensions pack (this will permit USB pass-through for the xbox controller wired to the linux host)
  • if you are using qemu/kvm (which I am, since it has much better performance on the linux host), ensure you:
    • setup the spice guest tools in the windows 10 guest (https://www.spice-space.org/download.html)
    • setup a spice channel on the linux host, under the config for the win10 guest (this will permit the audio through to the host)
    • also ensure you have setup a USB redirect for the xbox controller connected to the linux host

5. OBS Settings [the important part]

  • You are now ready to start OBS on your linux host (if you had some audio issue before this point - safer to just restart OBS now)
  • Run the auto configuration wizard (need to this step only once)
    • optimise for streaming, the resolution and fps your physical hardware can handle
    • Server will be "rtmp://127.0.0.1:1935/live"
    • Stream key will be [any dummy value] - it cannot be blank
    • I am using "prefer hardware encoding" - since I have an nvidia card that can handle it
    • and estimate the bitrate with bandwidth test - this will ensure they audio/video do not have a large lag (if wrong the audio will lead the video by 6-7 seconds)
  • Now open the setting window and set the following (might need to repeat this step if your physical h/w was disconnected since the last time you ran obs)
    • Steam (this should be already configured by the tuning wizard)
      • Server: rtmp://127.0.0.1:1935/live
      • Key: [can be blank]
    • Output
      • this should be already configured by the tuning wizard, leave as is
    • Audio (this is the bit that can shuffle around)
      • Desktop Audio => OBS Speaker
      • Mic/Auxillary Audio => Default
      • Mic/Auxillary Audio 2 => OBS Mic
      • Monitor Device => Monitor of [your connected headset]
    • Video
      • Ensure the "Output (Scaled) Resolution" is one of the dropdown values with an aspect ratio of 16/9
      • otherwise, discord/zoom will not show the OBS virtual device/s as a functional camera feed

6. Audio Mixer Setting

  • Click the cog for any of the audio mixer bars and select "Advanced Audio Properties"
  • for the Mic/Aux 2, setup audio monitoring as "Monitor Only (mute output)"

7. Video Sources

  • Capture the Windows 10 guest as a "Window Capture (Xcomposite)"
    • worth a mention, you can view 4k content in the windows 10 guest via qemu/kvm (not so with Virtualbox)
  • Capture your camera as a "VLC Capture Device (V4L2)"

8. Start steaming

  • Go Tools -> V4L2 Video Output and set path to "/dev/video10" and format as "YUV420" and start it (do this step if you are using obs-v4l2sink)
  • We are not ready to start streaming now, so click the "Start Streaming" button (at the very least we need for the audio mux)

9. Check output levels on the monitor device/headset

  • Run some audio from the window 10 guest and speak as well, adjust the audio level now before starting the live feed
  • if you are using obs-v4l2sink your video could lead your sound now (i have noticed a 40ms lead on the sound from the windows guest, I am yet to find a fix for it)

10. Go Live

  • Discord:
    • INPUT DEVICE: OBS MIC
    • OUTPUT DEVICE: [your monitor headset]
    • CAMERA: OBC Cam
  • Zoom:
    • SPEAKER: [your monitor headset]
    • MIC: OBS Mic
    • CAMERA: OBS Cam
  • You now have set up where
    • you hear what you are steaming, namely the windows 10 guest + your mic + what your audience is saying
    • your audience can hear the window 10 guest and yourself
    • there will be no positive feedback loop, provided your audience is using a headset as well

11. ???

12. Profit

@pinheirof
Copy link

Hi, I am trying run OBS with virtual cam on Ubuntu 20.04. Followed this https://srcco.de/posts/using-obs-studio-with-v4l2-for-google-hangouts-meet.html.

However, need to run sudo modprobe v4l2loopback devices=1 video_nr=10 card_label="OBS Cam" exclusive_caps=1 every time I need to use OBS with virtual cam. Otherwise, I see a message "device open failed". Besides, it's not 100% certain that running modprobe OBS will work properly.

Any idea what I'm doing wrong? Btw, newbie here.

@tsankuanglee
Copy link

tsankuanglee commented Jul 4, 2020

@pinheirof the command you run creates a virtual cam via a kernel module. You should only need it once per boot (unless you remove that virtual cam via sudo rmmod v42loopback). video_nr=10 is the cam number, so if you run the same command again, it may cause an error because of the number conflict.

@pinheirof
Copy link

@pinheirof the command you run creates a virtual cam via a kernel module. You should only need it once per boot (unless you remove that virtual cam via sudo rmmod v42loopback). video_nr=10 is the cam number, so if you run the same command again, it may cause an error because of the number conflict.

But wasn't /dev/video10 supposed to be there every time a turn on my pc?

For example, when I reboot the system and run v4l2-ctl --list-devices, v4l2loopback isn't there.

@pinheirof
Copy link

@tsankuanglee , my point is: why isn't the /dev/video10, created by v4l2loopback, a permanent device in my machine?

@tsankuanglee
Copy link

modprobe is a dynamic command. To make it permanent, you can either run that command in your boot sequence, or add it to modprobe.d (see https://wiki.archlinux.org/index.php/Kernel_module#Using_files_in_/etc/modprobe.d/ )

@leoherzog
Copy link

@pinheirof @tsankuanglee

I've tried adding

options v4l2loopback devices=1 video_nr=10 card_label="OBS Virtualcam" exclusive_caps=1

to /etc/modprobe.d/virtualcam.conf, then running sudo update-initramfs -c -k $(uname -r). When I reboot, I still get a Device open failed error in OBS and have to run the modprobe command by manually. Can anyone advise, what is the format of the modprobe.d conf file?

@dszryan
Copy link

dszryan commented Jul 17, 2020

@pinheirof @tsankuanglee

I've tried adding

options v4l2loopback devices=1 video_nr=10 card_label="OBS Virtualcam" exclusive_caps=1

to /etc/modprobe.d/virtualcam.conf, then running sudo update-initramfs -c -k $(uname -r). When I reboot, I still get a Device open failed error in OBS and have to run the modprobe command by manually. Can anyone advise, what is the format of the modprobe.d conf file?

i have the same issue, saw the message and did some more reading. realised the following.

i am using module as a dkms. so may be the fix would be to install the device via a kernel parameter https://wiki.archlinux.org/index.php/Kernel_module#Using_kernel_command_line_2

and the use to udev to initialize the other required options

will try and test it on the weekend, when i have time for a lot of reboots.

@dszryan
Copy link

dszryan commented Jul 17, 2020

@pinheirof @tsankuanglee

I've tried adding

options v4l2loopback devices=1 video_nr=10 card_label="OBS Virtualcam" exclusive_caps=1

to /etc/modprobe.d/virtualcam.conf, then running sudo update-initramfs -c -k $(uname -r). When I reboot, I still get a Device open failed error in OBS and have to run the modprobe command by manually. Can anyone advise, what is the format of the modprobe.d conf file?

the working solution was a LOT simpler. decided to bake the module into the initial ramdisk with the following config.
excerpt from /etc/mkinitcpio.conf below.

MODULES=(v4l2loopback)
FILES=(/etc/modprobe.d/v4l2loopback.conf)

NB: need to bake in the config as well. hence the inclusion in the files. also, this has worked on Arch Linux, not sure how or if it will work on ubuntu.

@tsankuanglee
Copy link

@leoherzog Did you add a file /etc/modules-load.d/v4l2loopback.conf with the content:

v4l2loopback

as described in the automatic loading section?

@leoherzog
Copy link

@tsankuanglee That was it, thanks 🙌

/etc/modprobe.d/v4l2loopback.conf:

options v4l2loopback devices=1 video_nr=10 card_label="OBS Virtualcam" exclusive_caps=1

/etc/modules-load.d/v4l2loopback.conf:

v4l2loopback

@claudemontreal
Copy link

Hi, I am trying run OBS with virtual cam on Ubuntu 20.04. Followed this https://srcco.de/posts/using-obs-studio-with-v4l2-for-google-hangouts-meet.html.

However, need to run sudo modprobe v4l2loopback devices=1 video_nr=10 card_label="OBS Cam" exclusive_caps=1 every time I need to use OBS with virtual cam. Otherwise, I see a message "device open failed". Besides, it's not 100% certain that running modprobe OBS will work properly.

Any idea what I'm doing wrong? Btw, newbie here.

When trying to follow these instructions, I got "device open failed" in OBS.

When following other instructions, no error messages, but nothing would stream.

Any help please? Any step by step instructions for Ubuntu/Mint that really works?

@MarioMey
Copy link

MarioMey commented Aug 7, 2020

@claudemontreal, maybe, that tutorial doesn't "really work" in your computer/system. There is no magic tutorial to make things work in every computer.

You did follow that tutorial...

  • Everything went right?
  • Did you install v4l2loopback-dkms or did you compile it?
  • Did you compile obs-v4l2sink?
  • After running modproble, was there any error message?
  • If not, is /video10 in /dev path?
  • By using VLC, can you see that device in the list?
  • If yes, did you try different resolutions (in OBS) and different Video Formats (in obs-v4l2sink)?

@claudemontreal
Copy link

I can't find where to look in VLC to check if it detects the device.

Firefox does detect Dummy cam (0x0000) but nothing is streaming.

@MarioMey
Copy link

MarioMey commented Aug 7, 2020

imagen

@claudemontreal
Copy link

@claudemontreal, maybe, that tutorial doesn't "really work" in your computer/system. There is no magic tutorial to make things work in every computer.

You did follow that tutorial...

* Everything went right?

* Did you install v4l2loopback-dkms or did you compile it?

Not sure, I did so many steps over and over again, following different tutorials. I may have tried both ways.

* Did you compile obs-v4l2sink?

I've installed it, but don't remember if it was by compiling or not.

* After running modproble, was there any error message?

no, no message at all.

* If not, is /video10 in /dev path?

I'm not sure what that means.

* By using VLC, can you see that device in the list?

I can't see that window in VLC. When I click on playlist, like you did, it doesn't pop up.

* If yes, did you try different resolutions (in OBS) and different Video Formats (in obs-v4l2sink)?

I tried all the formats. Only NV12 format seems supported, all the others give me an error message.

@MarioMey
Copy link

MarioMey commented Aug 7, 2020

Not sure, I did so many steps over and over again, following different tutorials. I may have tried both ways.
I've installed it, but don't remember if it was by compiling or not.

IMO, when you are lost by installing, removing, compiling... and you get no achievement, you have to start over again, from scratch. So, you will know what you are doing, step by step.

  • If not, is /video10 in /dev path?

I'm not sure what that means.

Do ls /dev. You have to see /video10 there. If it is not there, v4l2loopback module is not installed.

I can't see that window in VLC. When I click on playlist, like you did, it doesn't pop up.

You open that window by clicking on "Open Capture Device" on menu or Ctrl-C.

I tried all the formats. Only NV12 format seems supported, all the others give me an error message.

So, is NV12 working? Why do you say "seems supported"?

I think this is not the place to discuss this... or is it? This is obs-virtual-cam issues page...

@claudemontreal
Copy link

Ok deleted all the packages in Synaptic, starting everything over.

I follow this tutorial: https://www.youtube.com/watch?v=Eca509IDLdM

1-I install OBS though command line following their instructions on obsproject.com
https://obsproject.com/wiki/install-instructions#linux

2-git clone https://github.com/umlaeute/v4l2loopback.git

3-cd v4l2loopback
make
make && sudo make install
sudo modprobe v4l2loopback

4-ls/dev/video*
It gives me:
/dev/video0 /dev/video1 /dev/video2

5-Open OBS, go in tools. See the option is not there.

6-It's not in the video tutorial, author forgot a step, but I remember installing obs-v4l2sink so I go here: https://github.com/CatxFish/obs-v4l2sink
git clone --recursive https://github.com/obsproject/obs-studio.git
git clone https://github.com/CatxFish/obs-v4l2sink.git
cd obs-v4l2sink
mkdir build && cd build
cmake -DLIBOBS_INCLUDE_DIR="../../obs-studio/libobs" -DCMAKE_INSTALL_PREFIX=/usr ..
make -j4
sudo make install

7-Open OBS again. Choose my desktop as source. Go in tools. I now see V4L2 video output

8-Path: /dev/video2, video format NV12, click start

9-With Firefox, I go to https://www.onlinemictest.com/fr/webcam-test/
It asks me to choose a camera. I choose Dummy video device (0x0000)

And same problem than before. Nothing streams. Stuck at the same place again.

@MarioMey
Copy link

MarioMey commented Aug 8, 2020

Recommendations/suggestions:

  • Use sudo modprobe v4l2loopback devices=1 video_nr=10 card_label="OBS Cam" exclusive_caps=1. This will create /dev/video10 with name and an option that someone said that it is necessary to use with Chrome (browse).
  • Try with Chrome or Chromium. In spite that onlinemitest just worked for mi in Firefox, I had troubles to put OBS in a browser. With Chromium I had no problems and/or a good performance.
  • Don't you have any other application to test video? VLC, Cheese, Guvcview, etc.
  • At the first time I use this plugin, I go around for hourse until discovered that it didn't work in FullHD, just HD or less. But you already said that you tried with different resolutions...
  • Look at OBS messages in console. For this, launch OBS in a terminal and you will see if there is any error.

@claudemontreal
Copy link

Recommendations/suggestions:

* Use `sudo modprobe v4l2loopback devices=1 video_nr=10 card_label="OBS Cam" exclusive_caps=1`. This will create /dev/video10 with name and an option that someone said that it is necessary to use with Chrome (browse).

* Try with Chrome or Chromium. In spite that onlinemitest just worked for mi in Firefox, I had troubles to put OBS in a browser. With Chromium I had no problems and/or a good performance.

* Don't you have any other application to test video? VLC, Cheese, Guvcview, etc.

* At the first time I use this plugin, I go around for hourse until discovered that it didn't work in FullHD, just HD or less. But you already said that you tried with different resolutions...

* Look at OBS messages in console. For this, launch OBS in a terminal and you will see if there is any error.

I just tried with Chrome. It doesn't let me choose which webcam to use and just uses my PC webcam, or it doesn't seem to identify or detect OBS Cam.

In Firefox, it's still not working with that command line. It sees the OBS cam but it doesn't stream anything.

If I select device10 with VLC, it gives me this in the terminal:
[00005581eceebb40] main playlist: playlist is empty
Segmentation error (core dumped)

No error messages for OBS.

@MarioMey
Copy link

MarioMey commented Aug 9, 2020

Sorry, man. I can't help you more. I suggest to report your problem as an issue in obs-v4l2sink github. You better post all process you do to (try to) make it work and all the messages you receive in console. Maybe someone from there can help you more than me.

Good luck.

@floeschie
Copy link

It seems the build system does not quite adjust to the different paths on different distributions (and may different obs-devel versions). On Fedora 31 I had to do the following, which might help some folks: change external/FindLibObs.cmake as follows (look at the changed include):

All I had to do was:

sudo dnf install obs-studio-devel

and then proceed with the cmake command.

@webfischi
Copy link

webfischi commented Jan 11, 2021

Ok deleted all the packages in Synaptic, starting everything over.

I follow this tutorial: https://www.youtube.com/watch?v=Eca509IDLdM

1-Install OBS through command line following their instructions on obsproject.com
https://obsproject.com/wiki/install-instructions#linux

2-git clone https://github.com/umlaeute/v4l2loopback.git

3-cd v4l2loopback
make
make && sudo make install
sudo modprobe v4l2loopback

4-ls/dev/video*
It gives me:
/dev/video0 /dev/video1 /dev/video2

5-Open OBS, go in tools. See the option is not there.

6-It's not in the video tutorial, author forgot a step, but I remember installing obs-v4l2sink so I go here: https://github.com/CatxFish/obs-v4l2sink
git clone --recursive https://github.com/obsproject/obs-studio.git
git clone https://github.com/CatxFish/obs-v4l2sink.git
cd obs-v4l2sink
mkdir build && cd build
cmake -DLIBOBS_INCLUDE_DIR="../../obs-studio/libobs" -DCMAKE_INSTALL_PREFIX=/usr ..
make -j4
sudo make install

7-Open OBS again. Choose my desktop as source. Go in tools. I now see V4L2 video output

8-Path: /dev/video2, video format NV12, click start

9-With Firefox, I go to https://www.onlinemictest.com/fr/webcam-test/
It asks me to choose a camera. I choose Dummy video device (0x0000)

And same problem than before. Nothing streams. Stuck at the same place again.

Seems like this guide needs an update:

1-I install OBS though command line following their instructions on obsproject.com
https://obsproject.com/wiki/install-instructions#linux

2-git clone https://github.com/umlaeute/v4l2loopback.git

3-cd v4l2loopback
sudo apt install libc6-dev
make
sudo make install

4-launch obs-studio

5-click the new "start virtual camera" button that appeared

6-enter password

Now you can select OBS Virtual Cam in every application

@kqvanity
Copy link

i had to install linux headers , then install v412loopback.deb file .... then just simply start the virtualcam

@webfischi
Copy link

webfischi commented Jan 18, 2021

It stopped working for me after a kernal update. When I tried to install it, I got a missing System.map skipping depmod error, which seems like a Linux headers issue first, but it actually is a Linux kernel module SSL error. To fix this issue type:

sudo depmod
sudo modprobe v4l2loopback
sudo make all install clean

Then it should work again.

@aryapramudika
Copy link

Ok deleted all the packages in Synaptic, starting everything over.
I follow this tutorial: https://www.youtube.com/watch?v=Eca509IDLdM
1-Install OBS through command line following their instructions on obsproject.com
https://obsproject.com/wiki/install-instructions#linux
2-git clone https://github.com/umlaeute/v4l2loopback.git
3-cd v4l2loopback
make
make && sudo make install
sudo modprobe v4l2loopback
4-ls/dev/video*
It gives me:
/dev/video0 /dev/video1 /dev/video2
5-Open OBS, go in tools. See the option is not there.
6-It's not in the video tutorial, author forgot a step, but I remember installing obs-v4l2sink so I go here: https://github.com/CatxFish/obs-v4l2sink
git clone --recursive https://github.com/obsproject/obs-studio.git
git clone https://github.com/CatxFish/obs-v4l2sink.git
cd obs-v4l2sink
mkdir build && cd build
cmake -DLIBOBS_INCLUDE_DIR="../../obs-studio/libobs" -DCMAKE_INSTALL_PREFIX=/usr ..
make -j4
sudo make install
7-Open OBS again. Choose my desktop as source. Go in tools. I now see V4L2 video output
8-Path: /dev/video2, video format NV12, click start
9-With Firefox, I go to https://www.onlinemictest.com/fr/webcam-test/
It asks me to choose a camera. I choose Dummy video device (0x0000)
And same problem than before. Nothing streams. Stuck at the same place again.

Seems like this guide needs an update:

1-I install OBS though command line following their instructions on obsproject.com
https://obsproject.com/wiki/install-instructions#linux

2-git clone https://github.com/umlaeute/v4l2loopback.git

3-cd v4l2loopback
sudo apt install libc6-dev
make
sudo make install

4-launch obs-studio

5-click the new "start virtual camera" button that appeared

6-enter password

Now you can select OBS Virtual Cam in every application

how to change device name "VirtualCam OBS"?

@aryapramudika
Copy link

many platform like OME blocked VirtualCam OBS name, how to solve?

@MarioMey
Copy link

MarioMey commented Jan 22, 2021

how to change device name "VirtualCam OBS"?

Here it is: https://github.com/obsproject/obs-studio/blob/master/plugins/linux-v4l2/v4l2-output.c#L56

@aryapramudika
Copy link

how to change device name "VirtualCam OBS"?

Here it is: https://github.com/obsproject/obs-studio/blob/master/plugins/linux-v4l2/v4l2-output.c#L56

Thx u :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests