Skip to content

Commit

Permalink
Version 4.0.4 (#151)
Browse files Browse the repository at this point in the history
* Fixing #137 Should not be able to try and switch between encoders without a video (thanks to leonardyan)
* Fixing #149 Cannot set subtitle disposition in 4.0+ (thanks to Zeid164)
* Fixing #150 FFmpeg extras not able to be set (thanks to kipperdawn)
* Fixing exact / fast time selector not working
* Fixing subtitle burn in not working (for picture images)
* Fixing that text based subtitles could show as being burned-in-able
* Fixing HEVC tune did not put space after itself in command
  • Loading branch information
cdgriffith authored Jan 1, 2021
1 parent edcbceb commit 45208b7
Show file tree
Hide file tree
Showing 21 changed files with 155 additions and 86 deletions.
10 changes: 10 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# Changelog

## Version 4.0.4

* Fixing #137 Should not be able to try and switch between encoders without a video (thanks to leonardyan)
* Fixing #149 Cannot set subtitle disposition in 4.0+ (thanks to Zeid164)
* Fixing #150 FFmpeg extras not able to be set (thanks to kipperdawn)
* Fixing exact / fast time selector not working
* Fixing subtitle burn in not working (for picture images)
* Fixing that text based subtitles could show as being burned-in-able
* Fixing HEVC tune did not put space after itself in command

## Version 4.0.3

* Fixing #146 Extraneous "None" when remove HDR is selected (thanks to Chad Johnson)
Expand Down
8 changes: 6 additions & 2 deletions fastflix/__main__.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
# -*- coding: utf-8 -*-
import traceback
import sys
from multiprocessing import freeze_support

from fastflix.entry import main


def start_fastflix():
freeze_support()
exit_code = 2
try:
main()
exit_code = main()
except Exception:
traceback.print_exc()
input(
Expand All @@ -17,7 +18,10 @@ def start_fastflix():
)
except KeyboardInterrupt:
pass
finally:
sys.exit(exit_code)


if __name__ == "__main__":
freeze_support()
start_fastflix()
3 changes: 2 additions & 1 deletion fastflix/conversion_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,8 @@ def start_command():
if runner.is_alive() or currently_encoding:
logger.info(t("The GUI might have died, but I'm going to keep converting!"))
else:
break
logger.debug(t("Conversion worker shutting down"))
return

try:
request = worker_queue.get(block=True, timeout=0.05)
Expand Down
7 changes: 7 additions & 0 deletions fastflix/data/languages.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2448,3 +2448,10 @@ Could not start FastFlix:
ita: Impossibile avviare FastFlix
spa: No pudo iniciar FastFlix
zho: 无法启动FastFlix
Conversion worker shutting down:
eng: Conversion worker shutting down
deu: Konvertierungsarbeiter beim Herunterfahren
fra: Fermeture d'une entreprise de reconversion
ita: Operaio di conversione in chiusura
spa: El cierre del trabajador de conversión
zho: 转化工人正在关闭
18 changes: 9 additions & 9 deletions fastflix/encoders/av1_aom/settings_panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,15 @@ def __init__(self, parent, main, app: FastFlixApp):

self.mode = "CRF"

grid.addLayout(self.init_cpu_used(), 1, 0, 1, 2)
grid.addLayout(self.init_row_mt(), 2, 0, 1, 2)
grid.addLayout(self.init_tile_columns(), 3, 0, 1, 2)
grid.addLayout(self.init_tile_rows(), 4, 0, 1, 2)
grid.addLayout(self.init_usage(), 5, 0, 1, 2)
grid.addLayout(self.init_max_mux(), 6, 0, 1, 2)
grid.addLayout(self.init_pix_fmt(), 7, 0, 1, 2)

grid.addLayout(self.init_modes(), 0, 2, 4, 4)
grid.addLayout(self.init_cpu_used(), 0, 0, 1, 2)
grid.addLayout(self.init_row_mt(), 1, 0, 1, 2)
grid.addLayout(self.init_tile_columns(), 2, 0, 1, 2)
grid.addLayout(self.init_tile_rows(), 3, 0, 1, 2)
grid.addLayout(self.init_usage(), 4, 0, 1, 2)
grid.addLayout(self.init_max_mux(), 5, 0, 1, 2)
grid.addLayout(self.init_pix_fmt(), 6, 0, 1, 2)

grid.addLayout(self.init_modes(), 0, 2, 5, 4)

grid.addLayout(self._add_custom(), 10, 0, 1, 6)
grid.setRowStretch(8, 1)
Expand Down
12 changes: 8 additions & 4 deletions fastflix/encoders/common/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,14 @@ def generate_ffmpeg_start(
pix_fmt="yuv420p10le",
filters=None,
max_muxing_queue_size="default",
fast_time=True,
fast_seek=True,
video_title="",
custom_map=False,
**_,
):
time_settings = f'{f"-ss {start_time}" if start_time else ""} {f"-to {end_time}" if end_time else ""} '
time_one = time_settings if fast_time else ""
time_two = time_settings if not fast_time else ""
time_one = time_settings if fast_seek else ""
time_two = time_settings if not fast_seek else ""
title = f'-metadata title="{video_title}"' if video_title else ""
source = str(source).replace("\\", "/")
ffmpeg = str(ffmpeg).replace("\\", "/")
Expand Down Expand Up @@ -183,13 +183,17 @@ def generate_all(

filters = None
if not disable_filters:
filters = generate_filters(burn_in_track=burn_in_track, **asdict(fastflix.current_video.video_settings))
filters = generate_filters(
burn_in_subtitle_track=burn_in_track, **asdict(fastflix.current_video.video_settings)
)

ending = generate_ending(
audio=audio,
subtitles=subtitles,
cover=attachments,
output_video=fastflix.current_video.video_settings.output_path,
extra=fastflix.current_video.video_settings.video_encoder_settings.extra,
**asdict(fastflix.current_video.video_settings),
)

beginning = generate_ffmpeg_start(
Expand Down
54 changes: 41 additions & 13 deletions fastflix/encoders/common/setting_panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,9 @@ def _add_combo_box(
self.widgets[widget_name].setToolTip(self.translate_tip(tooltip))
if connect:
if connect == "default":
self.widgets[widget_name].currentIndexChanged.connect(lambda: self.main.page_update())
self.widgets[widget_name].currentIndexChanged.connect(
lambda: self.main.page_update(build_thumbnail=False)
)
elif connect == "self":
self.widgets[widget_name].currentIndexChanged.connect(lambda: self.page_update())
else:
Expand All @@ -95,7 +97,7 @@ def _add_check_box(self, label, widget_name, opt, connect="default", enabled=Tru
self.widgets[widget_name].setToolTip(self.translate_tip(tooltip))
if connect:
if connect == "default":
self.widgets[widget_name].toggled.connect(lambda: self.main.page_update())
self.widgets[widget_name].toggled.connect(lambda: self.main.page_update(build_thumbnail=False))
elif connect == "self":
self.widgets[widget_name].toggled.connect(lambda: self.page_update())
else:
Expand Down Expand Up @@ -132,9 +134,11 @@ def _add_file_select(self, label, widget_name, button_action, connect="default",
self.widgets[widget_name].setDisabled(not enabled)
self.widgets[widget_name].setToolTip(tooltip)

self.opts[widget_name] = widget_name

if connect:
if connect == "default":
self.widgets[widget_name].textChanged.connect(lambda: self.main.page_update())
self.widgets[widget_name].textChanged.connect(lambda: self.main.page_update(build_thumbnail=False))
elif connect == "self":
self.widgets[widget_name].textChanged.connect(lambda: self.page_update())
else:
Expand Down Expand Up @@ -164,9 +168,9 @@ def _add_modes(
self.widgets.mode = QtWidgets.QButtonGroup()
self.widgets.mode.buttonClicked.connect(self.set_mode)

bitrate_radio = QtWidgets.QRadioButton("Bitrate")
bitrate_radio.setFixedWidth(80)
self.widgets.mode.addButton(bitrate_radio)
self.bitrate_radio = QtWidgets.QRadioButton("Bitrate")
self.bitrate_radio.setFixedWidth(80)
self.widgets.mode.addButton(self.bitrate_radio)
self.widgets.bitrate = QtWidgets.QComboBox()
self.widgets.bitrate.setFixedWidth(250)
self.widgets.bitrate.addItems(recommended_bitrates)
Expand All @@ -179,7 +183,7 @@ def _add_modes(
self.widgets.custom_bitrate.setFixedWidth(100)
self.widgets.custom_bitrate.setDisabled(True)
self.widgets.custom_bitrate.textChanged.connect(lambda: self.main.build_commands())
bitrate_box_layout.addWidget(bitrate_radio)
bitrate_box_layout.addWidget(self.bitrate_radio)
bitrate_box_layout.addWidget(self.widgets.bitrate)
bitrate_box_layout.addStretch()
bitrate_box_layout.addWidget(QtWidgets.QLabel("Custom:"))
Expand All @@ -189,11 +193,11 @@ def _add_modes(
f"{qp_name.upper()} {t('is extremely source dependant')},\n"
f"{t('the resolution-to-')}{qp_name.upper()}{t('are mere suggestions!')}"
)
qp_radio = QtWidgets.QRadioButton(qp_name.upper())
qp_radio.setChecked(True)
qp_radio.setFixedWidth(80)
qp_radio.setToolTip(qp_help)
self.widgets.mode.addButton(qp_radio)
self.qp_radio = QtWidgets.QRadioButton(qp_name.upper())
self.qp_radio.setChecked(True)
self.qp_radio.setFixedWidth(80)
self.qp_radio.setToolTip(qp_help)
self.widgets.mode.addButton(self.qp_radio)

self.widgets[qp_name] = QtWidgets.QComboBox()
self.widgets[qp_name].setToolTip(qp_help)
Expand All @@ -210,7 +214,7 @@ def _add_modes(
self.widgets[f"custom_{qp_name}"].setDisabled(True)
self.widgets[f"custom_{qp_name}"].setValidator(self.only_int)
self.widgets[f"custom_{qp_name}"].textChanged.connect(lambda: self.main.build_commands())
qp_box_layout.addWidget(qp_radio)
qp_box_layout.addWidget(self.qp_radio)
qp_box_layout.addWidget(self.widgets[qp_name])
qp_box_layout.addStretch()
qp_box_layout.addWidget(QtWidgets.QLabel("Custom:"))
Expand Down Expand Up @@ -238,6 +242,7 @@ def new_source(self):
return

def update_profile(self):
global ffmpeg_extra_command
for widget_name, opt in self.opts.items():
if isinstance(self.widgets[widget_name], QtWidgets.QComboBox):
default = self.determine_default(
Expand All @@ -256,6 +261,19 @@ def update_profile(self):
if widget_name == "x265_params":
data = ":".join(data)
self.widgets[widget_name].setText(data or "")
try:
bitrate = self.app.fastflix.config.encoder_opt(self.profile_name, "bitrate")
except AttributeError:
pass
else:
if bitrate:
self.qp_radio.setChecked(False)
self.bitrate_radio.setChecked(True)
else:
self.qp_radio.setChecked(True)
self.bitrate_radio.setChecked(False)
ffmpeg_extra_command = self.app.fastflix.config.encoder_opt(self.profile_name, "extra")
self.ffmpeg_extras_widget.setText(ffmpeg_extra_command)

def init_max_mux(self):
return self._add_combo_box(
Expand All @@ -267,6 +285,7 @@ def init_max_mux(self):
)

def reload(self):
global ffmpeg_extra_command
for widget_name, opt in self.opts.items():
data = getattr(self.app.fastflix.current_video.video_settings.video_encoder_settings, opt)
if isinstance(self.widgets[widget_name], QtWidgets.QComboBox):
Expand All @@ -280,3 +299,12 @@ def reload(self):
if widget_name == "x265_params":
data = ":".join(data)
self.widgets[widget_name].setText(data or "")
if getattr(self, "qp_radio", None):
if getattr(self.app.fastflix.current_video.video_settings.video_encoder_settings, "bitrate", None):
self.qp_radio.setChecked(False)
self.bitrate_radio.setChecked(True)
else:
self.qp_radio.setChecked(True)
self.bitrate_radio.setChecked(False)
ffmpeg_extra_command = self.app.fastflix.current_video.video_settings.video_encoder_settings.extra
self.ffmpeg_extras_widget.setText(ffmpeg_extra_command)
2 changes: 1 addition & 1 deletion fastflix/encoders/common/subtitles.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def build_subtitle(subtitle_tracks, subtitle_file_index=0):
outdex = track.outdex - (1 if burn_in_track else 0)
command_list.append(f"-map {subtitle_file_index}:{track.index} -c:{outdex} copy ")
if track.disposition:
command_list.append(f"-disposition:{outdex} '{track.disposition}'")
command_list.append(f"-disposition:{outdex} {track.disposition}")
else:
command_list.append(f"-disposition:{outdex} 0")
command_list.append(f"-metadata:s:{outdex} language='{track.language}'")
Expand Down
2 changes: 1 addition & 1 deletion fastflix/encoders/hevc_x265/command_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def build(fastflix: FastFlix):
beginning, ending = generate_all(fastflix, "libx265")

if settings.tune and settings.tune != "default":
beginning += f"-tune {settings.tune}"
beginning += f"-tune {settings.tune} "

if settings.profile and settings.profile != "default":
beginning += f"-profile {settings.profile} "
Expand Down
9 changes: 5 additions & 4 deletions fastflix/encoders/hevc_x265/settings_panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,10 @@ def __init__(self, parent, main, app: FastFlixApp):
self.mode = "CRF"
self.updating_settings = False

grid.addLayout(self.init_preset(), 1, 0, 1, 2)
grid.addLayout(self.init_tune(), 2, 0, 1, 2)
grid.addLayout(self.init_profile(), 3, 0, 1, 2)
grid.addLayout(self.init_pix_fmt(), 4, 0, 1, 2)
grid.addLayout(self.init_preset(), 0, 0, 1, 2)
grid.addLayout(self.init_tune(), 1, 0, 1, 2)
grid.addLayout(self.init_profile(), 2, 0, 1, 2)
grid.addLayout(self.init_pix_fmt(), 3, 0, 1, 2)
grid.addLayout(self.init_modes(), 0, 2, 5, 4)

breaker = QtWidgets.QHBoxLayout()
Expand Down Expand Up @@ -537,6 +537,7 @@ def update_video_encoder_settings(self):
x265_params=x265_params_text.split(":") if x265_params_text else [],
hdr10plus_metadata=self.widgets.hdr10plus_metadata.text().strip().replace("\\", "/"),
lossless=self.widgets.lossless.isChecked(),
extra=self.ffmpeg_extras,
)

if self.mode == "CRF":
Expand Down
16 changes: 8 additions & 8 deletions fastflix/encoders/rav1e/settings_panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,14 @@ def __init__(self, parent, main, app: FastFlixApp):
self.mode = "QP"

grid.addLayout(self.init_speed(), 0, 0, 1, 2)
grid.addLayout(self.init_tiles(), 2, 0, 1, 2)
grid.addLayout(self.init_tile_rows(), 3, 0, 1, 2)
grid.addLayout(self.init_tile_columns(), 4, 0, 1, 2)
grid.addLayout(self.init_pix_fmt(), 5, 0, 1, 2)
grid.addLayout(self.init_max_mux(), 6, 0, 1, 2)

grid.addLayout(self.init_modes(), 0, 2, 4, 4)
grid.addLayout(self.init_single_pass(), 4, 2, 1, 1)
grid.addLayout(self.init_tiles(), 1, 0, 1, 2)
grid.addLayout(self.init_tile_rows(), 2, 0, 1, 2)
grid.addLayout(self.init_tile_columns(), 3, 0, 1, 2)
grid.addLayout(self.init_pix_fmt(), 4, 0, 1, 2)
grid.addLayout(self.init_max_mux(), 5, 0, 1, 2)

grid.addLayout(self.init_modes(), 0, 2, 5, 4)
grid.addLayout(self.init_single_pass(), 5, 2, 1, 1)
grid.addLayout(self._add_custom(), 10, 0, 1, 6)

grid.setRowStretch(9, 1)
Expand Down
16 changes: 8 additions & 8 deletions fastflix/encoders/svt_av1/settings_panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,16 +63,15 @@ def __init__(self, parent, main, app: FastFlixApp):
self.mode = "QP"

grid.addLayout(self.init_speed(), 0, 0, 1, 2)
grid.addLayout(self.init_pix_fmt(), 2, 0, 1, 2)
grid.addLayout(self.init_tile_rows(), 3, 0, 1, 2)
grid.addLayout(self.init_tile_columns(), 4, 0, 1, 2)
grid.addLayout(self.init_tier(), 5, 0, 1, 2)
grid.addLayout(self.init_pix_fmt(), 1, 0, 1, 2)
grid.addLayout(self.init_tile_rows(), 2, 0, 1, 2)
grid.addLayout(self.init_tile_columns(), 3, 0, 1, 2)
grid.addLayout(self.init_tier(), 4, 0, 1, 2)
# grid.addLayout(self.init_sc_detection(), 6, 0, 1, 2)
grid.addLayout(self.init_max_mux(), 6, 0, 1, 2)
grid.addLayout(self._add_custom(), 10, 0, 1, 6)
grid.addLayout(self.init_max_mux(), 5, 0, 1, 2)
grid.addLayout(self.init_modes(), 0, 2, 5, 4)
grid.addLayout(self.init_single_pass(), 5, 2, 1, 1)

grid.addLayout(self.init_modes(), 0, 2, 4, 4)
grid.addLayout(self.init_single_pass(), 4, 2, 1, 1)
grid.setRowStretch(8, 1)
guide_label = QtWidgets.QLabel(
link(
Expand All @@ -82,6 +81,7 @@ def __init__(self, parent, main, app: FastFlixApp):
)
guide_label.setAlignment(QtCore.Qt.AlignBottom)
guide_label.setOpenExternalLinks(True)
grid.addLayout(self._add_custom(), 10, 0, 1, 6)
grid.addWidget(guide_label, 11, 0, -1, 1)
self.setLayout(grid)
self.hide()
Expand Down
19 changes: 8 additions & 11 deletions fastflix/encoders/vp9/settings_panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,22 +57,19 @@ def __init__(self, parent, main, app: FastFlixApp):

self.mode = "CRF"

grid.addLayout(self.init_modes(), 0, 1, 4, 4)
grid.addLayout(self.init_single_pass(), 6, 2, 1, 1)

grid.addLayout(self.init_quality(), 1, 0, 1, 1)
grid.addLayout(self.init_speed(), 0, 0, 1, 1)
grid.addLayout(self.init_quality(), 1, 0, 1, 1)
grid.addLayout(self.init_pix_fmt(), 2, 0, 1, 1)
grid.addLayout(self.init_max_mux(), 3, 0, 1, 1)
grid.addLayout(self.init_profile(), 4, 0, 1, 1)

grid.addLayout(self.init_row_mt(), 4, 0, 1, 1)
grid.addLayout(self.init_pix_fmt(), 5, 0, 1, 1)

grid.addLayout(self.init_max_mux(), 6, 0, 1, 1)
grid.addLayout(self.init_profile(), 7, 0, 1, 1)

grid.addLayout(self._add_custom(), 9, 0, 1, 5)
grid.addLayout(self.init_modes(), 0, 1, 5, 4)
grid.addLayout(self.init_single_pass(), 6, 1, 1, 1)
grid.addLayout(self.init_row_mt(), 6, 3, 1, 1)

grid.addWidget(QtWidgets.QWidget(), 8, 0)
grid.setRowStretch(8, 1)
grid.addLayout(self._add_custom(), 9, 0, 1, 5)

link_1 = link("https://trac.ffmpeg.org/wiki/Encode/VP9", t("FFMPEG VP9 Encoding Guide"))
link_2 = link("https://developers.google.com/media/vp9/hdr-encoding/", t("Google's VP9 HDR Encoding Guide"))
Expand Down
2 changes: 1 addition & 1 deletion fastflix/encoders/webp/command_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def build(fastflix: FastFlix):
return [
Command(
f"{beginning} -lossless {settings.lossless} -compression_level {settings.compression} "
f"-qscale {settings.qscale} -preset {settings.preset} {settings.extra} {ending}",
f"-qscale {settings.qscale} -preset {settings.preset} {ending}",
["ffmpeg", "output"],
False,
name="WebP",
Expand Down
Loading

0 comments on commit 45208b7

Please sign in to comment.