Skip to content

Commit

Permalink
Version 4.7.1 (#305)
Browse files Browse the repository at this point in the history
* Fixing #304 New profile Audio conversion downmix and bitrate issues (thanks to wynterca)
  • Loading branch information
cdgriffith authored Mar 11, 2022
1 parent f1830f4 commit 61519a3
Show file tree
Hide file tree
Showing 6 changed files with 77 additions and 10 deletions.
5 changes: 5 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## Version 4.7.1

* Fixing #304 New profile Audio conversion downmix and bitrate issues (thanks to wynterca)

## Version 4.7.0

* Adding #164 audio matching in profiles (thanks to bmcassagne)
Expand All @@ -10,6 +14,7 @@
* Adding OpenCL support for Remove HDR to speed it up
* Changing FFmpeg download to look for latest master GPL builds
* Fixing #296 low quality auto-crop due to high rounding, increasing accuracy from 16 to 2 pixels (thanks to Rayman24365)
* Fixing #302 unclear when VBV is enabled (thanks to Paul Huckstepp)
* Fixing concat builder behavior to work smoother
* Fixing thumbnail generation for concat images

Expand Down
24 changes: 24 additions & 0 deletions fastflix/data/languages.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6106,3 +6106,27 @@ Please load in a video to configure a new profile:
por: Por favor, carregue em um vídeo para configurar um novo perfil
swe: Ladda in en video för att konfigurera en ny profil
pol: Wczytaj film, jak skonfigurować nowy profil
10-bit:
eng: 10-bit
deu: 10-bit
fra: 10-bit
ita: 10-bit
spa: 10-bit
zho: 10位
jpn: 10ビット
rus: 10-бит
por: 10 bit
swe: 10-bit
pol: 10-bit
This encoder does not support duplicating audio tracks, please remove copied tracks!:
eng: This encoder does not support duplicating audio tracks, please remove copied tracks!
deu: Dieser Encoder unterstützt das Duplizieren von Audiospuren nicht, bitte entfernen Sie die kopierten Spuren!
fra: Cet encodeur ne prend pas en charge la duplication des pistes audio, veuillez supprimer les pistes copiées !
ita: Questo encoder non supporta la duplicazione di tracce audio, per favore rimuovi le tracce copiate!
spa: Este codificador no admite la duplicación de pistas de audio, por favor, elimine las pistas copiadas.
zho: 此编码器不支持复制音轨,请删除已复制的音轨!
jpn: このエンコーダーはオーディオトラックの複製をサポートしていません。コピーしたトラックを削除してください。
rus: Этот кодер не поддерживает дублирование звуковых дорожек, пожалуйста, удалите скопированные дорожки!
por: Este codificador não suporta a duplicação de faixas de áudio, por favor remova as faixas copiadas!
swe: Den här kodaren stöder inte duplicering av ljudspår, ta bort kopierade spår!
pol: Ten koder nie obsługuje duplikowania ścieżek audio, usuń skopiowane ścieżki!
21 changes: 20 additions & 1 deletion fastflix/models/profiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
VCEEncCSettings,
)

from fastflix.encoders.common.audio import channel_list

__all__ = ["MatchItem", "MatchType", "AudioMatch", "Profile", "SubtitleMatch", "AdvancedOptions"]


Expand All @@ -47,7 +49,7 @@ class AudioMatch(BaseModel):
match_input: str = "*"
conversion: Optional[str] = None
bitrate: Optional[str] = None
downmix: Optional[int] = None
downmix: Optional[Union[str, int]] = None

@validator("match_type")
def match_type_must_be_enum(cls, v):
Expand All @@ -61,6 +63,23 @@ def match_item_must_be_enum(cls, v):
return MatchType(v[0])
return MatchItem(v)

@validator("downmix")
def downmix_as_string(cls, v):
fixed = {1: "monoo", 2: "stereo", 3: "2.1", 4: "3.1", 5: "5.0", 6: "5.1", 7: "6.1", 8: "7.1"}
if isinstance(v, str) and v.isnumeric():
v = int(v)
if isinstance(v, int):
if v in fixed:
return fixed[v]
return None
return v

@validator("bitrate")
def bitrate_k_end(cls, v):
if v and not v.endswith("k"):
return f"{v}k"
return v


