Hacker News new | ask | show | jobs
by jameshe 2271 days ago
I use OBS Studio with OBS-VirtualCam [0] to attend virtual lectures & hold meetings for my team. I've found it to be incredibly convenient because you can control nearly everything with scenes and the audio controls.

Before meetings start, I can broadcast music and display announcements, and then without having to hit a jarring "End Screenshare" can switch to my webcam and start a meeting. Live demos and presentations are another scene with the desktop/window/browser and webcam. 100% would recommend.

[0] https://github.com/CatxFish/obs-virtual-cam

2 comments

I'm doing something similar on Linux, although a bit more complicated.

I'm using v4l2loopback [0] to create a dummy video device, ffmpeg to create a stream endpoint that streams into the dummy video device, then setting up OBS to stream to localhost.

It is actually really nice to have the capability to fully control what is going in to the video input.

I haven't run into a need to also change the audio input yet but if it becomes necessary, it should be possible to set up loopback with ALSA.

[0] https://github.com/umlaeute/v4l2loopback

Are you using this with zoom, by any chance? I had no luck trying to capture my Webcam with ffmpeg, add text to it with ffmpeg, and output everything to a fake Webcam with video4linux. Actually, it works perfectly well, but this particular stream I can't open with zoom, even though zoom will accept it perfectly if instead of my Webcam, I add text to a video file.

I suppose zoom detects that my actual Webcam is in use, and therefore refuses to display... any webcam whatsoever, including the virtual one...? Makes little sense but maybe...

I have not tried it with Zoom but Chrome refused to recognize any loopback video devices unless they were capture-only. So the following worked:

    # modprobe -r v4l2loopback
    # modprobe v4l2loopback video_nr=7 exclusive_caps=1 card_label='Screenshare'
where exclusive_caps=1 is the work-around for Chrome (both video_nr for /dev/video7 and card_label should be able to be set to ~arbitrary values). You need to first start writing stream to the loopback device and then it would switch itself into a capture-only device and Chrome will recognize it.
I use it with Zoom as well and haven't had a problem with it. I haven't tried using pure ffmpeg to output to the dummy device though.
Could you detail on how you are creating the ffmpeg streaming endpoint? That would be very heplful!
Personally, the command I use is this:

  # Replace `/dev/video2` with the dummy video device added by `l4v2loopback`.
  ffmpeg -re -listen 1 -i rtmp://127.0.0.1:5050/ -c:v rawvideo -an -pix_fmt yuv420p -f v4l2 /dev/video2

After starting ffmpeg, you set up OBS to stream to a custom streaming server at`rtmp://127.0.0.1:5050` and start streaming.

It's not very efficient and there's a delay since OBS is encoding with h264 then ffmpeg is decoding that. It's not too bad for me because I can use the NVENC encoder but I'm sure there's a way to get OBS to stream raw video somehow.

I don't know exactly what you mean, but I would use something like this: https://github.com/arut/nginx-rtmp-module
how are you getting desktop audio (music or whatever) to get sent to your meetings? I didn't see how to expose the audio output from obs as a "microphone" or whatever to video conferencing software. I ended up hacking my setup together with voicemeeter but it's pretty sloppy and error prone.
Pipewire [0] (the successor to PulseAudio) attempts to streamline this process for Linux. I've been messing with wf-recorder [1] for my screen+audio recordings, and might try to get it to spoof a camera input so I can get any program attempting to connect to the webcam to instead turn into a screen-casting tool.

[0]: https://en.wikipedia.org/wiki/PipeWire

[1]: https://github.com/ammen99/wf-recorder

At least in my case, I haven't had to configure anything. Perhaps it's included in OBS VirtualCam? (see my original post)
JACK audio or ALSA monitor device
Tip: zoom doesn't list pulseaudio monitors in the available sources, and trying to set zoom's input to anything manually from pavucontrol fails silently (even if zoom is set to "use system default" or whatever it's called).

The only way I found to stream audio to zoom is to use a pulseaudio module that lets you use a named pipe as a source. You can then output your sound to said named pipe, and set it as the microphone in zoom. The sound is pretty bad of course.

Have you tried PulseAudio's module-virtual-source? https://news.ycombinator.com/item?id=22754216
Are there any "virtual usb" devices, something like a software usb gadgets to emulate a webcam so that software will have to special knowledge of these alternative sources?