4 ms·
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 end
by gary-kim 7y ago
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 https://github.com/umlaeute/v4l2loopback
- Biganon 7y agoAre 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...
- madars 7y agoI 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.
- gary-kim 7y agoI 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.
- jsilence 7y agoCould you detail on how you are creating the ffmpeg streaming endpoint? That would be very heplful!
- chme 7y agoI don't know exactly what you mean, but I would use something like this: https://github.com/arut/nginx-rtmp-module https://github.com/arut/nginx-rtmp-module
- gary-kim 7y agoPersonally, 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.