Tip: how to share any video on a Jitsi session

It’s possible to share a Youtube video on Jitsi but if you want to share a video from another source…?

I have tried some tricks on my Debian Buster client and I can stream a high quality video/audio to a Jitsi room. It’s possible to use an MP4 file or a stream from an IP camera or an RTMP/RTSP stream or data from a video/audio capture card as a source.

These are the steps in summary:

  • create a virtual camera
  • create a virtual microphone
  • send the video data to the virtual camera and the audio data to the virtual microphone while playing the video using ffmpeg
  • open chromium, join a Jitsi room, select the virtual camera and the virtual microphone

packages

Install the following packages as root

apt-get install v4l2loopback-dkms ffmpeg

modules

Load the following modules as root

modprobe v4l2loopback video_nr=100 card_label=virtualcam-100 exclusive_caps=1
modprobe snd-aloop id=aloop100

Use the following command to check the result. The output can be a bit different in your case.

ls /dev/video*
>>> /dev/video0  /dev/video1  /dev/video100

ls /proc/asound
>>> aloop100  card0  card1  cards ...

virtual microphone

Switch to your desktop user account, you don’t need to be root from now on.

First, find your snd_aloop input device name

pactl list sources short | grep alsa_input | grep snd_aloop | awk '{print $2}'
>>> alsa_input.platform-snd_aloop.0.analog-stereo

And create a virtual microphone using this device name.

pacmd load-module module-remap-source source_name=mic100 master=alsa_input.platform-snd_aloop.0.analog-stereo source_properties=device.description=mic100 channels=2

Check your source list again, there should be a new device named as mic100

pactl list sources short
>>> ...
>>> 4    mic100  module-remap-source.c   s16le 2ch 44100Hz       RUNNING

virtual camera

No need to do anything for the virtual camera. It’s created when loading the v4l2loopback module.

ffmpeg

It’s possible to use any source as long as ffmpeg supports it. I will use an MP4 file in my example. The order of the video/audio channels may be different for some sources. Change the map parameters if this is the case

ffmpeg -re -i parabellum.mp4 -map 0:0 -f v4l2 -c:v rawvideo /dev/video100 -map 0:1 -f alsa hw:aloop100,1

stream to the Jitsi room

Open chromium or chrome and join a Jitsi room. Disable the audio processing because the audio will be clean most probably. The link will be something like that:

https://meet.jit.si/parabellum#config.disableAP=true

Choose the virtual camera (virtualcam-100) and the virtual microphone (mic100). Join the same room using a second tab to see the result. Don’t select the virtual devices on the second tab.

4 Likes

If you made something wrong and want to reset the sound devices

pulseaudio -k

And restart chromium