Advertisement
clockworkpc

Screencasting Script with FFmpeg

Jun 13th, 2013
193
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.53 KB | None | 0 0
  1. #!/usr/bin/python
  2. #/home/clockworkpc/bin/screencast.py
  3.  
  4. # Released under a GPLv3 Licence by Clockwork PC 2013
  5. # www.clockworkpc.com.au
  6.  
  7. # You are entitled to the following four freedoms:
  8. # Freedom 0: To run this program for any purpose
  9. # Freedom 1: To study how this program works and change it to make it do what you wish
  10. # Freedom 2: To redistribute copies so you can help your neighbour
  11. # Freedom 3: To distribute copies of your modified version to others
  12.  
  13. import os, datetime
  14.  
  15. now = datetime.datetime.now()
  16. nowstring = str(now.strftime("%Y-%m-%d_%A_%H:%M:%S"))
  17.  
  18. binFolder = os.getenv("HOME") + "/Videos/Desktop_Recording/" + nowstring + "/"
  19. videoStream = binFolder + "desktop_recording_on_" + nowstring + ".mkv"
  20. audioStream = binFolder + "microphone_input_on_" + nowstring + ".mp3"
  21. mergedVideo = binFolder + "screencast_on_" + nowstring + ".mkv"
  22.  
  23. os.system("mkdir " + binFolder)
  24.  
  25. os.system("gnome-terminal -x ffmpeg -f x11grab -r 30 -s 1366x768 -i :0.0 -c:v libx264 -threads 0 " + videoStream)
  26.  
  27. os.system("gnome-terminal -x ffmpeg -f alsa -ac 2 -i pulse " + audioStream)
  28.  
  29. convertPrompt = input("""Do you want to merge the streams?
  30. 1. Yes
  31. 2. No
  32.  
  33. Please enter your choice: """)
  34.  
  35. if convertPrompt == 1:
  36.     os.system("gnome-terminal -x ffmpeg -i " + videoStream + " -i " + audioStream + " -b 5000k " + mergedVideo)
  37. else:
  38.     exitQuestion = input("Are you done? (Press 1) ")       
  39.     if exitQuestion == 1:
  40.         exit()
  41.     else:
  42.         exit()
  43.  
  44. exitQuestionFinal = input("Are you done? (Press 1) ")
  45. if exitQuestionFinal == 1:
  46.     exit()
  47. else:
  48.     exit()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement