Advertisement
Guest User

Screencast Script

a guest
Jul 21st, 2013
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 2.29 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3.     # SCREENCAST = LOSSLESS SCREENCAST
  4.  
  5.     # =============
  6.     # USER SETTINGS
  7.     # =============
  8.     input=$(zenity --text "Name of Video?" --entry)
  9.     OUTPUT="/home/akovia/Videos/Screencasts"
  10.     KEYBOARDSTART="[ Super + F5 ] keys pressed"
  11.     KEYBOARDSTOP="[ Super + F7 ] keys pressed"
  12.     # =============
  13.  
  14.     # =========
  15.     # VARIABLES
  16.     # =========
  17.     SIZE="1920x1056"
  18.     RATE="30"
  19.     VCODEC="libx264"
  20.  
  21.     PIXELS="yuv420p"
  22.     PRESET="ultrafast"
  23.     # =========
  24.  
  25.       # ===========
  26.       # INFORMATION
  27.       # ===========
  28.      
  29.       # ==========================================
  30.       # keyboard bindings for chosen keys [rc.xml]
  31.       # ==========================================
  32.       # <keybind key="A-F1"><action name="Execute"><command>screencast</command></action></keybind>
  33.       # <keybind key="A-F3"><action name="Execute"><command>screencast-stop</command></action></keybind>
  34.       # ==========================================
  35.  
  36.       # ==============================
  37.       # terminal conversion MKV >> MP4
  38.       # ==============================
  39.       # ffmpeg -i screencast.mkv -c:v libx264 -preset fast -crf 18 -y screencast.mp4
  40.       # ==============================
  41.  
  42.       # ===============================
  43.       # thunar custom action MKV >> MP4
  44.       # ===============================
  45.       # terminal --title="Screencast MKV Conversion to MP4" --geometry="200x35" --icon="$HOME/.icons/ffmpeg/convert.png" -e " ffmpeg -i %f -c:v libx264 -preset fast -crf 18 -y `basename %f .mkv`.mp4"
  46.       # ===============================
  47.  
  48.     # ============
  49.     # SCRIPT BELOW
  50.     # ============
  51.    
  52.     # notification - starting
  53.     notify-send -t 6000 "$KEYBOARDSTART : screencast will begin in 6 seconds"
  54.    
  55.     key-mon &
  56.    
  57.     # pause!
  58.     sleep 6
  59.  
  60.  
  61.     # start screencasting losslessly without audio
  62.     ffmpeg -f x11grab -s $SIZE -r $RATE -i :0.0 -vcodec $VCODEC -preset $PRESET -crf 0 -threads 0 -y "$OUTPUT"/"$input".mkv
  63.  
  64.     ## screencast-stop ## << script (assigned to keyboard shortcut) silently brings the ffmpeg process to a halt here! >>
  65.  
  66.     # notification - completion
  67.     notify-send -t 3000  "$KEYBOARDSTOP : Screencast finished   :-)"
  68.  
  69.     # pause
  70.     sleep 3
  71.  
  72.     # open thunar to show video
  73.     thunar "$OUTPUT"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement