dotfiles

My collection of dotfiles
git clone git://git.noxz.tech/dotfiles
Log | Files | Refs

ffmpeg-record-screen-audio-with-alsa.md (883B)


      1 How To: record screen with audio (loopback) using ffmpeg
      2 ========================================================
      3 
      4 + add snd-aloop to modules:
      5 
      6 	sudo modprobe snd-aloop pcm_substreams=1
      7 
      8 + edit /etc/asound.conf to record loopback (this will disable audio output):
      9 
     10 	echo 'pcm.!default { type plug slave.pcm "hw:Loopback,0,0" }' >> \
     11 	/etc/asound.conf
     12 
     13 + alternatively) "record audio from an application while alsa routing the audio 
     14 to an output device: https://trac.ffmpeg.org/wiki/Capture/ALSA
     15 
     16 + start the actual recording. (The example above will record a 1280x1080 
     17 portion of the screen 0.0 from the coordinates 0,0 using the ALSA audio 
     18 hardware 'Loopback,1,0'):
     19 
     20 	ffmpeg -video_size 1280x1080 -framerate 25 -f x11grab -i :0.0+0,0 -f alsa \
     21 	-ac 2 -ar 44100 -i hw:Loopback,1,0 output.mkv
     22 
     23 + when done, remove the line from /etc/asound.conf to once again enable audio 
     24 output.