Last active
October 7, 2018 05:35
-
-
Save LinuxPhreak/4dc900ee02ec82e88740ecece7541ab6 to your computer and use it in GitHub Desktop.
Stopping the Video Recording Issue
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python3 | |
| import sys | |
| import os | |
| import subprocess | |
| from PyQt5 import QtCore, QtGui, QtWidgets | |
| from pynput.keyboard import Key, Controller | |
| from ffmpeg import Ui_frmMain | |
| class ffmpeg(Ui_frmMain): | |
| def __init__(self, dialog): | |
| Ui_frmMain.__init__(self) | |
| self.setupUi(dialog) | |
| self.pbRecord.clicked.connect(self.filename) | |
| keyboard = Controller() #Problem here | |
| pressQ = keyboard.press('q') #Problem here | |
| self.pbQuit.clicked.connect(pressQ) #Problem here | |
| def filename(self): | |
| vidname = os.environ['HOME'] + "/Videos/" + self.txtFile.text() + ".mkv" #sets the directory to save image in | |
| cmd = subprocess.run(["/usr/bin/ffmpeg", "-video_size", "1920x1080", "-framerate", "20", "-f", "x11grab", "-i", ":0.0", "-f", "pulse", "-ac", "2", "-i", "default", vidname]) | |
| if __name__ == '__main__': | |
| app = QtWidgets.QApplication(sys.argv) | |
| dialog = QtWidgets.QMainWindow() | |
| prog = ffmpeg(dialog) | |
| dialog.show() | |
| sys.exit(app.exec_()) |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Gives me the following error.
qTraceback (most recent call last):
File "screen-recorder.py", line 28, in
prog = ffmpeg(dialog)
File "screen-recorder.py", line 17, in init
self.pbQuit.clicked.connect(pressQ)
TypeError: argument 1 has unexpected type 'NoneType'
NOTE: It simulates the q key being pressed after the error.