Skip to content

Commit

Permalink
Version 4.5.1 (#463)
Browse files Browse the repository at this point in the history
* Fixing #460 QSVEncC not listed as encoder with FastFlix 5.4.0 (thanks to zedfreak)
* Fixing #451 x265 presets and tunes not being applied properly (thanks to HannesJo0139)
* Fixing #442 improper options passed to rigaya's encoders for non libavformat readers (thanks to Joet73)
* Fixing poetry issues by using setuptools instead
  • Loading branch information
cdgriffith authored Apr 20, 2023
1 parent ad86c4b commit a233f51
Show file tree
Hide file tree
Showing 34 changed files with 924 additions and 221 deletions.
26 changes: 7 additions & 19 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,20 +30,14 @@ jobs:
- name: Install PySide6 apt Requirements
run: |
sudo apt update
sudo apt install libopengl0 freeglut3 freeglut3-dev libxcb-icccm4 libxkbcommon-x11-0 libxcb-xkb1 libxcb-render-util0 libxcb-randr0 libxcb-keysyms1 libxcb-image0 libxcb-shape0-dev -y
sudo apt install libopengl0 freeglut3 freeglut3-dev libxcb-icccm4 libxkbcommon-x11-0 libxcb-xkb1 libxcb-render-util0 libxcb-randr0 libxcb-keysyms1 libxcb-image0 libxcb-shape0-dev libxcb-cursor-dev -y
if: ${{ startsWith(matrix.os, 'ubuntu') }}

- name: Install Python Dependencies
run: |
python -m pip install --upgrade pip setuptools poetry --ignore-installed
poetry config virtualenvs.create false --local
- name: Poetry Install
run: poetry install --with dev --with test
continue-on-error: true

- name: Poetry Install 2
run: poetry install --with dev --with test
python -m pip install --upgrade pip setuptools --ignore-installed
pip install .
pip install .[develop]
- name: Grab iso-639 lists
run: |
Expand Down Expand Up @@ -94,15 +88,9 @@ jobs:

- name: Install Python Dependencies
run: |
python -m pip install --upgrade pip setuptools poetry --ignore-installed
poetry config virtualenvs.create false --local
- name: Poetry Install
run: poetry install --with dev
continue-on-error: true

- name: Poetry Install 2
run: poetry install --with dev
python -m pip install --upgrade pip setuptools --ignore-installed
pip install .
pip install .[develop]
- name: Grab iso-639 lists
Expand Down
37 changes: 37 additions & 0 deletions .github/workflows/pythonpublish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# This workflow will upload a Python Package using Twine when a release is created
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries

name: Upload Python Package

on:
release:
types: [ created ]

jobs:
deploy-generic:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'

- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine --upgrade
- name: Build and Publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}

