Everyone is welcome here (except, of course, those who have borrowed books from me for and have not returned them yet 😉)

How to create a video podcast under Linux

Posted on septembre 30, 2020 in computer-science

Setup

Installation

Sound

  • Plug your microphone and make sure it is selected as the input device in System's Settings/Sound. Alternatively, you can use the Pulse Audio Volume Control (command: pavucontrol) which provides more control.

  • Test the volume and recording quality, either with the audacity sound editor, or with the commands:

    parec --file-format=wav test.wav  # Press Ctrl-C to stop the recording 
    paplay test.wav
    

Note: It is possible to improve the audio quality by installing a noise and echo cancellation kernel module for pulseaudio (check out this post. An alternative would be to replace pulseaudio with JACK audio Connection Kit which permits to add realtime sound filters)

Video

Here, rather than using a webcam, we will use a real Camera to record the video.
The instructions below are just a summary of the article How to use your DSLR Camera as a Webcam In Linux

  1. Make sure the following softwares are installed:

    sudo apt-get install gphoto2 v4l2loopback-utils v4l2loopback-dkms ffmpeg
    
  2. Load the video4linux kernel module:

    sudo modprobe v4l2loopback exclusive_caps=1 max_buffers=2
    
  3. Attach the Camera to a USB port, and check that it is recognized:

    gphoto2 --abilities
    
  4. IMPORTANT: unmount the Camera manually in Nautilus (in theory gio mount -s gphoto2 should do the trick, but it does not work for me)

  5. Check if video recording works:

    gphoto2 --capture-movie  # Press `Ctrl-C` to stop recording 
    mplayer movie.mjpg
    
  6. locate the video device:

    v4l2-ctl --list-devices
    VIDEO_OUT=$( v4l2-ctl --list-devices | grep -A 1 loopback | tail -1  )
    
  7. You are now ready to capture the video stream:

    gphoto2 --stdout --capture-movie | ffmpeg -i - -vcodec rawvideo -pix_fmt yuv420p -threads 0 -f v4l2 $VIDEO_OUT
    

You can open the video device in Cheese or VLC to monitor the video stream.

OBS

Launch obs and add the following three Sources:

  • Screen Capture (XSHM)
  • Video Capture Device (V4L2)
  • Audio Input Capture (PulseAudio)

You may have to click on each source to set up some parameters such as resolution, select the right microphone input, etc.

Place the Screen and Video Capture on the canvas (see https://obsproject.com/wiki/OBS-Studio-Overview#scenes-and-sources)

Press Start Recording

That's all folks!