Recording application video with sound: Alsa + Recordmydesktop

How to capture video from an application with the sound?

Don’t know if it’s by default, but in my Xubuntu, only a sound from the microphone can be recorded. This link came with help: https://trac.ffmpeg.org/wiki/Capture/ALSA. How to do the same with a recordmydesktop application:

  1. Create .asoundrc file in Your home directory like in mentioned webpage:
    # .asoundrc
    # uncomment to record audio from applications. uncomment afterwards to
    # restore default Alsa settings:
    # pcm.!default { type plug slave.pcm "hw:Loopback,0,0" }
    

    When the last line is uncommented, there will be no sound for every application launched from that moment, because generally it’s redirected to the recording output.

  2. Load the snd_aloop module:
    modprobe snd-aloop pcm_substreams=1
    
  3. Launch an application, from which the video will be captured. Check it’s window id with xwinfo and by pointing application’s window:
    xwininfo | grep 'id:'
    
  4. Invoke recordmydesktop with hw:Loopback,1,0 as a sound device. PID will be needed to send signal to stop recording (‘& echo$!’)
    recordmydesktop --windowid [application wid] --device
    hw:Loopback,1,0 --v_quality 45 --s_quality 7 --overwrite & echo $!
    
  5. Stop recording by sending SIGTERM signal:
    kill -s SIGTERM [recordmydesktop PID]
    
  6. Uncomment line in .asoundrc file to restore Alsa settings.

Leave a Reply

Your email address will not be published. Required fields are marked *