class SubtitleMatch(BaseModel):
match_type: Union[MatchType, List[MatchType]]
Expand Down
2 changes: 1 addition & 1 deletion fastflix/version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__version__ = "4.7.0"
__version__ = "4.7.1"
__author__ = "Chris Griffith"
26 changes: 22 additions & 4 deletions fastflix/widgets/panels/audio_panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -437,11 +437,21 @@ def gen_track(
all_info=audio_track,
disable_dup=disable_dups,
)

if conversion:
new_track.widgets.convert_to.setCurrentText(conversion)
new_track.widgets.convert_bitrate.setCurrentText(bitrate)
if downmix and downmix < audio_track.channels:
new_track.widgets.downmix.setCurrentIndex(downmix)
# Downmix must come first
if downmix:
new_track.widgets.downmix.setCurrentText(downmix)
if conversion in lossless:
new_track.widgets.convert_bitrate.setDisabled(True)
else:
if bitrate not in [
new_track.widgets.convert_bitrate.itemText(i)
for i in range(new_track.widgets.convert_bitrate.count())
]:
new_track.widgets.convert_bitrate.addItem(bitrate)
new_track.widgets.convert_bitrate.setCurrentText(bitrate)
return new_track

# First populate all original tracks and disable them
Expand Down Expand Up @@ -574,7 +584,15 @@ def reload(self, original_tracks: List[AudioTrack], audio_formats):

new_track.widgets.downmix.setCurrentText(track.downmix)
new_track.widgets.convert_to.setCurrentText(track.conversion_codec)
new_track.widgets.convert_bitrate.setCurrentText(track.conversion_bitrate)
if track.conversion_codec in lossless:
new_track.widgets.convert_bitrate.setDisabled(True)
else:
if track.conversion_bitrate not in [
new_track.widgets.convert_bitrate.itemText(i)
for i in range(new_track.widgets.convert_bitrate.count())
]:
new_track.widgets.convert_bitrate.addItem(track.conversion_bitrate)
new_track.widgets.convert_bitrate.setCurrentText(track.conversion_bitrate)
new_track.widgets.title.setText(track.title)
if track.language:
new_track.widgets.language.setCurrentText(Lang(track.language).name)
Expand Down
9 changes: 5 additions & 4 deletions fastflix/widgets/windows/profile_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
)
from fastflix.models.profiles import AudioMatch, Profile, MatchItem, MatchType, AdvancedOptions
from fastflix.shared import error_message
from fastflix.encoders.common.audio import channel_list

language_list = sorted((k for k, v in Lang._data["name"].items() if v["pt2B"] and v["pt1"]), key=lambda x: x.lower())

Expand Down Expand Up @@ -96,7 +97,7 @@ def __init__(self, parent_list, app, main, parent, index):
self.grid.addWidget(self.kill_myself, 0, 5, 1, 5)

self.downmix = QtWidgets.QComboBox()
self.downmix.addItems(["No Downmix"] + [str(x) for x in range(1, 16)])
self.downmix.addItems([t("No Downmix")] + list(channel_list.keys()))
self.downmix.setCurrentIndex(0)
self.downmix.view().setFixedWidth(self.downmix.minimumSizeHint().width() + 50)

Expand All @@ -106,7 +107,7 @@ def __init__(self, parent_list, app, main, parent, index):
self.convert_to.view().setFixedWidth(self.convert_to.minimumSizeHint().width() + 50)

self.bitrate = QtWidgets.QComboBox()
self.bitrate.addItems([str(x) for x in range(32, 1024, 32)])
self.bitrate.addItems([f"{x}k" for x in range(32, 1024, 32)])
self.bitrate.view().setFixedWidth(self.bitrate.minimumSizeHint().width() + 50)

self.bitrate.setDisabled(True)
Expand Down Expand Up @@ -166,7 +167,7 @@ def get_settings(self):
match_input=match_input_value,
conversion=self.convert_to.currentText() if self.convert_to.currentIndex() > 0 else None,
bitrate=self.bitrate.currentText(),
downmix=self.downmix.currentIndex(),
downmix=self.downmix.currentText(),
)


Expand Down Expand Up @@ -343,7 +344,7 @@ def __init__(self, app: FastFlixApp, main, *args, **kwargs):
self.main = main
self.config_file = self.app.fastflix.config.config_path
self.setWindowTitle(t("New Profile"))
self.setMinimumSize(500, 450)
self.setMinimumSize(500, 600)
layout = QtWidgets.QGridLayout()

profile_name_label = QtWidgets.QLabel(t("Profile Name"))
Expand Down

0 comments on commit 61519a3

Please sign in to comment.