-
Notifications
You must be signed in to change notification settings - Fork 345
Hello CatxFish... Any way to install OBS-virtual-cam on ubuntu? #17
Comments
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. |
@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. 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 |
Thank you paulerickson . could you test it on Genymotion? |
Sorry, I don't have that. I originally did this on an older Ubuntu, so I think you can use 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. |
Hello again, Thanks for teh help. I entered the commands and it stopped at third... Please have a look... |
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). |
Thanks again Paul. I loaded up OBS after running this command.. 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.<<<< mkfifo /tmp/pipe . Could you please once more type all the steps in one post? I got confused which post to follow. |
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"). |
Thank you again for your time. Here is 2 problem i get... |
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:
Then I start recording in OBS. However, none of ffplay, Cheese or Chromium seem to recognize the stream.
Have you got any ideas on this? |
This solution used to work but v4l2 updated and now I'm getting this error
|
It was due to this issue. Ignore me. |
I make a experimental repository for this feature. |
I get this crash
|
@CatxFish Is it possible to make use of https://github.com/webcamoid/akvcam , which is used as webcamoid's virtual webcam? |
@tsankuanglee |
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. |
OK, I made some progress and got the latency down to less than 0.5 sec. Quite practical for real-time streaming. Steps:
Since akvcam works fine with this line, I added Audio should automatically be disabled. (Side note: Some times Now the latency is low, but the resolution is wrong. There are 3x2 of my output in the receiving end. Like this: I feel we are closer. Hopefully this is the right direction, and somebody can figure this out. |
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.
Create a loopback video device - for example
Start ffmpeg as an rtmp server passing video to the
Finally, configure obs to stream to the rtmp server you just created. Now |
@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. |
Successfully managed to use OBS stream as a webcam source on Linux (Arch to be specific). First, add another device using
To understand what the parameters are, just see the original documentation. I put Second, start an RTMP server using ffmpeg forwarding the output to
Note: I tried @josephsamela's answer first and was confused why it was not working. For some reason OBS can't find Third, use the created RTMP server If your application does not find the new virtual device, try restarting it. |
@josephsamela Your solution is working perfectly, but the image is flipped horizontally |
fixed by adding
|
Thanks to the excellent work of @josephsamela I was able to replicate his setup and get latency down to around 1 second.
I believe the issue is that FFMPEG does a bunch of stuff after the stream starts but before it starts to push out to |
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:
And here is the full step-by-step (on Arch Linux): 0. install required packages
1. add a virtual webcam
👉 #17 (comment) for parameters details - I use 2. add a virtual audio card
Here, again, I use 👉 ArchLinux doc 3. rename your new micBy 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.
👉 https://unix.stackexchange.com/questions/316067/change-what-pulseaudio-calls-a-device 4. Configure OBS
5. test streaming
6. run the (real) ffmpeg server
👉 ffmpeg advanced options 7. start streaming in OBS8. 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: Advanced Audio Properties B. video ahead of sound
|
@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:
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. |
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. |
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 |
@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. |
Setup Description
Solution Description
Setup Steps:NOTE: the order of the steps is CRITICAL. 0. Install the following packages
1. Connect physical hardware
2. Setup virtual loop back device
3. Configure the linux host
4. Start the windows 10 guest
5. OBS Settings [the important part]
6. Audio Mixer Setting
7. Video Sources
8. Start steaming
9. Check output levels on the monitor device/headset
10. Go Live
11. ??? 12. Profit |
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. |
@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 |
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 |
@tsankuanglee , my point is: why isn't the /dev/video10, created by v4l2loopback, a permanent device in my machine? |
|
I've tried adding
to |
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. |
the working solution was a LOT simpler. decided to bake the module into the initial ramdisk with the following config.
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. |
@leoherzog Did you add a file
as described in the automatic loading section? |
@tsankuanglee That was it, thanks 🙌
|
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? |
@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...
|
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. |
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.
no, no message at all.
I'm not sure what that means.
I can't see that window in VLC. When I click on playlist, like you did, it doesn't pop up.
I tried all the formats. Only NV12 format seems supported, all the others give me an error message. |
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.
Do
You open that window by clicking on "Open Capture Device" on menu or Ctrl-C.
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... |
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 2-git clone https://github.com/umlaeute/v4l2loopback.git 3-cd v4l2loopback 4-ls/dev/video* 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 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/ And same problem than before. Nothing streams. Stuck at the same place again. |
Recommendations/suggestions:
|
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: No error messages for OBS. |
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. |
All I had to do was:
and then proceed with the |
Seems like this guide needs an update: 1-I install OBS though command line following their instructions on obsproject.com 2-git clone https://github.com/umlaeute/v4l2loopback.git 3-cd v4l2loopback 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 |
i had to install linux headers , then install v412loopback.deb file .... then just simply start the virtualcam |
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 Then it should work again. |
how to change device name "VirtualCam OBS"? |
many platform like OME blocked VirtualCam OBS name, how to solve? |
Here it is: https://github.com/obsproject/obs-studio/blob/master/plugins/linux-v4l2/v4l2-output.c#L56 |
Thx u :) |
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
The text was updated successfully, but these errors were encountered: