Online teaching and home office with Linux

The measurements taken due to COVID-19 requires teachers to switch to online teaching methods. Here is a collection of solutions, limitations and workarounds for online teaching with Linux.

Update 2020-05-02. Updates on the VLC-based window sharing.

Update 2020-04-14. Add remark on accessing webcam from to applications.

Update 2020-04-04. Add some further reading.

Update 2020-03-30. Add some further reading.

Update 2020-03-23. Teams supports screen sharing for Linux users.

Update 2020-03-18. Add remark on obs-v4l2sink.

Update 2020-03-16. Add how-to on streaming with OBS to youtube or twitch

Update 2020-03-16. Add how-to on offline screen recordings.

Update 2020-03-15. Add how-to on virtual camera for screen casting, e.g., for Teams.

Update 2020-03-14. Add how-to on dual-monitor screen sharing.


At Salzburg University of Applied Sciences we use Moodle as e-Learning platform, so I will restrict the following discussions on technology that complements Moodle.

IRC chat

Initially, I preferred to provide IRC online chats parallel to video conferences for lectures to let students ask questions. OFTC provides a simple webchat that allows people to simply choose a nickname and a channel name, that’s it.

The reasons why I like IRC are:

  • IRC is very low on resource requirements and a 30 years old technology which makes it a good backup communication channel when audio/video conference channels would not last.
  • There is practically no entry hurdle, no requirement to create accounts, install software, whatsoever and it is based on FOSS.
  • Power users can still install IRC software like weechat or HexChat or others.

In the meanwhile Teams and other video conferencing platforms work quite reliable, so this IRC is pretty much unused, but could still serve as an backup.

OBS and streaming to Youtube or Twitch

OBS (Open Broadcast Software) is a quite simple but powerful software to record and stream videos. You can choose one or multiple sources – e.g., screen captures, webcams, overlay text – and stream and/or record the result live to a service like Youtube or Twitch. (Note that you need to wait 24 hours after registering a Youtube channel.)

You can very easily choose one display to be captured, display yourself from a webcam in a little box and move it to a corner, and add some overlay text, if you wish. If you use KDE/plasma then you may have to deactivate the OpenGL compositor if you observe flickering in the recordings.

Giving a lecture at 1920x1080 resolution with CBR can be done with about 2000 kb/s. You can also record the stream and put it online for offline watching later. Streaming providers often can store the broadcast for some period, like 14 days.

However, video streaming is only suitable for lectures, but not for a lab setting as you cannot interact with people like with a video conference software as Google Meet, Microsoft Teams or Zoom: They cannot share their screen and there is a lag of a few seconds on the stream. (There are settings on youtube to reduce this lag.)

But you can actually use OBS with video conferencing software, i.e., recording with OBS and streaming to Teams or Meet: You install the obs-v4l2sink plugin and let OBS stream into a virtual camera, see below. (You can find a Gentoo ebuild for this plugin on my overlay.)

In any case, however, you can take questions from IRC or from chats provided by the streaming service, see above.

Google Meet

Google Hangouts Meet is a video communication service and the successor the classic Hangouts. I will use it to give lectures by sharing my screen. On my screen I can give all kind presentations or showcase stuff. All the students need is a browser and a link that I share with them via e-mail or other channels.

It works with Linux, Mac and Windows running Firefox, Chrome, Edge or Safari. The teacher pretty much requires a G Suite account such that up to 250 people1 can attend.

Microsoft Teams

Microsoft Teams is a collaboration platform and the successor of Skype for Business. It can be used to create scheduled or ad-hoc meetings with video conferencing. Students need to have accounts on the Teams platform and then can join a team on which a video conference can be carried out. This constitutes a certain hurdle, but at the same time could substitute also certain features of Moodle.2

Teams can be run from a browser, but only with Google Chrome and Microsoft Edge3 (which is based on Chrome). For instance, Teams does not support video for Firefox and Safari.

Giving and taking control of shared content is only supported using the Teams desktop client. There is a Linux client in a preview version and can be downloaded in DEB and RPM format for x86-64 architectures. However, Linux users cannot share their screen or a window so far. In the meanwhile, also Linux users can share their screen and single windows. In addition, below you find an explanation on how to setup a virtual camera with v4l2loopback and allows for a more elaborate setup, e.g., in conjunction with OBS.

The Microsoft Team service went down on Mon March 16 and the following days, when a huge load of people went to home office due to corona. But after the first week it seems to have stabilized.

All in all, Teams is not very inclusive: It requires students and teachers to have an account on a platform and either install a specific client of have a specific browser. All in all, Teams appears to be a lock-in solution, which comes at no surprise.

Sharing screens with dual-monitor setup

For online lecturing a dual-monitor setup is quite convenient. You can have the presentation running on one display and an IRC chat, notes or whatever running on the other display.

Unfortunately, Firefox and Chrome4 can only show either the entire screen (both displays) or a single window5. The trick is now to have a dummy window that just displays the content of the desired screen and have this dummy window shared instead. What people now do (here, here) is to use VLC, which allows to “play” part of the screen and have the VLC window shared by the browser.

If you have two 1920x1080 pixel monitors and you may share your right display then you may start VLC in your terminal like this:

vlc --no-video-deco --no-embedded-video \
    --screen-fps=20 \
    --screen-top=0 --screen-left=1920 --screen-width=1920 \
    screen://

On Debian system you need the package vlc-plugin-access-extra for vlc. After having VLC started you want to move the VLC window away from the display you record. Do not make the VLC window smaller, otherwise you reduce the resolution of your recordings.

A more elegant solution using cvlc has been posted by Peter Meerwald:

cvlc --no-video-deco --no-embedded-video \
     --screen-fps=20 \
     --screen-top=0 --screen-left=0 --screen-width=1920 --screen-height=1080 \
     screen://

Screen sharing with v4l2loopback

The v4l2loopback kernel module provides a virtual camera, i.e., a virtual /dev/videoX loopback device. All common video conferencing solutions can read from video devices /dev/videoX, so all we need is another piece of software that uses /dev/videoX as sink:

# Creates a video device, e.g., /dev/video2
sudo modprobe v4l2loopback
# Captures the screen as video stream and dumps it at /dev/video2
#   -s WxH           The size of the captured area
#   -i :0.0+X,Y      The display 0.0 and the offset X and Y of the catpured area
#   -r 20            Frame rate
#   scale=1280:720   Teams did not work for me otherwise
ffmpeg -f x11grab -s 1920x1080 -i :0.0+1920,0 \
       -r 20 -vf "scale=1280:720,format=pix_fmts=yuv420p" \
       -f v4l2 /dev/video2

Google Meet and Microsoft Teams show the video stream with a horizontal flip, but the users do not see their stream flipped! (You could add the video filter hflip, so you see it correct, but your participants won’t.)

Microsoft Teams did not work for me if I did not scale the video stream down to 720p. Note that also Google Meet would send only 720p or 360p streams, but it would not fail if the stream would have higher resolution.

Accessing webcam from two applications

Assume that you want to provide your webcam to a video conferencing software (e.g., Teams) and to OBS to produce lecture recordings at the same time. In Linux two applications cannot consume the same webcam data stream by opening the same device like /dev/video0.

However, with v4l2loopback we can create two virtual cameras and feed both with the data of the original camera using ffmpeg:

# Load two virtual camera devices
sudo modprobe v4l2loopback devices=2
# Use ffmpeg to read from the physical webcam /dev/video0 and duplicate the
# output to the two virtual cameras /dev/video{2,3}
ffmpeg -f video4linux2 -s 1280x720 -i /dev/video0 \
       -f v4l2 /dev/video2 -f v4l2 /dev/video3

Of course, one could now do all kind of transformations on the way, like scaling or applying various filters known to ffmpeg.

Offline recording of screen captures

Instead of live video conferencing one may want to provide offline recordings of a presentation on the screen with audio and host them somewhere. Using ffmpeg one can quite easily do so:

# Record audio over pulseaudio and dump output to output.mp4. For the other
# options see the listings above.
ffmpeg -f x11grab -s 1920x1080 -i :0.0+1920,0 \
       -r 30 -f pulse -ac 2 -i default lecture.mp4

After recording your lecture you can post-process them with the Avidemux, Kdenlive or others. However, for this scenario OBS is probably the better solution, at least for recording, see above.

Pulseaudio microphone quality

On my Lenovo T460s I observed that the built-in microphone shows a quite good quality while my Bose QuietComfort 20 over the audio jack had some significant noise. But there is a reasonable chance that this can be fixed by a pulseaudio setting. In my case I simple set avoid-resampling = true in /etc/pulse/daemon.conf and restarted pulseaudio.

Further reading

  • A tutorial (ger) to give digitally sustainable conferences with free software by student group #gnuHU at the Humboldt University Berlin.

  • An article (ger) on secure free software for group communication by Erich Moechel.

  • An article by the EFF on privacy impacts of online tools during the COVID-19 crisis.

  • An article on compliance levels of video conferencing solutions regarding data protection by noyb.

  1. 100 members for G Suite Basic, 150 for G Suite Business and 250 for G Suite Enterprise. However, classic Hangout video calls only allow up to 10 participants. 

  2. Of course, this monolithic design violates the UNIX philosophy and well know principles of software engineering, which appears to be typical for Microsoft and companies that inherit the Microsoft way of doing software. 

  3. Microsoft Edge that is not based on Chrome is only partially supported. 

  4. There seems to be a fix on the way for Chrome. 

  5. Menus, dialogs, popup windows are windows on their own and are not shared.