run: |
pip install -q build
python -m build --wheel
twine upload dist/*.whl
12 changes: 3 additions & 9 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,9 @@ jobs:
- name: Install requirements
run: |
python -m pip install --upgrade pip setuptools poetry
poetry config virtualenvs.create false --local
- name: Poetry Install
run: poetry install --with dev
continue-on-error: true

- name: Poetry Install 2
run: poetry install --with dev
python -m pip install --upgrade pip setuptools
pip install .
pip install .[develop]
- name: Run tests
env:
Expand Down
7 changes: 7 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

## Version 5.4.1

* Fixing #460 QSVEncC not listed as encoder with FastFlix 5.4.0 (thanks to zedfreak)
* Fixing #451 x265 presets and tunes not being applied properly (thanks to HannesJo0139)
* Fixing #442 improper options passed to rigaya's encoders for non libavformat readers (thanks to Joet73)
* Fixing poetry issues by using setuptools instead

## Version 5.4.0

* Adding #389 unlock GPU encoders by checking for supported codec (thanks to F.O.R.A.R.T.)
Expand Down
9 changes: 5 additions & 4 deletions FastFlix_Nix_OneFile.spec
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# -*- mode: python ; coding: utf-8 -*-
from PyInstaller.utils.hooks import collect_submodules
import toml

block_cipher = None

Expand All @@ -12,10 +13,10 @@ for root, dirs, files in os.walk('fastflix'):
all_fastflix_files.append((os.path.join(root,file), root))

all_imports = collect_submodules('pydantic') + ['dataclasses', 'colorsys', 'typing_extensions', 'box']
with open("requirements.txt", "r") as reqs:
for line in reqs:
package = line.split("[")[0].split("=")[0].split(">")[0].split("<")[0].replace('"', '').replace("'", '').rstrip("~").strip()
if package not in ("pyinstaller", "pypiwin32"):
with open("pyproject.toml") as f:
for line in toml.load(f)["project"]["dependencies"]:
package = line.split("[")[0].split("=")[0].split(">")[0].split("<")[0].replace('"', '').replace("'",'').rstrip("~").strip()
if package not in ("pyinstaller"):
all_imports.append(package)

a = Analysis(['fastflix/__main__.py'],
Expand Down
9 changes: 5 additions & 4 deletions FastFlix_Windows_Installer.spec
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# -*- mode: python ; coding: utf-8 -*-
from PyInstaller.utils.hooks import collect_submodules
import toml

block_cipher = None

Expand All @@ -12,10 +13,10 @@ for root, dirs, files in os.walk('fastflix'):
all_fastflix_files.append((os.path.join(root,file), root))

all_imports = collect_submodules('pydantic') + ['dataclasses', 'colorsys', 'typing_extensions', 'box']
with open("requirements.txt", "r") as reqs:
for line in reqs:
package = line.split("[")[0].split("=")[0].split(">")[0].split("<")[0].replace('"', '').replace("'", '').rstrip("~").strip()
if package not in ("pyinstaller", "pypiwin32"):
with open("pyproject.toml") as f:
for line in toml.load(f)["project"]["dependencies"]:
package = line.split("[")[0].split("=")[0].split(">")[0].split("<")[0].replace('"', '').replace("'",'').rstrip("~").strip()
if package not in ("pyinstaller"):
all_imports.append(package)

a = Analysis(['fastflix\\__main__.py'],
Expand Down
8 changes: 5 additions & 3 deletions FastFlix_Windows_OneFile.spec
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# -*- mode: python ; coding: utf-8 -*-
import os
import toml

from PyInstaller.utils.hooks import collect_submodules

Expand All @@ -14,9 +15,10 @@ for root, dirs, files in os.walk('fastflix'):
all_fastflix_files.append((os.path.join(root,file), root))

all_imports = collect_submodules('pydantic') + ['dataclasses', 'colorsys', 'typing_extensions', 'box']
with open("requirements.txt", "r") as reqs:
for line in reqs:
package = line.split("[")[0].split("=")[0].split(">")[0].split("<")[0].replace('"', '').replace("'", '').rstrip("~").strip()

with open("pyproject.toml") as f:
for line in toml.load(f)["project"]["dependencies"]:
package = line.split("[")[0].split("=")[0].split(">")[0].split("<")[0].replace('"', '').replace("'",'').rstrip("~").strip()
if package not in ("pyinstaller"):
all_imports.append(package)

Expand Down
10 changes: 0 additions & 10 deletions build.py

This file was deleted.

43 changes: 42 additions & 1 deletion fastflix/encoders/common/encc_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,52 @@

from fastflix.models.video import SubtitleTrack, AudioTrack
from fastflix.encoders.common.audio import lossless

from fastflix.models.fastflix import FastFlix

logger = logging.getLogger("fastflix")


def rigaya_avformat_reader(fastflix: FastFlix) -> str:
# Avisynth reader avs
# VapourSynth reader vpy
# avi reader avi
# y4m reader y4m
# raw reader yuv
# avhw/avsw reader others
ending = fastflix.current_video.source.suffix
if fastflix.current_video.video_settings.video_encoder_settings.decoder not in ("Hardware", "Software"):
if ending.lower() in (".avs", ".vpy", ".avi", ".y4m", ".yuv"):
return ""
return "--avhw" if fastflix.current_video.video_settings.video_encoder_settings.decoder == "Hardware" else "--avsw"


def rigaya_auto_options(fastflix: FastFlix) -> str:
reader_format = rigaya_avformat_reader(fastflix)
if not reader_format:
output = ""
if fastflix.current_video.video_settings.color_space:
output += f"--colormatrix {fastflix.current_video.video_settings.color_space} "
if fastflix.current_video.video_settings.color_transfer:
output += f"--transfer {fastflix.current_video.video_settings.color_transfer} "
if fastflix.current_video.video_settings.color_primaries:
output += f"--colorprim {fastflix.current_video.video_settings.color_primaries} "
return output

return " ".join(
[
reader_format,
"--chromaloc auto",
"--colorrange auto",
"--colormatrix",
(fastflix.current_video.video_settings.color_space or "auto"),
"--transfer",
(fastflix.current_video.video_settings.color_transfer or "auto"),
"--colorprim",
(fastflix.current_video.video_settings.color_primaries or "auto"),
]
)


def get_stream_pos(streams) -> dict:
return {x.index: i for i, x in enumerate(streams, start=1)}

Expand Down
92 changes: 90 additions & 2 deletions fastflix/encoders/hevc_x265/settings_panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -402,21 +402,109 @@ def init_preset(self):
"preset: The slower the preset, the better the compression and quality\n"
"Slow is highest personal recommenced, as past that is much smaller gains"
),
connect="default",
connect=self.preset_update,
opt="preset",
)
return layout

def preset_update(self):
def set_aq(num):
if self.widgets.tune.currentIndex() == 0:
self.widgets.aq_mode.setCurrentIndex(num)
if self.widgets["tune"].currentText() == "animation":
bframes = 5
if self.widgets.preset.currentIndex() >= 2:
bframes = 6
if self.widgets.preset.currentIndex() >= 7:
bframes = 10
self.widgets.bframes.setCurrentIndex(bframes)

if self.widgets["preset"].currentText() == "ultrafast":
self.widgets.bframes.setCurrentIndex(3)
self.widgets.b_adapt.setCurrentIndex(0)
set_aq(0)
elif self.widgets["preset"].currentText() == "superfast":
self.widgets.bframes.setCurrentIndex(3)
self.widgets.b_adapt.setCurrentIndex(0)
set_aq(0)
elif self.widgets["preset"].currentText() == "veryfast":
self.widgets.bframes.setCurrentIndex(4)
self.widgets.b_adapt.setCurrentIndex(0)
set_aq(2)
elif self.widgets["preset"].currentText() == "faster":
self.widgets.bframes.setCurrentIndex(4)
self.widgets.b_adapt.setCurrentIndex(0)
set_aq(2)
elif self.widgets["preset"].currentText() == "fast":
self.widgets.bframes.setCurrentIndex(4)
self.widgets.b_adapt.setCurrentIndex(0)
set_aq(2)
elif self.widgets["preset"].currentText() == "medium":
self.widgets.bframes.setCurrentIndex(4)
self.widgets.b_adapt.setCurrentIndex(2)
set_aq(2)
elif self.widgets["preset"].currentText() == "slow":
self.widgets.bframes.setCurrentIndex(4)
self.widgets.b_adapt.setCurrentIndex(2)
set_aq(2)
elif self.widgets["preset"].currentText() == "slower":
self.widgets.bframes.setCurrentIndex(8)
self.widgets.b_adapt.setCurrentIndex(2)
set_aq(2)
elif self.widgets["preset"].currentText() == "veryslow":
self.widgets.bframes.setCurrentIndex(8)
self.widgets.b_adapt.setCurrentIndex(2)
set_aq(2)
elif self.widgets["preset"].currentText() == "placebo":
self.widgets.bframes.setCurrentIndex(8)
self.widgets.b_adapt.setCurrentIndex(2)
set_aq(2)

def init_tune(self):
return self._add_combo_box(
label="Tune",
widget_name="tune",
options=["default", "psnr", "ssim", "grain", "zerolatency", "fastdecode", "animation"],
tooltip="tune: Tune the settings for a particular type of source or situation",
connect="default",
connect=self.tune_update,
opt="tune",
)

def tune_update(self):
self.widgets.aq_mode.setEnabled(True)
self.widgets.bframes.setEnabled(True)
self.widgets.b_adapt.setEnabled(True)
self.widgets.frame_threads.setEnabled(True)
self.widgets.aq_mode.setCurrentIndex(2)
self.widgets.bframes.setCurrentIndex(4)
self.widgets.b_adapt.setCurrentIndex(2)
self.widgets.frame_threads.setCurrentIndex(0)

if self.widgets["tune"].currentText() == "grain":
self.widgets.aq_mode.setCurrentIndex(0)
self.widgets.aq_mode.setEnabled(False)
self.widgets.bframes.setCurrentIndex(4)
self.widgets.b_adapt.setCurrentIndex(2)
elif self.widgets["tune"].currentText() == "psnr":
self.widgets.aq_mode.setCurrentIndex(0)
self.widgets.aq_mode.setEnabled(False)
self.widgets.bframes.setCurrentIndex(4)
self.widgets.b_adapt.setCurrentIndex(2)
elif self.widgets["tune"].currentText() == "zerolatency":
self.widgets.bframes.setCurrentIndex(0)
self.widgets.b_adapt.setCurrentIndex(0)
self.widgets.frame_treahds.setCurrentIndex(1)
self.widgets.bframes.setEnabled(False)
self.widgets.b_adapt.setEnabled(False)
self.widgets.frame_threads.setEnabled(False)
elif self.widgets["tune"].currentText() == "animation":
bframes = 5
if self.widgets.preset.currentIndex() >= 2:
bframes = 6
if self.widgets.preset.currentIndex() >= 7:
bframes = 10
self.widgets.bframes.setCurrentIndex(bframes)

def init_profile(self):
return self._add_combo_box(
label="Profile_encoderopt",
Expand Down
Loading

0 comments on commit a233f51

Please sign in to comment.