Skip to content

Commit

Permalink
Version 2.2.0 (#33)
Browse files Browse the repository at this point in the history
* Adding custom extra ffmpeg args for HEVC
* Adding max mux queue size change for HEVC
* Fixing issue with codec not being set as copy (thanks to schlotkins)
* Fixing quotes around parens on linux
  • Loading branch information
cdgriffith authored Jul 17, 2020
1 parent 3018f02 commit 5c6c42a
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 5 deletions.
8 changes: 8 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
Changelog
---------

Version 2.2.0
~~~~~~~~~~~~~

* Adding custom extra ffmpeg args for HEVC
* Adding max mux queue size change for HEVC
* Fixing issue with codec not being set as copy (thanks to schlotkins)
* Fixing quotes around parens on linux

Version 2.1.1
~~~~~~~~~~~~~

Expand Down
2 changes: 1 addition & 1 deletion flix/flix.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ def generate_thumbnail_command(self, source, output, video_track, start_time=0,
start = f"-ss {start_time}"
return (
f'"{self.ffmpeg}" {start} -loglevel error -i "{source}" '
f" -vf {filters + ',' if filters else ''}scale=min(320\\,iw):-1 "
f' -vf {filters + "," if filters else ""}scale="min(320\\,iw):-1" '
f"-map 0:{video_track} -an -y "
f'-vframes 1 "{output}"'
)
Expand Down
8 changes: 7 additions & 1 deletion flix/plugins/hevc/command_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ def build(
side_data=None,
x265_params=None,
intra_encoding=False,
max_mux="default",
extra="",
**kwargs,
):
filters = generate_filters(disable_hdr=disable_hdr, **kwargs)
Expand All @@ -41,6 +43,7 @@ def build(
f'-i "{source}" '
f' {f"-ss {start_time}" if start_time else ""} '
f'{f"-to {duration}" if duration else ""} '
f"{extra} "
f"-map 0:{video_track} "
# "-pix_fmt yuv420p10le "
f"-c:v libx265 "
Expand All @@ -50,6 +53,9 @@ def build(

beginning = re.sub("[ ]+", " ", beginning)

if max_mux and max_mux != "default":
beginning += f"-max_muxing_queue_size {max_mux}"

if not x265_params:
x265_params = []

Expand All @@ -76,7 +82,7 @@ def build(
x265_params.append("keyint=1")

if x265_params:
beginning += "-x265-params {}".format(":".join(x265_params))
beginning += '-x265-params "{}"'.format(":".join(x265_params))

if side_data.cll:
pass
Expand Down
36 changes: 34 additions & 2 deletions flix/plugins/hevc/settings_panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,19 +43,26 @@ def __init__(self, parent, main):

self.mode = "CRF"

grid.addLayout(self.init_modes(), 0, 2, 8, 4)
grid.addLayout(self.init_modes(), 0, 2, 6, 4)
grid.addLayout(self.init_custom(), 6, 2, 8, 4)

grid.addLayout(self.init_preset(), 1, 0, 1, 2)
grid.addLayout(self.init_remove_hdr(), 2, 0, 1, 2)
grid.addLayout(self.init_intra_encoding(), 3, 0, 1, 2)
grid.addLayout(self.init_max_mux(), 4, 0, 1, 2)

grid.addWidget(QtWidgets.QWidget(), 8, 0)
grid.setRowStretch(8, 1)

guide_label = QtWidgets.QLabel(
f"<a href='https://trac.ffmpeg.org/wiki/Encode/H.265'>FFMPEG HEVC / H.265 Encoding Guide</a>"
"<a href='https://trac.ffmpeg.org/wiki/Encode/H.265'>FFMPEG HEVC / H.265 Encoding Guide</a>"
" | <a href='https://codecalamity.com/encoding-uhd-4k-hdr10-videos-with-ffmpeg/'>"
"CodeCalamity UHD HDR Encoding Guide</a>"
)
guide_label.setAlignment(QtCore.Qt.AlignBottom)
guide_label.setOpenExternalLinks(True)
grid.addWidget(guide_label, 9, 0, -1, 1)

self.setLayout(grid)
self.hide()

Expand Down Expand Up @@ -106,6 +113,28 @@ def init_preset(self):
layout.addWidget(self.widgets.preset)
return layout

def init_max_mux(self):
layout = QtWidgets.QHBoxLayout()
label = QtWidgets.QLabel("Max Muxing Queue Size")
label.setToolTip('Only change this if you are getting the error "Too many packets buffered for output stream"')
layout.addWidget(label)
self.widgets.max_mux = QtWidgets.QComboBox()
self.widgets.max_mux.addItems(["default", "1024", "2048", "4096", "8192"])
self.widgets.max_mux.setCurrentIndex(0)
self.widgets.max_mux.currentIndexChanged.connect(lambda: self.main.page_update())
layout.addWidget(self.widgets.max_mux)
return layout

def init_custom(self):
layout = QtWidgets.QHBoxLayout()
label = QtWidgets.QLabel("Custom ffmpeg options")
label.setToolTip("extra flags or options, cannot modify existing settings")
layout.addWidget(label)
self.widgets.extra = QtWidgets.QLineEdit()
self.widgets.extra.textChanged.connect(lambda: self.main.page_update())
layout.addWidget(self.widgets.extra)
return layout

def init_modes(self):
layout = QtWidgets.QGridLayout()
crf_group_box = QtWidgets.QGroupBox()
Expand Down Expand Up @@ -163,7 +192,10 @@ def get_settings(self):
disable_hdr=bool(self.widgets.remove_hdr.currentIndex()),
preset=self.widgets.preset.currentText(),
intra_encoding=bool(self.widgets.intra_encoding.currentIndex()),
max_mux=self.widgets.max_mux.currentText(),
extra=self.widgets.extra.text(),
)

if self.mode == "CRF":
crf = self.widgets.crf.currentText()
settings.crf = int(crf.split(" ", 1)[0]) if crf.lower() != "custom" else self.widgets.custom_crf.text()
Expand Down
2 changes: 1 addition & 1 deletion flix/version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__version__ = "2.1.1"
__version__ = "2.2.0"
__author__ = "Chris Griffith"

0 comments on commit 5c6c42a

Please sign in to comment.