WIP fix some typing stuff

This commit is contained in:
RealStickman 2022-10-24 11:03:09 +02:00
parent 4436528512
commit bd241c3b6f

View File

@ -14,8 +14,10 @@ from collections import OrderedDict
import json
from typing import Union, Any
# encoding options used
encoding = {
encoding: dict[str, Any] = {
"libx264": {
"crf": [10, 14, 16, 18, 20, 22, 25],
"presets": [
@ -57,8 +59,8 @@ def now():
def write_line(
codec: str,
crf: str,
preset: str,
crf: int,
preset: Union[str, int],
infile: str,
outfilesize: float,
enctime: int,
@ -70,8 +72,8 @@ def write_line(
Parameters:
codec (str): Codec used
crf (str): CRF used
preset (str): Preset used
crf (int): CRF used
preset (str/int): Preset used
infile (str): Input file name
outfilesize (float): Size of output file
enctime (int): Time to encode
@ -94,7 +96,9 @@ def write_line(
)
def encode_general(inputfile: str, outputfile: str, codec: str, crf: str, preset: str):
def encode_general(
inputfile: str, outputfile: str, codec: str, crf: int, preset: Union[str, int]
):
"""
General encoding function
@ -102,8 +106,8 @@ def encode_general(inputfile: str, outputfile: str, codec: str, crf: str, preset
inputfile (str): Path to input file
outputfile (str): Path to output file
codec (str): Codec used
crf (str): CRF value
preset (str): Choosen preset
crf (int): CRF value
preset (str/int): Choosen preset
"""
ff = ffmpy.FFmpeg(
inputs={inputfile: None},
@ -119,15 +123,15 @@ def encode_general(inputfile: str, outputfile: str, codec: str, crf: str, preset
return ff
def encode_libaom(inputfile: str, outputfile: str, crf: str, preset: str):
def encode_libaom(inputfile: str, outputfile: str, crf: int, preset: Union[str, int]):
"""
Encoding with libaom
Parameters:
inputfile (str): Path to input file
outputfile (str): Path to output file
crf (str): CRF value
preset (str): Choosen preset
crf (int): CRF value
preset (str/int): Choosen preset
"""
ff = ffmpy.FFmpeg(
inputs={inputfile: None},