yt_common: better audio handling
This commit is contained in:
parent
75a0d3b2aa
commit
62c8355fb1
@ -1,10 +1,11 @@
|
||||
import vapoursynth as vs
|
||||
|
||||
from tensura_common import TenSuraS2BDConfig, antialias, deband, denoise, descale, edgefix, finalize, regrain
|
||||
from tensura_common import (TenSuraS2Config, TenSuraS2BDSource, antialias, deband,
|
||||
denoise, descale, edgefix, finalize, regrain)
|
||||
|
||||
from yt_common.automation import SelfRunner, Zone
|
||||
from yt_common.chapters import Chapter
|
||||
from yt_common.source import FileTrim, SimpleSource
|
||||
from yt_common.source import FileTrim
|
||||
|
||||
from lvsfunc.mask import BoundingBox
|
||||
from lvsfunc.misc import replace_ranges
|
||||
@ -15,9 +16,9 @@ from typing import List, Tuple
|
||||
import os
|
||||
|
||||
EPNUM: int = int(os.path.basename(os.path.splitext(__file__)[0]))
|
||||
CONFIG: TenSuraS2BDConfig = TenSuraS2BDConfig(EPNUM)
|
||||
CONFIG: TenSuraS2Config = TenSuraS2Config(EPNUM)
|
||||
BDMV: str = "../bdmv/[BDMV][210326][Tensei Shitara Slime Datta Ken 2nd Season][Vol.1]/BDMV/STREAM"
|
||||
SOURCE: SimpleSource = SimpleSource(
|
||||
SOURCE: TenSuraS2BDSource = TenSuraS2BDSource(
|
||||
FileTrim(os.path.join(BDMV, "00006.m2ts"), (24, -50))
|
||||
)
|
||||
|
||||
|
@ -1,10 +1,11 @@
|
||||
import vapoursynth as vs
|
||||
|
||||
from tensura_common import TenSuraS2BDConfig, antialias, deband, denoise, descale, edgefix, finalize, regrain
|
||||
from tensura_common import (TenSuraS2Config, TenSuraS2BDSource, antialias, deband,
|
||||
denoise, descale, edgefix, finalize, regrain)
|
||||
|
||||
from yt_common.automation import SelfRunner
|
||||
from yt_common.chapters import Chapter
|
||||
from yt_common.source import FileTrim, SimpleSource
|
||||
from yt_common.source import FileTrim
|
||||
|
||||
from lvsfunc.misc import replace_ranges
|
||||
from lvsfunc.types import Range
|
||||
@ -14,9 +15,9 @@ from typing import List
|
||||
import os
|
||||
|
||||
EPNUM: int = int(os.path.basename(os.path.splitext(__file__)[0]))
|
||||
CONFIG: TenSuraS2BDConfig = TenSuraS2BDConfig(EPNUM)
|
||||
CONFIG: TenSuraS2Config = TenSuraS2Config(EPNUM)
|
||||
BDMV: str = "../bdmv/[BDMV][210326][Tensei Shitara Slime Datta Ken 2nd Season][Vol.1]/BDMV/STREAM"
|
||||
SOURCE: SimpleSource = SimpleSource(
|
||||
SOURCE: TenSuraS2BDSource = TenSuraS2BDSource(
|
||||
FileTrim(os.path.join(BDMV, "00007.m2ts"), (None, -49))
|
||||
)
|
||||
|
||||
|
@ -1,10 +1,11 @@
|
||||
import vapoursynth as vs
|
||||
|
||||
from tensura_common import TenSuraS2BDConfig, antialias, deband, denoise, descale, edgefix, finalize, regrain
|
||||
from tensura_common import (TenSuraS2Config, TenSuraS2BDSource, antialias, deband,
|
||||
denoise, descale, edgefix, finalize, regrain)
|
||||
|
||||
from yt_common.automation import SelfRunner, Zone
|
||||
from yt_common.chapters import Chapter
|
||||
from yt_common.source import FileTrim, SimpleSource
|
||||
from yt_common.source import FileTrim
|
||||
|
||||
from lvsfunc.misc import replace_ranges
|
||||
from lvsfunc.types import Range
|
||||
@ -14,9 +15,9 @@ from typing import List
|
||||
import os
|
||||
|
||||
EPNUM: int = int(os.path.basename(os.path.splitext(__file__)[0]))
|
||||
CONFIG: TenSuraS2BDConfig = TenSuraS2BDConfig(EPNUM)
|
||||
CONFIG: TenSuraS2Config = TenSuraS2Config(EPNUM)
|
||||
BDMV: str = "../bdmv/[BDMV][210326][Tensei Shitara Slime Datta Ken 2nd Season][Vol.1]/BDMV/STREAM"
|
||||
SOURCE: SimpleSource = SimpleSource(
|
||||
SOURCE: TenSuraS2BDSource = TenSuraS2BDSource(
|
||||
FileTrim(os.path.join(BDMV, "00008.m2ts"), (None, -50))
|
||||
)
|
||||
|
||||
|
@ -1,10 +1,11 @@
|
||||
import vapoursynth as vs
|
||||
|
||||
from tensura_common import TenSuraS2BDConfig, antialias, deband, denoise, descale, edgefix, finalize, regrain
|
||||
from tensura_common import (TenSuraS2Config, TenSuraS2BDSource, antialias, deband,
|
||||
denoise, descale, edgefix, finalize, regrain)
|
||||
|
||||
from yt_common.automation import SelfRunner
|
||||
from yt_common.chapters import Chapter
|
||||
from yt_common.source import FileTrim, SimpleSource
|
||||
from yt_common.source import FileTrim
|
||||
|
||||
from lvsfunc.mask import BoundingBox
|
||||
from lvsfunc.misc import replace_ranges
|
||||
@ -15,9 +16,9 @@ from typing import List, Tuple
|
||||
import os
|
||||
|
||||
EPNUM: int = int(os.path.basename(os.path.splitext(__file__)[0]))
|
||||
CONFIG: TenSuraS2BDConfig = TenSuraS2BDConfig(EPNUM)
|
||||
CONFIG: TenSuraS2Config = TenSuraS2Config(EPNUM)
|
||||
BDMV: str = "../bdmv/[BDMV][210326][Tensei Shitara Slime Datta Ken 2nd Season][Vol.1]/BDMV/STREAM"
|
||||
SOURCE: SimpleSource = SimpleSource(
|
||||
SOURCE: TenSuraS2BDSource = TenSuraS2BDSource(
|
||||
FileTrim(os.path.join(BDMV, "00009.m2ts"), (None, -51))
|
||||
)
|
||||
|
||||
|
@ -1,10 +1,11 @@
|
||||
import vapoursynth as vs
|
||||
|
||||
from tensura_common import TenSuraS2BDConfig, antialias, deband, denoise, descale, edgefix, finalize, regrain
|
||||
from tensura_common import (TenSuraS2Config, TenSuraS2BDSource, antialias, deband,
|
||||
denoise, descale, edgefix, finalize, regrain)
|
||||
|
||||
from yt_common.automation import SelfRunner
|
||||
from yt_common.chapters import Chapter
|
||||
from yt_common.source import FileTrim, SimpleSource
|
||||
from yt_common.source import FileTrim
|
||||
|
||||
from lvsfunc.mask import BoundingBox
|
||||
from lvsfunc.misc import replace_ranges
|
||||
@ -15,9 +16,9 @@ from typing import List, Tuple
|
||||
import os
|
||||
|
||||
EPNUM: int = int(os.path.basename(os.path.splitext(__file__)[0]))
|
||||
CONFIG: TenSuraS2BDConfig = TenSuraS2BDConfig(EPNUM)
|
||||
CONFIG: TenSuraS2Config = TenSuraS2Config(EPNUM)
|
||||
BDMV: str = "../bdmv/[BDMV][210326][Tensei Shitara Slime Datta Ken 2nd Season][Vol.1]/BDMV/STREAM"
|
||||
SOURCE: SimpleSource = SimpleSource(
|
||||
SOURCE: TenSuraS2BDSource = TenSuraS2BDSource(
|
||||
FileTrim(os.path.join(BDMV, "00010.m2ts"), (None, -24))
|
||||
)
|
||||
|
||||
|
@ -1,10 +1,11 @@
|
||||
import vapoursynth as vs
|
||||
|
||||
from tensura_common import TenSuraS2BDConfig, antialias, deband, denoise, descale, edgefix, finalize, regrain
|
||||
from tensura_common import (TenSuraS2Config, TenSuraS2BDSource, antialias, deband,
|
||||
denoise, descale, edgefix, finalize, regrain)
|
||||
|
||||
from yt_common.automation import SelfRunner, Zone
|
||||
from yt_common.chapters import Chapter
|
||||
from yt_common.source import FileTrim, SimpleSource
|
||||
from yt_common.source import FileTrim
|
||||
|
||||
from lvsfunc.mask import BoundingBox
|
||||
from lvsfunc.misc import replace_ranges
|
||||
@ -15,9 +16,9 @@ from typing import List, Tuple
|
||||
import os
|
||||
|
||||
EPNUM: int = int(os.path.basename(os.path.splitext(__file__)[0]))
|
||||
CONFIG: TenSuraS2BDConfig = TenSuraS2BDConfig(EPNUM)
|
||||
CONFIG: TenSuraS2Config = TenSuraS2Config(EPNUM)
|
||||
BDMV: str = "../bdmv/[BDMV][210326][Tensei Shitara Slime Datta Ken 2nd Season][Vol.1]/BDMV/STREAM"
|
||||
SOURCE: SimpleSource = SimpleSource(
|
||||
SOURCE: TenSuraS2BDSource = TenSuraS2BDSource(
|
||||
FileTrim(os.path.join(BDMV, "00011.m2ts"), (24, -25))
|
||||
)
|
||||
|
||||
|
@ -1,10 +1,11 @@
|
||||
import vapoursynth as vs
|
||||
|
||||
from tensura_common import TenSuraS2BDConfig, antialias, deband, denoise, descale, edgefix, finalize, regrain
|
||||
from tensura_common import (TenSuraS2Config, TenSuraS2BDSource, antialias, deband,
|
||||
denoise, descale, edgefix, finalize, regrain)
|
||||
|
||||
from yt_common.automation import SelfRunner, Zone
|
||||
from yt_common.chapters import Chapter
|
||||
from yt_common.source import FileTrim, SimpleSource
|
||||
from yt_common.source import FileTrim
|
||||
|
||||
from lvsfunc.mask import BoundingBox
|
||||
from lvsfunc.misc import replace_ranges
|
||||
@ -15,9 +16,9 @@ from typing import List, Tuple
|
||||
import os
|
||||
|
||||
EPNUM: int = int(os.path.basename(os.path.splitext(__file__)[0]))
|
||||
CONFIG: TenSuraS2BDConfig = TenSuraS2BDConfig(EPNUM)
|
||||
CONFIG: TenSuraS2Config = TenSuraS2Config(EPNUM)
|
||||
BDMV: str = "../bdmv/[BDMV][210526][Tensei Shitara Slime Datta Ken 2nd Season][Vol.2]/BDMV/STREAM"
|
||||
SOURCE: SimpleSource = SimpleSource(
|
||||
SOURCE: TenSuraS2BDSource = TenSuraS2BDSource(
|
||||
FileTrim(os.path.join(BDMV, "00006.m2ts"), (24, -50))
|
||||
)
|
||||
|
||||
|
@ -1,10 +1,11 @@
|
||||
import vapoursynth as vs
|
||||
|
||||
from tensura_common import TenSuraS2BDConfig, antialias, deband, denoise, descale, edgefix, finalize, regrain
|
||||
from tensura_common import (TenSuraS2Config, TenSuraS2BDSource, antialias, deband,
|
||||
denoise, descale, edgefix, finalize, regrain)
|
||||
|
||||
from yt_common.automation import SelfRunner, Zone
|
||||
from yt_common.chapters import Chapter
|
||||
from yt_common.source import FileTrim, SimpleSource
|
||||
from yt_common.source import FileTrim
|
||||
|
||||
from lvsfunc.mask import BoundingBox
|
||||
from lvsfunc.misc import replace_ranges
|
||||
@ -15,9 +16,9 @@ from typing import List, Tuple
|
||||
import os
|
||||
|
||||
EPNUM: int = int(os.path.basename(os.path.splitext(__file__)[0]))
|
||||
CONFIG: TenSuraS2BDConfig = TenSuraS2BDConfig(EPNUM)
|
||||
CONFIG: TenSuraS2Config = TenSuraS2Config(EPNUM)
|
||||
BDMV: str = "../bdmv/[BDMV][210526][Tensei Shitara Slime Datta Ken 2nd Season][Vol.2]/BDMV/STREAM"
|
||||
SOURCE: SimpleSource = SimpleSource(
|
||||
SOURCE: TenSuraS2BDSource = TenSuraS2BDSource(
|
||||
FileTrim(os.path.join(BDMV, "00007.m2ts"), (None, -51))
|
||||
)
|
||||
|
||||
|
@ -1,10 +1,11 @@
|
||||
import vapoursynth as vs
|
||||
|
||||
from tensura_common import TenSuraS2BDConfig, antialias, deband, denoise, descale, edgefix, finalize, regrain
|
||||
from tensura_common import (TenSuraS2Config, TenSuraS2BDSource, antialias, deband,
|
||||
denoise, descale, edgefix, finalize, regrain)
|
||||
|
||||
from yt_common.automation import SelfRunner
|
||||
from yt_common.chapters import Chapter
|
||||
from yt_common.source import FileTrim, SimpleSource
|
||||
from yt_common.source import FileTrim
|
||||
|
||||
from lvsfunc.mask import BoundingBox
|
||||
from lvsfunc.misc import replace_ranges
|
||||
@ -15,9 +16,9 @@ from typing import List, Tuple
|
||||
import os
|
||||
|
||||
EPNUM: int = int(os.path.basename(os.path.splitext(__file__)[0]))
|
||||
CONFIG: TenSuraS2BDConfig = TenSuraS2BDConfig(EPNUM)
|
||||
CONFIG: TenSuraS2Config = TenSuraS2Config(EPNUM)
|
||||
BDMV: str = "../bdmv/[BDMV][210526][Tensei Shitara Slime Datta Ken 2nd Season][Vol.2]/BDMV/STREAM"
|
||||
SOURCE: SimpleSource = SimpleSource(
|
||||
SOURCE: TenSuraS2BDSource = TenSuraS2BDSource(
|
||||
FileTrim(os.path.join(BDMV, "00008.m2ts"), (None, -50))
|
||||
)
|
||||
|
||||
|
@ -1,10 +1,11 @@
|
||||
import vapoursynth as vs
|
||||
|
||||
from tensura_common import TenSuraS2BDConfig, antialias, deband, denoise, descale, edgefix, finalize, regrain
|
||||
from tensura_common import (TenSuraS2Config, TenSuraS2BDSource, antialias, deband,
|
||||
denoise, descale, edgefix, finalize, regrain)
|
||||
|
||||
from yt_common.automation import SelfRunner
|
||||
from yt_common.chapters import Chapter, Edition
|
||||
from yt_common.source import FileTrim, SimpleSource
|
||||
from yt_common.source import FileTrim
|
||||
|
||||
from lvsfunc.mask import BoundingBox
|
||||
from lvsfunc.misc import replace_ranges
|
||||
@ -15,9 +16,9 @@ from typing import List, Tuple
|
||||
import os
|
||||
|
||||
EPNUM: int = int(os.path.basename(os.path.splitext(__file__)[0]))
|
||||
CONFIG: TenSuraS2BDConfig = TenSuraS2BDConfig(EPNUM)
|
||||
CONFIG: TenSuraS2Config = TenSuraS2Config(EPNUM)
|
||||
BDMV: str = "../bdmv/[BDMV][210526][Tensei Shitara Slime Datta Ken 2nd Season][Vol.2]/BDMV/STREAM"
|
||||
SOURCE: SimpleSource = SimpleSource([
|
||||
SOURCE: TenSuraS2BDSource = TenSuraS2BDSource([
|
||||
FileTrim(os.path.join(BDMV, "00009.m2ts"), (None, None)),
|
||||
FileTrim(os.path.join(BDMV, "00010.m2ts"), (None, -49)),
|
||||
FileTrim(os.path.join(BDMV, "00016.m2ts"), (13348, 15699)),
|
||||
|
@ -1,10 +1,11 @@
|
||||
import vapoursynth as vs
|
||||
|
||||
from tensura_common import TenSuraS2BDConfig, antialias, deband, denoise, descale, edgefix, finalize, regrain
|
||||
from tensura_common import (TenSuraS2Config, TenSuraS2BDSource, antialias, deband,
|
||||
denoise, descale, edgefix, finalize, regrain)
|
||||
|
||||
from yt_common.automation import SelfRunner, Zone
|
||||
from yt_common.chapters import Chapter, Edition
|
||||
from yt_common.source import FileTrim, SimpleSource
|
||||
from yt_common.source import FileTrim
|
||||
|
||||
from lvsfunc.mask import BoundingBox
|
||||
from lvsfunc.misc import replace_ranges
|
||||
@ -15,9 +16,9 @@ from typing import List, Tuple
|
||||
import os
|
||||
|
||||
EPNUM: int = int(os.path.basename(os.path.splitext(__file__)[0]))
|
||||
CONFIG: TenSuraS2BDConfig = TenSuraS2BDConfig(EPNUM)
|
||||
CONFIG: TenSuraS2Config = TenSuraS2Config(EPNUM)
|
||||
BDMV: str = "../bdmv/[BDMV][210526][Tensei Shitara Slime Datta Ken 2nd Season][Vol.2]/BDMV/STREAM"
|
||||
SOURCE: SimpleSource = SimpleSource([
|
||||
SOURCE: TenSuraS2BDSource = TenSuraS2BDSource([
|
||||
FileTrim(os.path.join(BDMV, "00011.m2ts"), (None, -49)),
|
||||
FileTrim(os.path.join(BDMV, "00017.m2ts"), (None, 3158)),
|
||||
FileTrim(os.path.join(BDMV, "00017.m2ts"), (33342, 33927)),
|
||||
|
@ -1,10 +1,11 @@
|
||||
import vapoursynth as vs
|
||||
|
||||
from tensura_common import TenSuraS2BDConfig, antialias, deband, denoise, descale, edgefix, finalize, regrain
|
||||
from tensura_common import (TenSuraS2Config, TenSuraS2BDSource, antialias, deband,
|
||||
denoise, descale, edgefix, finalize, regrain)
|
||||
|
||||
from yt_common.automation import SelfRunner, Zone
|
||||
from yt_common.chapters import Chapter
|
||||
from yt_common.source import FileTrim, SimpleSource
|
||||
from yt_common.source import FileTrim
|
||||
|
||||
from lvsfunc.mask import BoundingBox
|
||||
from lvsfunc.misc import replace_ranges
|
||||
@ -14,10 +15,11 @@ from typing import List, Tuple
|
||||
|
||||
import os
|
||||
|
||||
|
||||
EPNUM: int = int(os.path.basename(os.path.splitext(__file__)[0]))
|
||||
CONFIG: TenSuraS2BDConfig = TenSuraS2BDConfig(EPNUM)
|
||||
CONFIG: TenSuraS2Config = TenSuraS2Config(EPNUM)
|
||||
BDMV: str = "../bdmv/[BDMV][210526][Tensei Shitara Slime Datta Ken 2nd Season][Vol.2]/BDMV/STREAM"
|
||||
SOURCE: SimpleSource = SimpleSource(
|
||||
SOURCE: TenSuraS2BDSource = TenSuraS2BDSource(
|
||||
FileTrim(os.path.join(BDMV, "00012.m2ts"), (None, -26))
|
||||
)
|
||||
|
||||
|
@ -1,9 +1,10 @@
|
||||
import vapoursynth as vs
|
||||
|
||||
from tensura_common import TenSuraS2BDConfig, antialias, deband, denoise, descale, edgefix, finalize, regrain
|
||||
from tensura_common import (TenSuraS2Config, TenSuraS2BDSource, antialias, deband,
|
||||
denoise, descale, edgefix, finalize, regrain)
|
||||
|
||||
from yt_common.automation import SelfRunner
|
||||
from yt_common.source import FileTrim, SimpleSource
|
||||
from yt_common.source import FileTrim
|
||||
|
||||
from lvsfunc.mask import BoundingBox
|
||||
from lvsfunc.misc import replace_ranges
|
||||
@ -14,9 +15,9 @@ from typing import List, Tuple
|
||||
import os
|
||||
|
||||
DESC: str = os.path.basename(os.path.splitext(__file__)[0])
|
||||
CONFIG: TenSuraS2BDConfig = TenSuraS2BDConfig(DESC)
|
||||
CONFIG: TenSuraS2Config = TenSuraS2Config(DESC)
|
||||
BDMV: str = "../bdmv/[BDMV][210526][Tensei Shitara Slime Datta Ken 2nd Season][Vol.2]/BDMV/STREAM"
|
||||
SOURCE: SimpleSource = SimpleSource(
|
||||
SOURCE: TenSuraS2BDSource = TenSuraS2BDSource(
|
||||
FileTrim(os.path.join(BDMV, "00015.m2ts"), (24, -24))
|
||||
)
|
||||
|
||||
|
@ -1,9 +1,10 @@
|
||||
import vapoursynth as vs
|
||||
|
||||
from tensura_common import TenSuraS2BDConfig, antialias, deband, denoise, descale, edgefix, finalize, regrain
|
||||
from tensura_common import (TenSuraS2Config, TenSuraS2BDSource, antialias, deband,
|
||||
denoise, descale, edgefix, finalize, regrain)
|
||||
|
||||
from yt_common.automation import SelfRunner
|
||||
from yt_common.source import FileTrim, SimpleSource
|
||||
from yt_common.source import FileTrim
|
||||
|
||||
from lvsfunc.mask import BoundingBox
|
||||
from lvsfunc.misc import replace_ranges
|
||||
@ -14,9 +15,9 @@ from typing import List, Tuple
|
||||
import os
|
||||
|
||||
DESC: str = os.path.basename(os.path.splitext(__file__)[0])
|
||||
CONFIG: TenSuraS2BDConfig = TenSuraS2BDConfig(DESC)
|
||||
CONFIG: TenSuraS2Config = TenSuraS2Config(DESC)
|
||||
BDMV: str = "../bdmv/[BDMV][210526][Tensei Shitara Slime Datta Ken 2nd Season][Vol.2]/BDMV/STREAM"
|
||||
SOURCE: SimpleSource = SimpleSource(
|
||||
SOURCE: TenSuraS2BDSource = TenSuraS2BDSource(
|
||||
FileTrim(os.path.join(BDMV, "00014.m2ts"), (24, -24))
|
||||
)
|
||||
|
||||
|
@ -1,11 +1,11 @@
|
||||
import vapoursynth as vs
|
||||
|
||||
from tensura_common import (TenSuraS2BDConfig, antialias, deband, denoise, descale,
|
||||
from tensura_common import (TenSuraS2Config, TenSuraS2BDSource, antialias, deband, denoise, descale,
|
||||
edgefix, finalize, megurumono_scenefilter, regrain)
|
||||
|
||||
from yt_common.automation import SelfRunner, Zone
|
||||
from yt_common.chapters import Chapter
|
||||
from yt_common.source import FileTrim, SimpleSource
|
||||
from yt_common.source import FileTrim
|
||||
|
||||
from lvsfunc.mask import BoundingBox
|
||||
from lvsfunc.misc import replace_ranges
|
||||
@ -16,9 +16,9 @@ from typing import List, Tuple
|
||||
import os
|
||||
|
||||
DESC: str = os.path.basename(os.path.splitext(__file__)[0])
|
||||
CONFIG: TenSuraS2BDConfig = TenSuraS2BDConfig(DESC)
|
||||
CONFIG: TenSuraS2Config = TenSuraS2Config(DESC)
|
||||
BDMV: str = "../bdmv/[BDMV][210326][Tensei Shitara Slime Datta Ken 2nd Season][Vol.1]/BDMV/STREAM"
|
||||
SOURCE: SimpleSource = SimpleSource(
|
||||
SOURCE: TenSuraS2BDSource = TenSuraS2BDSource(
|
||||
FileTrim(os.path.join(BDMV, "00013.m2ts"), (24, -24))
|
||||
)
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
from .config import TenSuraS2Config, TenSuraS2BDConfig, TenSuraS1BDConfig # noqa: F401
|
||||
from .config import (TenSuraS2Config, TenSuraS2Source, TenSuraS2BDSource, # noqa: F401
|
||||
TenSuraS1BDConfig, TenSuraS1BDSource)
|
||||
from .filter import (antialias, deband, denoise, descale, edgefix, finalize, # noqa: F401
|
||||
megurumono_scenefilter, regrain)
|
||||
|
@ -1,6 +1,8 @@
|
||||
from yt_common.config import Config, FlacMixin, OpusMixin
|
||||
from yt_common.audio import AudioStream, CodecPassthrough, CodecOpus, CodecFlac
|
||||
from yt_common.config import Config
|
||||
from yt_common.source import SimpleSource
|
||||
|
||||
from typing import Union
|
||||
from typing import List, Union
|
||||
|
||||
import os
|
||||
|
||||
@ -8,7 +10,7 @@ RESOLUTION: int = 1080
|
||||
DATAPATH: str = os.path.dirname(__file__)
|
||||
|
||||
|
||||
class TenSuraS1BDConfig(OpusMixin, Config):
|
||||
class TenSuraS1BDConfig(Config):
|
||||
def __init__(self, desc: Union[str, int]) -> None:
|
||||
super().__init__(
|
||||
desc,
|
||||
@ -19,6 +21,11 @@ class TenSuraS1BDConfig(OpusMixin, Config):
|
||||
)
|
||||
|
||||
|
||||
class TenSuraS1BDSource(SimpleSource):
|
||||
def audio_streams(self) -> List[AudioStream]:
|
||||
return [AudioStream(0, CodecOpus())]
|
||||
|
||||
|
||||
class TenSuraS2Config(Config):
|
||||
def __init__(self, desc: Union[str, int]) -> None:
|
||||
super().__init__(
|
||||
@ -30,5 +37,11 @@ class TenSuraS2Config(Config):
|
||||
)
|
||||
|
||||
|
||||
class TenSuraS2BDConfig(FlacMixin, TenSuraS2Config):
|
||||
pass
|
||||
class TenSuraS2Source(SimpleSource):
|
||||
def audio_streams(self) -> List[AudioStream]:
|
||||
return [AudioStream(0, CodecPassthrough())]
|
||||
|
||||
|
||||
class TenSuraS2BDSource(SimpleSource):
|
||||
def audio_streams(self) -> List[AudioStream]:
|
||||
return [AudioStream(0, CodecFlac())]
|
||||
|
@ -1 +1 @@
|
||||
from . import antialiasing, automation, chapters, config, data, deband, logging, scale, source # noqa: F401
|
||||
from . import antialiasing, audio, automation, chapters, config, data, deband, logging, scale, source # noqa: F401
|
||||
|
65
yt_common/yt_common/audio.py
Normal file
65
yt_common/yt_common/audio.py
Normal file
@ -0,0 +1,65 @@
|
||||
from abc import ABC, abstractmethod
|
||||
from subprocess import call
|
||||
from typing import List, NamedTuple
|
||||
|
||||
from .util import get_temp_filename
|
||||
|
||||
|
||||
class AudioEncoder(ABC):
|
||||
@abstractmethod
|
||||
def encode_audio(self, afile: str) -> str:
|
||||
pass
|
||||
|
||||
|
||||
class FFAudio(AudioEncoder):
|
||||
def encode_audio(self, afile: str) -> str:
|
||||
out = get_temp_filename(prefix="_ffaudio_encode_", suffix=".mka")
|
||||
ffmpeg_args = [
|
||||
"ffmpeg",
|
||||
"-hide_banner", "-loglevel", "panic",
|
||||
"-i", afile,
|
||||
"-y",
|
||||
"-map", "0:a",
|
||||
] + self.codec_args() + [out]
|
||||
print("+ " + " ".join(ffmpeg_args))
|
||||
call(ffmpeg_args)
|
||||
return out
|
||||
|
||||
@abstractmethod
|
||||
def codec_args(self) -> List[str]:
|
||||
pass
|
||||
|
||||
|
||||
class CodecPassthrough(AudioEncoder):
|
||||
def encode_audio(self, afile: str) -> str:
|
||||
return afile
|
||||
|
||||
|
||||
class CodecOpus(FFAudio):
|
||||
bitrate: int
|
||||
|
||||
def __init__(self, bitrate: int = 192) -> None:
|
||||
self.bitrate = bitrate
|
||||
|
||||
def codec_args(self) -> List[str]:
|
||||
return ["-c:a", "libopus", "-b:a", f"{self.bitrate}k", "-sample_fmt", "s16"]
|
||||
|
||||
|
||||
class CodecFdkAac(FFAudio):
|
||||
bitrate: int
|
||||
|
||||
def __init__(self, bitrate: int = 256) -> None:
|
||||
self.bitrate = bitrate
|
||||
|
||||
def codec_args(self) -> List[str]:
|
||||
return ["-c:a", "libfdk_aac", "-b:a", f"{self.bitrate}k", "-sample_fmt", "s16"]
|
||||
|
||||
|
||||
class CodecFlac(FFAudio):
|
||||
def codec_args(self) -> List[str]:
|
||||
return ["-c:a", "flac"]
|
||||
|
||||
|
||||
class AudioStream(NamedTuple):
|
||||
stream_index: int # zero-indexed, ignores video streams
|
||||
codec: AudioEncoder
|
@ -7,7 +7,6 @@ import random
|
||||
import shutil
|
||||
import string
|
||||
import subprocess
|
||||
import tempfile
|
||||
|
||||
from lvsfunc.render import clip_async_render, find_scene_changes
|
||||
|
||||
@ -16,6 +15,7 @@ from typing import Any, BinaryIO, Callable, List, NamedTuple, Optional, Sequence
|
||||
from .chapters import Chapter, Edition, make_chapters, make_qpfile
|
||||
from .config import Config
|
||||
from .logging import log
|
||||
from .util import get_temp_filename
|
||||
from .source import FileSource
|
||||
|
||||
core = vs.core
|
||||
@ -23,10 +23,6 @@ core = vs.core
|
||||
AUDIO_PFX: str = "_audiogetter_temp_"
|
||||
|
||||
|
||||
def get_temp_filename(prefix: str = "", suffix: str = "") -> str:
|
||||
return f"{prefix}{next(tempfile._get_candidate_names())}{suffix}" # type: ignore
|
||||
|
||||
|
||||
def bin_to_plat(binary: str) -> str:
|
||||
if os.name == "nt":
|
||||
return binary if binary.lower().endswith(".exe") else f"{binary}.exe"
|
||||
@ -153,27 +149,40 @@ class AudioGetter():
|
||||
self.cleanup = set()
|
||||
|
||||
def trim_audio(self, ftrim: Optional[acsuite.types.Trim] = None) -> str:
|
||||
streams = sorted(self.src.audio_streams(), key=lambda s: s.stream_index)
|
||||
if len(streams) == 0:
|
||||
return ""
|
||||
trims = self.src.audio_src()
|
||||
ffmpeg = acsuite.ffmpeg.FFmpegAudio()
|
||||
|
||||
tlist: List[str] = []
|
||||
for t in trims:
|
||||
audio_cut = acsuite.eztrim(t.path, t.trim or (0, None), ref_clip=self.src.audio_ref(),
|
||||
outfile=get_temp_filename(prefix=AUDIO_PFX, suffix=".mka"),
|
||||
streams=0)[0]
|
||||
outfile=get_temp_filename(prefix=AUDIO_PFX+"cut_", suffix=".mka"),
|
||||
streams=[s.stream_index for s in streams])[0]
|
||||
self.cleanup.add(audio_cut)
|
||||
tlist.append(audio_cut)
|
||||
|
||||
if len(tlist) > 1:
|
||||
ffmpeg = acsuite.ffmpeg.FFmpegAudio()
|
||||
audio_cut = ffmpeg.concat(*tlist)
|
||||
self.cleanup.add(audio_cut)
|
||||
|
||||
if ftrim:
|
||||
audio_cut = acsuite.eztrim(audio_cut, ftrim, ref_clip=self.src.source(),
|
||||
outfile=get_temp_filename(prefix=AUDIO_PFX, suffix=".mka"))[0]
|
||||
outfile=get_temp_filename(prefix=AUDIO_PFX+"fcut_", suffix=".mka"))[0]
|
||||
self.cleanup.add(audio_cut)
|
||||
|
||||
audio_cut = self.config.encode_audio(audio_cut)
|
||||
if len(streams) > 1:
|
||||
splits = [get_temp_filename(prefix=AUDIO_PFX+"split_", suffix=".mka") for _ in range(0, len(streams))]
|
||||
ffmpeg.split(audio_cut, splits)
|
||||
self.cleanup |= set(splits)
|
||||
encode = [streams[i].codec.encode_audio(f) for i, f in enumerate(splits)]
|
||||
self.cleanup |= set(encode)
|
||||
audio_cut = get_temp_filename(prefix=AUDIO_PFX+"join_", suffix=".mka")
|
||||
ffmpeg.join(audio_cut, *encode)
|
||||
else:
|
||||
audio_cut = streams[0].codec.encode_audio(audio_cut)
|
||||
|
||||
self.cleanup.add(audio_cut)
|
||||
|
||||
return audio_cut
|
||||
|
@ -1,8 +1,6 @@
|
||||
import os
|
||||
import subprocess
|
||||
|
||||
from abc import ABC, abstractmethod
|
||||
from typing import List, Union
|
||||
from typing import Union
|
||||
|
||||
|
||||
class Config():
|
||||
@ -23,45 +21,3 @@ class Config():
|
||||
fname = filename.format(epnum=self.desc, title=self.title,
|
||||
title_long=self.title_long, resolution=self.resolution)
|
||||
return os.path.join(f"../{self.desc}/", fname)
|
||||
|
||||
def encode_audio(self, afile: str) -> str:
|
||||
return afile # default: passthrough
|
||||
|
||||
|
||||
class AudioEncoder(ABC):
|
||||
@abstractmethod
|
||||
def encode_audio(self, afile: str) -> str:
|
||||
pass
|
||||
|
||||
|
||||
class FFAudio(AudioEncoder):
|
||||
def encode_audio(self, afile: str) -> str:
|
||||
ffmpeg_args = [
|
||||
"ffmpeg",
|
||||
"-hide_banner", "-loglevel", "panic",
|
||||
"-i", afile,
|
||||
"-y",
|
||||
"-map", "0:a",
|
||||
] + self.codec_args() + ["_ffaudio_encode.mka"]
|
||||
print("+ " + " ".join(ffmpeg_args))
|
||||
subprocess.call(ffmpeg_args)
|
||||
return "_ffaudio_encode.mka"
|
||||
|
||||
@abstractmethod
|
||||
def codec_args(self) -> List[str]:
|
||||
pass
|
||||
|
||||
|
||||
class OpusMixin(FFAudio):
|
||||
def codec_args(self) -> List[str]:
|
||||
return ["-c:a", "libopus", "-b:a", "192k", "-sample_fmt", "s16"]
|
||||
|
||||
|
||||
class FdkAacMixin(FFAudio):
|
||||
def codec_args(self) -> List[str]:
|
||||
return ["-c:a", "libfdk_aac", "-b:a", "256k", "-sample_fmt", "s16"]
|
||||
|
||||
|
||||
class FlacMixin(FFAudio):
|
||||
def codec_args(self) -> List[str]:
|
||||
return ["-c:a", "flac"]
|
||||
|
@ -12,6 +12,7 @@ import os
|
||||
from abc import ABC, abstractmethod
|
||||
from typing import Any, List, NamedTuple, Optional, Tuple, Union
|
||||
|
||||
from .audio import AudioStream, CodecPassthrough
|
||||
from .config import Config
|
||||
from .logging import log
|
||||
|
||||
@ -74,6 +75,9 @@ class FileSource(ABC):
|
||||
def audio_src(self) -> List[FileTrim]:
|
||||
pass
|
||||
|
||||
def audio_streams(self) -> List[AudioStream]:
|
||||
return [AudioStream(0, CodecPassthrough())] # default: passthrough first stream
|
||||
|
||||
@abstractmethod
|
||||
def source(self) -> vs.VideoNode:
|
||||
pass
|
||||
|
5
yt_common/yt_common/util.py
Normal file
5
yt_common/yt_common/util.py
Normal file
@ -0,0 +1,5 @@
|
||||
import tempfile
|
||||
|
||||
|
||||
def get_temp_filename(prefix: str = "", suffix: str = "") -> str:
|
||||
return f"{prefix}{next(tempfile._get_candidate_names())}{suffix}" # type: ignore
|
Loading…
x
Reference in New Issue
Block a user