Advertisement
Guest User

Untitled

a guest
Sep 15th, 2014
218
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.12 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3. #check if microphone is enabled and soundcard captures
  4. cap=`amixer get Capture | grep -c '\[off\]'`
  5. if [ $cap -gt 0 ]; then
  6.         echo "microphone not enabled"
  7.         exit 1
  8. fi
  9.  
  10. # select window and get position
  11. echo 'Please select the window you want to record'
  12. tmp=`mktemp`
  13. xwininfo >$tmp
  14. posx=`grep 'Absolute upper-left X:' $tmp | cut -d':' -f2 | tr -d ' '`
  15. posy=`grep 'Absolute upper-left Y:' $tmp | cut -d':' -f2 | tr -d ' '`
  16. width=`grep 'Width:' $tmp | cut -d':' -f2 | tr -d ' '`
  17. height=`grep 'Height:' $tmp | cut -d':' -f2 | tr -d ' '`
  18. rm $tmp
  19.  
  20. # start recording
  21. #ffmpeg -f x11grab -r 25 -s ${width}x${height} -i :0.0+${posx},${posy} -f alsa -ac 1 -ar 44100 -i default:CARD=PCH -c:v libx264 -crf:v 0 -preset:v ultrafast -c:a flac grab.mkv
  22.  
  23. # pulseaudio: micro and system sound
  24. ffmpeg -f x11grab -r 25 -s ${width}x${height} -i :0.0+${posx},${posy} \
  25.         -f pulse -i default \
  26.         -f pulse -i alsa_output.pci-0000_00_1b.0.analog-stereo.monitor \
  27.         -map 0:0 -map 1:0 -map 2:0 \
  28.         -c:v libx264 -crf:v 0 -preset:v ultrafast \
  29.         -c:a flac \
  30.         -c:a flac \
  31.         grab.mkv
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement