Skip to content

Commit

Permalink
Merge pull request #4 from kennedy0/system_ffmpeg
Browse files Browse the repository at this point in the history
System ffmpeg
  • Loading branch information
kennedy0 committed Feb 4, 2021
2 parents c8d9f0f + 86e1bcf commit bcfcad0
Show file tree
Hide file tree
Showing 12 changed files with 486 additions and 283 deletions.
21 changes: 0 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ Position the window over the content you want to capture and click **Record**.
PolarBear ships with a few presets for lightweight mp4 recording.
The default should be sufficient for most people.

![PolarBear](resources/readme/pb_options_dark.png)

If you want to customize your presets, click the **Open Presets Folder** button in the options screen.
Presets are stored as text files.
You can add, edit, or delete preset files.
Expand Down Expand Up @@ -47,25 +45,6 @@ brackets alone.
<OUTPUT>.mp4
```

#### Example Linux preset using x11grab
```
# Example Linux preset using x11grab
<FFMPEG>
-f x11grab
-framerate <FPS>
-video_size <SIZE>
-i :1+<X>,<Y>
-c:v libx264
-pix_fmt yuv422p10
-crf 23
-preset ultrafast
-tune zerolatency
-vsync 1
-y
<OUTPUT>.mp4
```

See the [FFmpeg documentation](https://ffmpeg.org/ffmpeg.html) for information on FFmpeg commands in general,
and the [FFmpeg devices documentation](https://ffmpeg.org/ffmpeg-devices.html) for specifics on capturing devices.

Expand Down
2 changes: 1 addition & 1 deletion __version__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "1.2.0"
__version__ = "1.3.0"
20 changes: 20 additions & 0 deletions config/ffmpeg_version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import shutil

from pyffmpeg import FFmpeg


FFMPEG_SYSTEM = "system"
FFMPEG_BUNDLED = "bundled"


def get_system_ffmpeg() -> str or None:
return shutil.which("ffmpeg")


def get_ffmpeg_binary(version: str) -> str:
if version == FFMPEG_SYSTEM:
ffmpeg_binary = get_system_ffmpeg()
if ffmpeg_binary is not None:
return ffmpeg_binary

return FFmpeg().get_ffmpeg_bin()
2 changes: 2 additions & 0 deletions config/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import shutil
from typing import List

from .ffmpeg_version import FFMPEG_SYSTEM
from .theme import THEME_SYSTEM


Expand Down Expand Up @@ -38,6 +39,7 @@ def get_presets_src():
'default_width': 800,
'default_height': 600,
'theme': THEME_SYSTEM,
'ffmpeg_version': FFMPEG_SYSTEM,
}


Expand Down
4 changes: 4 additions & 0 deletions config/themes/dark.qss
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,7 @@ QComboBox {
border: 1px solid #6b7b80;
background-color: #5a5a5a;
}

QMessageBox {
messagebox-text-interaction-flags: 5;
}
6 changes: 5 additions & 1 deletion config/themes/light.qss
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,8 @@ QLineEdit {
QComboBox {
border: 1px solid #6b7b80;
background-color: #f0f0f0;
}
}

QMessageBox {
messagebox-text-interaction-flags: 5;
}
13 changes: 13 additions & 0 deletions gui/main_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,17 @@ def setupUi(self, MainWindow):
self.lbl_title.setLineWidth(1)
self.lbl_title.setObjectName("lbl_title")
self.horizontalLayout_3.addWidget(self.lbl_title)
self.btn_ffmpeg_command = QtWidgets.QPushButton(self.group_title)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.btn_ffmpeg_command.sizePolicy().hasHeightForWidth())
self.btn_ffmpeg_command.setSizePolicy(sizePolicy)
self.btn_ffmpeg_command.setMinimumSize(QtCore.QSize(25, 25))
self.btn_ffmpeg_command.setMaximumSize(QtCore.QSize(25, 25))
self.btn_ffmpeg_command.setFlat(True)
self.btn_ffmpeg_command.setObjectName("btn_ffmpeg_command")
self.horizontalLayout_3.addWidget(self.btn_ffmpeg_command)
self.btn_options = QtWidgets.QPushButton(self.group_title)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(1)
Expand Down Expand Up @@ -305,6 +316,8 @@ def retranslateUi(self, MainWindow):
_translate = QtCore.QCoreApplication.translate
MainWindow.setWindowTitle(_translate("MainWindow", "PolarBear"))
self.lbl_title.setText(_translate("MainWindow", "PolarBear"))
self.btn_ffmpeg_command.setToolTip(_translate("MainWindow", "FFmpeg Command"))
self.btn_ffmpeg_command.setText(_translate("MainWindow", "</>"))
self.btn_options.setToolTip(_translate("MainWindow", "Options"))
self.btn_options.setText(_translate("MainWindow", "⚙"))
self.btn_close.setToolTip(_translate("MainWindow", "Quit"))
Expand Down
215 changes: 122 additions & 93 deletions gui/options.py

Large diffs are not rendered by default.

31 changes: 31 additions & 0 deletions ui/main_window.ui
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,37 @@
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btn_ffmpeg_command">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>25</width>
<height>25</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>25</width>
<height>25</height>
</size>
</property>
<property name="toolTip">
<string>FFmpeg Command</string>
</property>
<property name="text">
<string>&lt;/&gt;</string>
</property>
<property name="flat">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btn_options">
<property name="sizePolicy">
Expand Down

0 comments on commit bcfcad0

Please sign in to comment.