mirror of
https://github.com/fscotto/infra.git
synced 2026-11-26 13:49:52 +00:00
Merge branch 'feature/ai-media-presets' into main
This commit is contained in:
384
ansible/roles/desktop_ai_media/files/preset.py
Normal file
384
ansible/roles/desktop_ai_media/files/preset.py
Normal file
@@ -0,0 +1,384 @@
|
|||||||
|
"""Small host-side orchestrator for offline ai-media presets."""
|
||||||
|
|
||||||
|
import argparse
|
||||||
|
from datetime import datetime
|
||||||
|
import ipaddress
|
||||||
|
import json
|
||||||
|
import os
|
||||||
|
from pathlib import Path
|
||||||
|
import re
|
||||||
|
import shutil
|
||||||
|
import subprocess
|
||||||
|
import sys
|
||||||
|
from urllib.parse import urlsplit
|
||||||
|
import uuid
|
||||||
|
|
||||||
|
|
||||||
|
NAME = re.compile(r"[A-Za-z0-9][A-Za-z0-9._-]*\Z")
|
||||||
|
SOURCE_NAMES = tuple(f"source{number}.jpg" for number in range(11, 19))
|
||||||
|
|
||||||
|
|
||||||
|
def video_url(value):
|
||||||
|
parsed = urlsplit(value)
|
||||||
|
if parsed.scheme not in ("http", "https") or not parsed.hostname or parsed.username or parsed.password:
|
||||||
|
raise ValueError("Use an HTTP(S) video URL without embedded credentials")
|
||||||
|
host = parsed.hostname.lower().rstrip(".")
|
||||||
|
if host == "localhost" or host.endswith(".localhost"):
|
||||||
|
raise ValueError("Local URLs are not accepted")
|
||||||
|
try:
|
||||||
|
address = ipaddress.ip_address(host)
|
||||||
|
except ValueError:
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
if not address.is_global:
|
||||||
|
raise ValueError("Private or local IP URLs are not accepted")
|
||||||
|
return value
|
||||||
|
|
||||||
|
|
||||||
|
def media_file(root, name, *, video=False):
|
||||||
|
if not NAME.fullmatch(name) or name in (".", ".."):
|
||||||
|
raise ValueError("Use a simple filename in the ai-media input directory")
|
||||||
|
path = root / "input" / name
|
||||||
|
if not path.is_file() or path.is_symlink():
|
||||||
|
raise FileNotFoundError(path)
|
||||||
|
if video and path.suffix.lower() != ".mp4":
|
||||||
|
raise ValueError("The video must be an MP4 file")
|
||||||
|
return path
|
||||||
|
|
||||||
|
|
||||||
|
def audio_file(root, name):
|
||||||
|
if not name or any(not NAME.fullmatch(part) or part in (".", "..")
|
||||||
|
for part in name.split("/")):
|
||||||
|
raise ValueError("Use an audio path relative to input/ or output/ without traversal")
|
||||||
|
matches = [root / directory / name for directory in ("input", "output")]
|
||||||
|
matches = [path for path in matches if path.is_file() and path.resolve() == path]
|
||||||
|
if len(matches) != 1:
|
||||||
|
raise ValueError("Audio must exist in exactly one of input/ or output/")
|
||||||
|
return matches[0]
|
||||||
|
|
||||||
|
|
||||||
|
def container_path(root, path):
|
||||||
|
directory = path.relative_to(root).parts[0]
|
||||||
|
if directory not in ("input", "output"):
|
||||||
|
raise ValueError("Media path outside input/output")
|
||||||
|
return "/work/" + str(path.relative_to(root))
|
||||||
|
|
||||||
|
|
||||||
|
def run(*command):
|
||||||
|
print("+", " ".join(map(str, command)), flush=True)
|
||||||
|
subprocess.run([str(part) for part in command], check=True)
|
||||||
|
|
||||||
|
|
||||||
|
def has_stream(path, kind):
|
||||||
|
result = subprocess.run([
|
||||||
|
"ffprobe", "-v", "error", "-show_entries", "stream=codec_type",
|
||||||
|
"-of", "json", str(path),
|
||||||
|
], check=True, capture_output=True, text=True)
|
||||||
|
return kind in [stream["codec_type"] for stream in json.loads(result.stdout)["streams"]]
|
||||||
|
|
||||||
|
|
||||||
|
def probe(path, kind):
|
||||||
|
if not has_stream(path, kind):
|
||||||
|
raise RuntimeError(f"Missing {kind} stream: {path}")
|
||||||
|
|
||||||
|
|
||||||
|
def duration(path):
|
||||||
|
result = subprocess.run([
|
||||||
|
"ffprobe", "-v", "error", "-show_entries", "format=duration",
|
||||||
|
"-of", "default=noprint_wrappers=1:nokey=1", str(path),
|
||||||
|
], check=True, capture_output=True, text=True)
|
||||||
|
return float(result.stdout.strip())
|
||||||
|
|
||||||
|
|
||||||
|
def output_path(root, video, suffix, extension="mp4"):
|
||||||
|
return root / "output" / f"{video.stem}-{suffix}.{extension}"
|
||||||
|
|
||||||
|
|
||||||
|
def mix_target(root, args):
|
||||||
|
name = args.output or f"{Path(args.vocals).stem}-mix.wav"
|
||||||
|
return wav_target(root, name)
|
||||||
|
|
||||||
|
|
||||||
|
def wav_target(root, name):
|
||||||
|
if not NAME.fullmatch(name) or Path(name).suffix.lower() != ".wav":
|
||||||
|
raise ValueError("Use a simple WAV output filename")
|
||||||
|
target = root / "output" / name
|
||||||
|
if target.exists() or target.is_symlink():
|
||||||
|
raise FileExistsError(target)
|
||||||
|
return target
|
||||||
|
|
||||||
|
|
||||||
|
def process_voice(args, root, launcher):
|
||||||
|
source = audio_file(root, args.audio)
|
||||||
|
probe(source, "audio")
|
||||||
|
target = wav_target(root, args.output or f"{source.stem}-mia_voce.wav")
|
||||||
|
job = root / "output" / f".{source.stem}-voice-convert-{args.job_id}"
|
||||||
|
job.mkdir(mode=0o700)
|
||||||
|
print("Working directory:", job, flush=True)
|
||||||
|
prepared = job / "audio.wav"
|
||||||
|
run(launcher, "ffmpeg", "-hide_banner", "-loglevel", "error", "-n",
|
||||||
|
"-i", container_path(root, source), "-map", "0:a:0", "-vn",
|
||||||
|
"-c:a", "pcm_s16le", container_path(root, prepared))
|
||||||
|
run(launcher, "rvc", "cli", container_path(root, prepared),
|
||||||
|
container_path(root, job), "--convert-only")
|
||||||
|
converted = job / "vocals-mia_voce.wav"
|
||||||
|
probe(converted, "audio")
|
||||||
|
os.link(converted, target)
|
||||||
|
return target
|
||||||
|
|
||||||
|
|
||||||
|
def process_mix(args, root, launcher):
|
||||||
|
vocals = audio_file(root, args.vocals)
|
||||||
|
instrumental = audio_file(root, args.instrumental)
|
||||||
|
target = mix_target(root, args)
|
||||||
|
for source in (vocals, instrumental):
|
||||||
|
probe(source, "audio")
|
||||||
|
run(launcher, "ffmpeg", "-hide_banner", "-loglevel", "error", "-n",
|
||||||
|
"-i", container_path(root, vocals), "-i", container_path(root, instrumental),
|
||||||
|
"-filter_complex", "[0:a][1:a]amix=inputs=2:duration=longest:normalize=0[a]",
|
||||||
|
"-map", "[a]", "-c:a", "pcm_s16le", container_path(root, target))
|
||||||
|
probe(target, "audio")
|
||||||
|
return target
|
||||||
|
|
||||||
|
|
||||||
|
def mux(launcher, root, video, audio, target):
|
||||||
|
run(launcher, "ffmpeg", "-hide_banner", "-loglevel", "error", "-n",
|
||||||
|
"-i", container_path(root, video), "-i", container_path(root, audio),
|
||||||
|
"-map", "0:v:0", "-map", "1:a:0", "-c:v", "copy", "-c:a", "aac",
|
||||||
|
"-b:a", "192k", "-shortest", "-movflags", "+faststart",
|
||||||
|
container_path(root, target))
|
||||||
|
probe(target, "video")
|
||||||
|
probe(target, "audio")
|
||||||
|
|
||||||
|
|
||||||
|
def download_video(root, url, job_id):
|
||||||
|
video_url(url)
|
||||||
|
if not job_id or not NAME.fullmatch(job_id):
|
||||||
|
raise ValueError("Invalid job ID")
|
||||||
|
if shutil.which("yt-dlp") is None:
|
||||||
|
raise RuntimeError("yt-dlp is required for URL downloads")
|
||||||
|
prefix = f"download-{job_id}"
|
||||||
|
destination = root / "input" / f"{prefix}.mp4"
|
||||||
|
if list((root / "input").glob(prefix + ".*")):
|
||||||
|
raise FileExistsError(destination)
|
||||||
|
print("Downloading one video into input/ with yt-dlp", flush=True)
|
||||||
|
subprocess.run([
|
||||||
|
"yt-dlp", "--ignore-config", "--no-playlist", "--no-overwrites",
|
||||||
|
"--no-progress", "-t", "mp4", "--recode-video", "mp4",
|
||||||
|
"--output", str(root / "input" / f"{prefix}.%(ext)s"), url,
|
||||||
|
], check=True)
|
||||||
|
if not destination.is_file() or destination.is_symlink():
|
||||||
|
raise RuntimeError("yt-dlp did not produce the expected MP4 in input/")
|
||||||
|
probe(destination, "video")
|
||||||
|
return destination
|
||||||
|
|
||||||
|
|
||||||
|
def process_split(args, root, launcher, video):
|
||||||
|
probe(video, "audio")
|
||||||
|
target = root / "output" / f"{video.stem}-{args.preset}"
|
||||||
|
if target.exists():
|
||||||
|
raise FileExistsError(target)
|
||||||
|
job = root / "output" / f".{video.stem}-{args.preset}-{args.job_id}"
|
||||||
|
job.mkdir(mode=0o700)
|
||||||
|
print("Working directory:", job, flush=True)
|
||||||
|
silent = job / "video.mp4"
|
||||||
|
audio = job / "audio.wav"
|
||||||
|
run(launcher, "ffmpeg", "-hide_banner", "-loglevel", "error", "-n",
|
||||||
|
"-i", container_path(root, video), "-map", "0:v:0", "-c:v", "copy",
|
||||||
|
"-an", "-movflags", "+faststart", container_path(root, silent))
|
||||||
|
probe(silent, "video")
|
||||||
|
if has_stream(silent, "audio"):
|
||||||
|
raise RuntimeError("Unexpected audio stream in split video")
|
||||||
|
run(launcher, "ffmpeg", "-hide_banner", "-loglevel", "error", "-n",
|
||||||
|
"-i", container_path(root, video), "-map", "0:a:0", "-vn",
|
||||||
|
"-c:a", "pcm_s16le", container_path(root, audio))
|
||||||
|
probe(audio, "audio")
|
||||||
|
files = {"video.mp4": silent, "audio.wav": audio}
|
||||||
|
if args.preset == "split-stems":
|
||||||
|
run(launcher, "rvc", "cli", container_path(root, audio),
|
||||||
|
container_path(root, job), "--separate-only")
|
||||||
|
for stem in ("vocals", "instrumental"):
|
||||||
|
matches = list((job / stem).glob("*.wav"))
|
||||||
|
if len(matches) != 1:
|
||||||
|
raise RuntimeError(f"Expected exactly one {stem} stem")
|
||||||
|
probe(matches[0], "audio")
|
||||||
|
files[f"{stem}.wav"] = matches[0]
|
||||||
|
# Publish only after every processing step and stream check succeeded.
|
||||||
|
target.mkdir(mode=0o700)
|
||||||
|
for name, source in files.items():
|
||||||
|
os.link(source, target / name)
|
||||||
|
return target
|
||||||
|
|
||||||
|
|
||||||
|
def process(args, root, launcher):
|
||||||
|
video = media_file(root, args.video, video=True)
|
||||||
|
probe(video, "video")
|
||||||
|
if args.preset in ("split", "split-stems"):
|
||||||
|
return process_split(args, root, launcher, video)
|
||||||
|
if args.preset == "merge":
|
||||||
|
audio = audio_file(root, args.audio)
|
||||||
|
probe(audio, "audio")
|
||||||
|
target = output_path(root, video, "unito")
|
||||||
|
if target.exists():
|
||||||
|
raise FileExistsError(target)
|
||||||
|
mux(launcher, root, video, audio, target)
|
||||||
|
return target
|
||||||
|
|
||||||
|
suffix = "mia_voce" if args.preset == "audio-convert" else "facefusion"
|
||||||
|
target = output_path(root, video, suffix, "wav" if args.preset == "audio-convert" else "mp4")
|
||||||
|
if target.exists():
|
||||||
|
raise FileExistsError(target)
|
||||||
|
job = root / "output" / f".{video.stem}-{suffix}-{args.job_id}"
|
||||||
|
job.mkdir(mode=0o700)
|
||||||
|
print("Working directory:", job, flush=True)
|
||||||
|
if args.preset == "audio-convert":
|
||||||
|
probe(video, "audio")
|
||||||
|
extracted = job / "audio.wav"
|
||||||
|
run(launcher, "ffmpeg", "-hide_banner", "-loglevel", "error", "-n",
|
||||||
|
"-i", container_path(root, video), "-vn", "-c:a", "pcm_s16le",
|
||||||
|
container_path(root, extracted))
|
||||||
|
run(launcher, "rvc", "cli", container_path(root, extracted), container_path(root, job))
|
||||||
|
instrumental = list((job / "instrumental").glob("*.wav"))
|
||||||
|
if len(instrumental) != 1:
|
||||||
|
raise RuntimeError("Expected exactly one instrumental stem")
|
||||||
|
converted = job / "vocals-mia_voce.wav"
|
||||||
|
probe(converted, "audio")
|
||||||
|
mixed = job / "mix.wav"
|
||||||
|
run(launcher, "ffmpeg", "-hide_banner", "-loglevel", "error", "-n",
|
||||||
|
"-i", container_path(root, instrumental[0]),
|
||||||
|
"-i", container_path(root, converted),
|
||||||
|
"-filter_complex", "[0:a][1:a]amix=inputs=2:duration=longest:normalize=0[a]",
|
||||||
|
"-map", "[a]", "-c:a", "pcm_s16le", container_path(root, mixed))
|
||||||
|
probe(mixed, "audio")
|
||||||
|
os.link(mixed, target)
|
||||||
|
else:
|
||||||
|
original_has_audio = has_stream(video, "audio")
|
||||||
|
sources = [media_file(root, name) for name in SOURCE_NAMES]
|
||||||
|
processed = job / "swapped.mp4"
|
||||||
|
run(launcher, "facefusion", "cli", "headless-run",
|
||||||
|
"--source-paths", *[container_path(root, path) for path in sources],
|
||||||
|
"--target-path", container_path(root, video),
|
||||||
|
"--output-path", container_path(root, processed),
|
||||||
|
"--processors", "face_swapper", "--face-swapper-model", "hyperswap_1a_256",
|
||||||
|
"--face-swapper-pixel-boost", "256x256", "--face-swapper-weight", "0.5",
|
||||||
|
"--face-detector-model", "yolo_face", "--face-detector-size", "640x640",
|
||||||
|
"--face-detector-angles", "0", "90", "180", "270",
|
||||||
|
"--face-detector-score", "0.5", "--face-selector-mode", "one",
|
||||||
|
"--face-selector-order", "large-small", "--face-selector-gender", "female",
|
||||||
|
"--face-selector-race", "white",
|
||||||
|
"--face-mask-types", "occlusion", "region", "area", "box",
|
||||||
|
"--face-occluder-model", "xseg_1",
|
||||||
|
"--face-parser-model", "bisenet_resnet_34", "--face-mask-blur", "0.3",
|
||||||
|
"--output-video-encoder", "libx264", "--output-video-preset", "veryfast",
|
||||||
|
"--output-video-quality", "80", "--output-video-fps", "30",
|
||||||
|
"--execution-providers", "cpu", "--output-audio-encoder", "aac",
|
||||||
|
"--jobs-path", "/work/state", "--temp-path", "/work/state/tmp")
|
||||||
|
probe(processed, "video")
|
||||||
|
if abs(duration(processed) - duration(video)) > 0.5:
|
||||||
|
raise RuntimeError("FaceFusion output duration differs from the input; refusing a partial result")
|
||||||
|
if original_has_audio:
|
||||||
|
# Restore the original soundtrack explicitly. Some completed
|
||||||
|
# FaceFusion jobs have produced video-only MP4 files.
|
||||||
|
mux(launcher, root, processed, video, target)
|
||||||
|
else:
|
||||||
|
run(launcher, "ffmpeg", "-hide_banner", "-loglevel", "error", "-n",
|
||||||
|
"-i", container_path(root, processed), "-map", "0:v:0",
|
||||||
|
"-c:v", "copy", "-an", "-movflags", "+faststart",
|
||||||
|
container_path(root, target))
|
||||||
|
probe(target, "video")
|
||||||
|
if has_stream(target, "audio"):
|
||||||
|
raise RuntimeError("Unexpected audio stream in silent FaceFusion output")
|
||||||
|
return target
|
||||||
|
|
||||||
|
|
||||||
|
def process_complete(args, root, launcher):
|
||||||
|
video = media_file(root, args.video, video=True)
|
||||||
|
if not has_stream(video, "audio"):
|
||||||
|
raise RuntimeError("The video has no audio to convert")
|
||||||
|
common = {"video": video.name, "job_id": args.job_id}
|
||||||
|
audio = process(argparse.Namespace(preset="audio-convert", **common), root, launcher)
|
||||||
|
swapped = process(argparse.Namespace(preset="video-convert", **common), root, launcher)
|
||||||
|
target = output_path(root, video, "completo")
|
||||||
|
if target.exists():
|
||||||
|
raise FileExistsError(target)
|
||||||
|
mux(launcher, root, swapped, audio, target)
|
||||||
|
return target
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
parser = argparse.ArgumentParser(prog="ai-media preset")
|
||||||
|
parser.add_argument("root", type=Path, help=argparse.SUPPRESS)
|
||||||
|
parser.add_argument("launcher", type=Path, help=argparse.SUPPRESS)
|
||||||
|
parser.add_argument("--run", action="store_true", help=argparse.SUPPRESS)
|
||||||
|
parser.add_argument("--job-id", help=argparse.SUPPRESS)
|
||||||
|
sub = parser.add_subparsers(dest="preset", required=True)
|
||||||
|
for name in ("audio-convert", "video-convert", "merge", "split", "split-stems", "convert"):
|
||||||
|
command = sub.add_parser(name)
|
||||||
|
command.add_argument("video", help="MP4 filename inside input/ or HTTP(S) video URL")
|
||||||
|
if name == "merge":
|
||||||
|
command.add_argument("audio", help="unique audio filename in input/ or output/")
|
||||||
|
mix = sub.add_parser("mix", help="mix vocal and instrumental audio into one WAV")
|
||||||
|
mix.add_argument("vocals", help="vocal audio path relative to input/ or output/")
|
||||||
|
mix.add_argument("instrumental", help="instrumental audio path relative to input/ or output/")
|
||||||
|
mix.add_argument("--output", help="WAV filename in output/ (default: <vocals>-mix.wav)")
|
||||||
|
voice = sub.add_parser("voice-convert", help="apply mia_voce directly to an audio file")
|
||||||
|
voice.add_argument("audio", help="audio path relative to input/ or output/")
|
||||||
|
voice.add_argument("--output", help="WAV filename in output/ (default: <audio>-mia_voce.wav)")
|
||||||
|
args = parser.parse_args()
|
||||||
|
root = args.root.resolve(strict=True)
|
||||||
|
launcher = args.launcher.resolve(strict=True)
|
||||||
|
audio_only = args.preset in ("mix", "voice-convert")
|
||||||
|
remote_video = not audio_only and not NAME.fullmatch(args.video)
|
||||||
|
if args.preset == "voice-convert":
|
||||||
|
source = audio_file(root, args.audio)
|
||||||
|
wav_target(root, args.output or f"{source.stem}-mia_voce.wav")
|
||||||
|
preset_inputs = [args.audio]
|
||||||
|
if args.output:
|
||||||
|
preset_inputs += ["--output", args.output]
|
||||||
|
elif args.preset == "mix":
|
||||||
|
audio_file(root, args.vocals)
|
||||||
|
audio_file(root, args.instrumental)
|
||||||
|
mix_target(root, args)
|
||||||
|
preset_inputs = [args.vocals, args.instrumental]
|
||||||
|
if args.output:
|
||||||
|
preset_inputs += ["--output", args.output]
|
||||||
|
elif remote_video:
|
||||||
|
video_url(args.video)
|
||||||
|
if shutil.which("yt-dlp") is None:
|
||||||
|
raise RuntimeError("yt-dlp is required for URL downloads")
|
||||||
|
else:
|
||||||
|
media_file(root, args.video, video=True)
|
||||||
|
if not audio_only:
|
||||||
|
preset_inputs = [args.video] + ([args.audio] if args.preset == "merge" else [])
|
||||||
|
if args.preset == "merge":
|
||||||
|
audio_file(root, args.audio)
|
||||||
|
if args.preset in ("video-convert", "convert"):
|
||||||
|
for name in SOURCE_NAMES:
|
||||||
|
media_file(root, name)
|
||||||
|
if args.run:
|
||||||
|
if remote_video:
|
||||||
|
args.video = download_video(root, args.video, args.job_id).name
|
||||||
|
if args.preset == "voice-convert":
|
||||||
|
result = process_voice(args, root, launcher)
|
||||||
|
elif args.preset == "mix":
|
||||||
|
result = process_mix(args, root, launcher)
|
||||||
|
else:
|
||||||
|
result = (process_complete(args, root, launcher)
|
||||||
|
if args.preset == "convert" else process(args, root, launcher))
|
||||||
|
print("Completed:", result, flush=True)
|
||||||
|
return
|
||||||
|
unit = "ai-media-preset-" + datetime.now().strftime("%Y%m%d-%H%M%S") + "-" + uuid.uuid4().hex[:8]
|
||||||
|
subprocess.run(["systemd-run", "--user", "--collect", f"--unit={unit}",
|
||||||
|
"--property=Type=exec", "--property=Restart=no",
|
||||||
|
"/usr/bin/python3", str(Path(__file__).resolve()), str(root), str(launcher),
|
||||||
|
"--run", "--job-id", unit, args.preset,
|
||||||
|
*preset_inputs], check=True)
|
||||||
|
print("Job:", unit)
|
||||||
|
print("Logs: journalctl --user -fu", unit)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
try:
|
||||||
|
main()
|
||||||
|
except (ValueError, FileNotFoundError, FileExistsError, subprocess.CalledProcessError) as error:
|
||||||
|
raise SystemExit(str(error)) from error
|
||||||
94
ansible/roles/desktop_ai_media/files/preset_rvc.py
Normal file
94
ansible/roles/desktop_ai_media/files/preset_rvc.py
Normal file
@@ -0,0 +1,94 @@
|
|||||||
|
"""Offline RVC worker for the voice preset (runs inside the RVC container)."""
|
||||||
|
|
||||||
|
import argparse
|
||||||
|
import os
|
||||||
|
from pathlib import Path
|
||||||
|
import sys
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
parser = argparse.ArgumentParser()
|
||||||
|
parser.add_argument("input_wav", type=Path)
|
||||||
|
parser.add_argument("job_dir", type=Path)
|
||||||
|
mode = parser.add_mutually_exclusive_group()
|
||||||
|
mode.add_argument("--separate-only", action="store_true")
|
||||||
|
mode.add_argument("--convert-only", action="store_true")
|
||||||
|
args = parser.parse_args()
|
||||||
|
source = args.input_wav.resolve(strict=True)
|
||||||
|
job = args.job_dir.resolve(strict=True)
|
||||||
|
output = Path("/work/output").resolve(strict=True)
|
||||||
|
if not source.is_relative_to(output) or not job.is_relative_to(output):
|
||||||
|
raise ValueError("RVC preset paths must be inside /work/output")
|
||||||
|
if source.parent != job or not source.is_file():
|
||||||
|
raise ValueError("Expected the extracted WAV inside the job directory")
|
||||||
|
|
||||||
|
weights = Path("/work/state/weights/mia_voce.pth")
|
||||||
|
index = Path("/work/state/mia_voce/added_IVF256_Flat_nprobe_1_mia_voce_v2.index")
|
||||||
|
if not args.separate_only and not weights.is_file():
|
||||||
|
raise FileNotFoundError(weights)
|
||||||
|
if not args.separate_only and not index.is_file():
|
||||||
|
raise FileNotFoundError(index)
|
||||||
|
os.environ.update(
|
||||||
|
weight_root="/work/state/weights",
|
||||||
|
outside_index_root="/work/models/indices",
|
||||||
|
index_root="/work/state",
|
||||||
|
weight_pymss_root="/opt/app/assets/pymss_weights",
|
||||||
|
rmvpe_root="/opt/app/assets/rmvpe",
|
||||||
|
OMP_NUM_THREADS="4",
|
||||||
|
MKL_NUM_THREADS="4",
|
||||||
|
)
|
||||||
|
|
||||||
|
# The pinned WebUI imports its own argparse configuration at module load.
|
||||||
|
sys.argv = sys.argv[:1]
|
||||||
|
vocal_source = source
|
||||||
|
if not args.convert_only:
|
||||||
|
from tools.pymss_webui import pymss_separate
|
||||||
|
|
||||||
|
vocals_dir = job / "vocals"
|
||||||
|
instrumental_dir = job / "instrumental"
|
||||||
|
vocals_dir.mkdir()
|
||||||
|
instrumental_dir.mkdir()
|
||||||
|
failures = []
|
||||||
|
|
||||||
|
def on_event(event):
|
||||||
|
if event.get("event") in ("fatal", "cancelled", "busy"):
|
||||||
|
failures.append(event.get("message", str(event)))
|
||||||
|
|
||||||
|
for progress in pymss_separate(
|
||||||
|
"vocals-bs-roformer-368", str(source), str(vocals_dir), None,
|
||||||
|
str(instrumental_dir), "wav", event_callback=on_event,
|
||||||
|
):
|
||||||
|
print(progress, flush=True)
|
||||||
|
if failures:
|
||||||
|
raise RuntimeError("RVC separation failed: " + "; ".join(failures))
|
||||||
|
vocals = list(vocals_dir.glob("*.wav"))
|
||||||
|
instrumental = list(instrumental_dir.glob("*.wav"))
|
||||||
|
if len(vocals) != 1 or len(instrumental) != 1:
|
||||||
|
raise RuntimeError("RVC did not produce exactly one vocal and instrumental stem")
|
||||||
|
|
||||||
|
if args.separate_only:
|
||||||
|
print("Vocal and instrumental stems ready (no voice conversion)", flush=True)
|
||||||
|
return
|
||||||
|
|
||||||
|
vocal_source = vocals[0]
|
||||||
|
|
||||||
|
from configs.config import Config
|
||||||
|
from infer.vc.modules import VC
|
||||||
|
import soundfile as sf
|
||||||
|
|
||||||
|
voice = VC(Config())
|
||||||
|
voice.get_vc(weights.name)
|
||||||
|
status, result = voice.vc_single(
|
||||||
|
0, str(vocal_source), 0, "rmvpe", str(index), 0.75, 0, 1, 0.33,
|
||||||
|
)
|
||||||
|
if result is None or result[0] is None or result[1] is None:
|
||||||
|
raise RuntimeError("RVC voice conversion failed: " + str(status))
|
||||||
|
converted = job / "vocals-mia_voce.wav"
|
||||||
|
sf.write(converted, result[1], result[0])
|
||||||
|
if converted.stat().st_size == 0:
|
||||||
|
raise RuntimeError("RVC produced an empty converted voice")
|
||||||
|
print("RVC converted voice ready", flush=True)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
||||||
@@ -84,6 +84,14 @@
|
|||||||
loop: [session.py, prepare.py, verify.py, check_storage.py]
|
loop: [session.py, prepare.py, verify.py, check_storage.py]
|
||||||
register: desktop_ai_media_support
|
register: desktop_ai_media_support
|
||||||
|
|
||||||
|
- name: Install host-side offline preset workers without rebuilding images
|
||||||
|
tags: [ai_media_presets]
|
||||||
|
ansible.builtin.copy:
|
||||||
|
src: "{{ item }}"
|
||||||
|
dest: "{{ desktop_ai_media_build_root }}/{{ item }}"
|
||||||
|
mode: "0644"
|
||||||
|
loop: [preset.py, preset_rvc.py]
|
||||||
|
|
||||||
- name: Create public model cache directories
|
- name: Create public model cache directories
|
||||||
ansible.builtin.file:
|
ansible.builtin.file:
|
||||||
path: "{{ desktop_ai_media_build_root }}/models/{{ item.app }}/{{ item.path | dirname }}"
|
path: "{{ desktop_ai_media_build_root }}/models/{{ item.app }}/{{ item.path | dirname }}"
|
||||||
|
|||||||
@@ -1,10 +1,20 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
root={{ desktop_ai_media_root | quote }}
|
root={{ desktop_ai_media_root | quote }}
|
||||||
|
build_root={{ desktop_ai_media_build_root | quote }}
|
||||||
app="${1:-}"
|
app="${1:-}"
|
||||||
case "$app" in
|
case "$app" in
|
||||||
facefusion|rvc) shift ;;
|
facefusion|rvc) shift ;;
|
||||||
ffmpeg) app=facefusion; shift; set -- ffmpeg "$@" ;;
|
ffmpeg) app=facefusion; shift; set -- ffmpeg "$@" ;;
|
||||||
|
preset)
|
||||||
|
shift
|
||||||
|
for path in "$root" "$root/input" "$root/output"; do
|
||||||
|
[[ -d "$path" && "$(realpath -- "$path")" == "$path" ]] || {
|
||||||
|
echo "Unsafe or missing media directory: $path" >&2; exit 1;
|
||||||
|
}
|
||||||
|
done
|
||||||
|
python3 "$build_root/check_storage.py" "$root"
|
||||||
|
exec python3 "$build_root/preset.py" "$root" "$(realpath -- "$0")" "$@" ;;
|
||||||
verify)
|
verify)
|
||||||
for tool in facefusion rvc; do
|
for tool in facefusion rvc; do
|
||||||
podman --remote=false run --rm --pull=never --network=none --read-only \
|
podman --remote=false run --rm --pull=never --network=none --read-only \
|
||||||
@@ -17,7 +27,7 @@ case "$app" in
|
|||||||
"localhost/ai-media-$tool:managed" verify
|
"localhost/ai-media-$tool:managed" verify
|
||||||
done
|
done
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
*) echo "Usage: ai-media {facefusion|rvc|ffmpeg|verify} [cli ...]" >&2; exit 2 ;;
|
*) echo "Usage: ai-media {facefusion|rvc|ffmpeg|preset|verify} [args ...]" >&2; exit 2 ;;
|
||||||
esac
|
esac
|
||||||
# Fail closed if an existing data path was replaced by a symlink.
|
# Fail closed if an existing data path was replaced by a symlink.
|
||||||
for path in "$root" "$root/input" "$root/output" "$root/models" "$root/state/$app"; do
|
for path in "$root" "$root/input" "$root/output" "$root/models" "$root/state/$app"; do
|
||||||
@@ -45,6 +55,13 @@ fi
|
|||||||
if [[ "${1:-}" == --foreground ]]; then
|
if [[ "${1:-}" == --foreground ]]; then
|
||||||
shift
|
shift
|
||||||
fi
|
fi
|
||||||
|
if [[ "$app" == rvc && "${1:-}" == cli ]]; then
|
||||||
|
shift
|
||||||
|
rvc_cli=1
|
||||||
|
set -- /opt/preset_rvc.py "$@"
|
||||||
|
else
|
||||||
|
rvc_cli=0
|
||||||
|
fi
|
||||||
args=(
|
args=(
|
||||||
run --rm --pull=never --network=none --read-only --userns=keep-id --http-proxy=false
|
run --rm --pull=never --network=none --read-only --userns=keep-id --http-proxy=false
|
||||||
--cap-drop=ALL --security-opt=no-new-privileges
|
--cap-drop=ALL --security-opt=no-new-privileges
|
||||||
@@ -56,7 +73,10 @@ args=(
|
|||||||
--volume "$root/models:/work/models:ro,Z"
|
--volume "$root/models:/work/models:ro,Z"
|
||||||
--volume "$root/state/$app:/work/state:rw,Z"
|
--volume "$root/state/$app:/work/state:rw,Z"
|
||||||
)
|
)
|
||||||
if [[ "${1:-}" != cli && "${1:-}" != ffmpeg ]]; then
|
if [[ "$rvc_cli" == 1 ]]; then
|
||||||
|
args+=(--volume "$build_root/preset_rvc.py:/opt/preset_rvc.py:ro,Z" --entrypoint python)
|
||||||
|
fi
|
||||||
|
if [[ "$rvc_cli" != 1 && "${1:-}" != cli && "${1:-}" != ffmpeg ]]; then
|
||||||
: "${XDG_RUNTIME_DIR:?Run this launcher from the GNOME Wayland session}"
|
: "${XDG_RUNTIME_DIR:?Run this launcher from the GNOME Wayland session}"
|
||||||
: "${WAYLAND_DISPLAY:?A Wayland session is required}"
|
: "${WAYLAND_DISPLAY:?A Wayland session is required}"
|
||||||
[[ "$WAYLAND_DISPLAY" != */* && -S "$XDG_RUNTIME_DIR/$WAYLAND_DISPLAY" ]] || exit 1
|
[[ "$WAYLAND_DISPLAY" != */* && -S "$XDG_RUNTIME_DIR/$WAYLAND_DISPLAY" ]] || exit 1
|
||||||
|
|||||||
@@ -5,6 +5,8 @@ import socket
|
|||||||
import subprocess
|
import subprocess
|
||||||
import tempfile
|
import tempfile
|
||||||
import unittest
|
import unittest
|
||||||
|
import wave
|
||||||
|
import struct
|
||||||
|
|
||||||
from jinja2 import Environment
|
from jinja2 import Environment
|
||||||
import shlex
|
import shlex
|
||||||
@@ -27,6 +29,8 @@ class LauncherTest(unittest.TestCase):
|
|||||||
(ROLE / 'templates/ai-media.j2').read_text()
|
(ROLE / 'templates/ai-media.j2').read_text()
|
||||||
).render(desktop_ai_media_root=str(self.media), desktop_ai_media_build_root=str(self.root)))
|
).render(desktop_ai_media_root=str(self.media), desktop_ai_media_build_root=str(self.root)))
|
||||||
(self.root / 'check_storage.py').write_text((ROLE / 'files/check_storage.py').read_text())
|
(self.root / 'check_storage.py').write_text((ROLE / 'files/check_storage.py').read_text())
|
||||||
|
for name in ('preset.py', 'preset_rvc.py'):
|
||||||
|
(self.root / name).write_text((ROLE / 'files' / name).read_text())
|
||||||
self.log = self.root / 'podman.json'
|
self.log = self.root / 'podman.json'
|
||||||
podman = self.root / 'podman'
|
podman = self.root / 'podman'
|
||||||
podman.write_text('#!/usr/bin/python3\nimport json,os,sys\n'
|
podman.write_text('#!/usr/bin/python3\nimport json,os,sys\n'
|
||||||
@@ -39,6 +43,207 @@ class LauncherTest(unittest.TestCase):
|
|||||||
return subprocess.run(['bash', str(self.launcher), *args], env=self.env,
|
return subprocess.run(['bash', str(self.launcher), *args], env=self.env,
|
||||||
capture_output=True, text=True)
|
capture_output=True, text=True)
|
||||||
|
|
||||||
|
def fake_media_launcher(self):
|
||||||
|
fake = self.root / 'fake-ai-media'
|
||||||
|
fake.write_text('''#!/usr/bin/python3
|
||||||
|
import os
|
||||||
|
from pathlib import Path
|
||||||
|
import shutil
|
||||||
|
import sys
|
||||||
|
|
||||||
|
root = Path(os.environ["TEST_MEDIA"])
|
||||||
|
def host(path):
|
||||||
|
return str(path).replace("/work/input/", str(root / "input") + "/").replace(
|
||||||
|
"/work/output/", str(root / "output") + "/")
|
||||||
|
|
||||||
|
tool = sys.argv[1]
|
||||||
|
args = sys.argv[2:]
|
||||||
|
if tool == "ffmpeg":
|
||||||
|
os.execvp("ffmpeg", ["ffmpeg", *[host(arg) for arg in args]])
|
||||||
|
if tool == "facefusion":
|
||||||
|
(root / "facefusion-args.json").write_text(__import__("json").dumps(args))
|
||||||
|
shutil.copyfile(host(args[args.index("--target-path") + 1]),
|
||||||
|
host(args[args.index("--output-path") + 1]))
|
||||||
|
raise SystemExit(0)
|
||||||
|
if tool == "rvc":
|
||||||
|
(root / "rvc-args.json").write_text(__import__("json").dumps(args))
|
||||||
|
source = Path(host(args[1]))
|
||||||
|
job = Path(host(args[2]))
|
||||||
|
if "--convert-only" not in args:
|
||||||
|
(job / "instrumental").mkdir()
|
||||||
|
shutil.copyfile(source, job / "instrumental/stem.wav")
|
||||||
|
if "--separate-only" in args:
|
||||||
|
(job / "vocals").mkdir()
|
||||||
|
shutil.copyfile(source, job / "vocals/stem.wav")
|
||||||
|
else:
|
||||||
|
shutil.copyfile(source, job / "vocals-mia_voce.wav")
|
||||||
|
raise SystemExit(0)
|
||||||
|
raise SystemExit("Unexpected tool: " + tool)
|
||||||
|
''')
|
||||||
|
fake.chmod(0o755)
|
||||||
|
return fake
|
||||||
|
|
||||||
|
def fake_downloader(self, fixture):
|
||||||
|
downloader = self.root / 'yt-dlp'
|
||||||
|
downloader.write_text('''#!/usr/bin/python3
|
||||||
|
import json
|
||||||
|
import os
|
||||||
|
from pathlib import Path
|
||||||
|
import shutil
|
||||||
|
import sys
|
||||||
|
|
||||||
|
args = sys.argv[1:]
|
||||||
|
Path(os.environ["TEST_LOG"]).write_text(json.dumps(args))
|
||||||
|
destination = args[args.index("--output") + 1].replace("%(ext)s", "mp4")
|
||||||
|
shutil.copyfile(os.environ["TEST_DOWNLOAD_FIXTURE"], destination)
|
||||||
|
''')
|
||||||
|
downloader.chmod(0o755)
|
||||||
|
self.env['TEST_DOWNLOAD_FIXTURE'] = str(fixture)
|
||||||
|
return downloader
|
||||||
|
|
||||||
|
def run_preset(self, fake, *args, job_id='test'):
|
||||||
|
return subprocess.run(['python3', str(self.root / 'preset.py'),
|
||||||
|
str(self.media), str(fake), '--run', '--job-id', job_id, *args],
|
||||||
|
env={**self.env, 'TEST_MEDIA': str(self.media)},
|
||||||
|
capture_output=True, text=True)
|
||||||
|
|
||||||
|
def create_video(self, *, audio=False):
|
||||||
|
video = self.media / 'input/video1.mp4'
|
||||||
|
command = ['ffmpeg', '-hide_banner', '-loglevel', 'error', '-f', 'lavfi',
|
||||||
|
'-i', 'color=c=black:s=64x64:d=1']
|
||||||
|
if audio:
|
||||||
|
command += ['-f', 'lavfi', '-i', 'sine=frequency=440:duration=1']
|
||||||
|
command += ['-c:v', 'mpeg4']
|
||||||
|
if audio:
|
||||||
|
command += ['-c:a', 'aac', '-shortest']
|
||||||
|
subprocess.run([*command, str(video)], check=True)
|
||||||
|
return video
|
||||||
|
|
||||||
|
def stream_types(self, path):
|
||||||
|
probe = subprocess.check_output(['ffprobe', '-v', 'error', '-show_entries',
|
||||||
|
'stream=codec_type', '-of', 'json', str(path)])
|
||||||
|
return {stream['codec_type'] for stream in json.loads(probe)['streams']}
|
||||||
|
|
||||||
|
def create_audio(self, relative, sample=1000, seconds=1):
|
||||||
|
path = self.media / relative
|
||||||
|
path.parent.mkdir(parents=True, exist_ok=True)
|
||||||
|
with wave.open(str(path), 'wb') as audio:
|
||||||
|
audio.setparams((1, 2, 8000, 0, 'NONE', 'not compressed'))
|
||||||
|
audio.writeframes(struct.pack('<h', sample) * (8000 * seconds))
|
||||||
|
return path
|
||||||
|
|
||||||
|
def test_mix_sums_stems_and_preserves_longest_duration(self):
|
||||||
|
vocals = self.create_audio('output/video1-split-stems/vocals.wav')
|
||||||
|
instrumental = self.create_audio('output/video1-split-stems/instrumental.wav',
|
||||||
|
sample=2000, seconds=2)
|
||||||
|
before = [path.read_bytes() for path in (vocals, instrumental)]
|
||||||
|
result = self.run_preset(self.fake_media_launcher(), 'mix',
|
||||||
|
'video1-split-stems/vocals.wav',
|
||||||
|
'video1-split-stems/instrumental.wav', '--output', 'song.wav')
|
||||||
|
self.assertEqual(result.returncode, 0, result.stderr)
|
||||||
|
output = self.media / 'output/song.wav'
|
||||||
|
self.assertEqual(self.stream_types(output), {'audio'})
|
||||||
|
with wave.open(str(output), 'rb') as audio:
|
||||||
|
self.assertEqual(audio.getnframes(), 16000)
|
||||||
|
samples = struct.unpack('<16000h', audio.readframes(16000))
|
||||||
|
self.assertAlmostEqual(samples[4000], 3000, delta=1)
|
||||||
|
self.assertAlmostEqual(samples[12000], 2000, delta=1)
|
||||||
|
self.assertEqual([path.read_bytes() for path in (vocals, instrumental)], before)
|
||||||
|
|
||||||
|
def test_voice_convert_audio_skips_separation_and_preserves_input(self):
|
||||||
|
source = self.create_audio('output/video1-split-stems/vocals.wav')
|
||||||
|
before = source.read_bytes()
|
||||||
|
result = self.run_preset(self.fake_media_launcher(), 'voice-convert',
|
||||||
|
'video1-split-stems/vocals.wav')
|
||||||
|
self.assertEqual(result.returncode, 0, result.stderr)
|
||||||
|
output = self.media / 'output/vocals-mia_voce.wav'
|
||||||
|
self.assertEqual(self.stream_types(output), {'audio'})
|
||||||
|
args = json.loads((self.media / 'rvc-args.json').read_text())
|
||||||
|
self.assertIn('--convert-only', args)
|
||||||
|
self.assertFalse(list((self.media / 'output').rglob('instrumental')))
|
||||||
|
self.assertFalse((self.media / 'facefusion-args.json').exists())
|
||||||
|
self.assertEqual(source.read_bytes(), before)
|
||||||
|
repeated = self.run_preset(self.fake_media_launcher(), 'voice-convert',
|
||||||
|
'video1-split-stems/vocals.wav')
|
||||||
|
self.assertNotEqual(repeated.returncode, 0)
|
||||||
|
|
||||||
|
def test_voice_convert_dispatches_with_custom_output(self):
|
||||||
|
self.create_audio('input/voice.wav')
|
||||||
|
runner = self.root / 'systemd-run'
|
||||||
|
runner.write_text('#!/usr/bin/python3\nimport json,os,sys\n'
|
||||||
|
'open(os.environ["TEST_LOG"], "w").write(json.dumps(sys.argv[1:]))\n')
|
||||||
|
runner.chmod(0o755)
|
||||||
|
result = self.launch('preset', 'voice-convert', 'voice.wav', '--output', 'mine.wav')
|
||||||
|
self.assertEqual(result.returncode, 0, result.stderr)
|
||||||
|
args = json.loads(self.log.read_text())
|
||||||
|
self.assertIn('--user', args)
|
||||||
|
self.assertEqual(args[-4:], ['voice-convert', 'voice.wav', '--output', 'mine.wav'])
|
||||||
|
|
||||||
|
def test_voice_convert_rejects_invalid_audio_and_output(self):
|
||||||
|
self.create_audio('input/voice.wav')
|
||||||
|
for name in ('missing.wav', '../voice.wav', 'https://example.org/audio.wav'):
|
||||||
|
self.assertNotEqual(self.launch('preset', 'voice-convert', name).returncode, 0)
|
||||||
|
for name in ('../mine.wav', 'mine.mp3'):
|
||||||
|
self.assertNotEqual(self.launch('preset', 'voice-convert', 'voice.wav',
|
||||||
|
'--output', name).returncode, 0)
|
||||||
|
self.create_audio('output/voice.wav')
|
||||||
|
self.assertNotEqual(self.launch('preset', 'voice-convert', 'voice.wav').returncode, 0)
|
||||||
|
self.assertFalse(self.log.exists())
|
||||||
|
|
||||||
|
def test_mix_default_output_and_no_overwrite(self):
|
||||||
|
self.create_audio('input/voice.wav')
|
||||||
|
self.create_audio('output/instrumental.wav')
|
||||||
|
args = ('mix', 'voice.wav', 'instrumental.wav')
|
||||||
|
result = self.run_preset(self.fake_media_launcher(), *args)
|
||||||
|
self.assertEqual(result.returncode, 0, result.stderr)
|
||||||
|
target = self.media / 'output/voice-mix.wav'
|
||||||
|
original = target.read_bytes()
|
||||||
|
result = self.run_preset(self.fake_media_launcher(), *args)
|
||||||
|
self.assertNotEqual(result.returncode, 0)
|
||||||
|
self.assertEqual(target.read_bytes(), original)
|
||||||
|
|
||||||
|
def test_mix_dispatches_audio_only_background_job(self):
|
||||||
|
self.create_audio('input/voice.wav')
|
||||||
|
self.create_audio('output/instrumental.wav')
|
||||||
|
runner = self.root / 'systemd-run'
|
||||||
|
runner.write_text('#!/usr/bin/python3\nimport json,os,sys\n'
|
||||||
|
'open(os.environ["TEST_LOG"], "w").write(json.dumps(sys.argv[1:]))\n')
|
||||||
|
runner.chmod(0o755)
|
||||||
|
result = self.launch('preset', 'mix', 'voice.wav', 'instrumental.wav',
|
||||||
|
'--output', 'song.wav')
|
||||||
|
self.assertEqual(result.returncode, 0, result.stderr)
|
||||||
|
args = json.loads(self.log.read_text())
|
||||||
|
self.assertIn('--user', args)
|
||||||
|
self.assertEqual(args[-5:], ['mix', 'voice.wav', 'instrumental.wav',
|
||||||
|
'--output', 'song.wav'])
|
||||||
|
self.assertFalse((self.media / 'output/song.wav').exists())
|
||||||
|
|
||||||
|
def test_mix_rejects_unsafe_paths_and_ambiguous_audio(self):
|
||||||
|
self.create_audio('input/voice.wav')
|
||||||
|
self.create_audio('output/instrumental.wav')
|
||||||
|
for unsafe in ('../voice.wav', '/tmp/voice.wav', 'https://example.org/voice.wav'):
|
||||||
|
result = self.launch('preset', 'mix', unsafe, 'instrumental.wav')
|
||||||
|
self.assertNotEqual(result.returncode, 0)
|
||||||
|
for unsafe in ('../song.wav', '/tmp/song.wav', 'song.mp3'):
|
||||||
|
result = self.launch('preset', 'mix', 'voice.wav', 'instrumental.wav',
|
||||||
|
'--output', unsafe)
|
||||||
|
self.assertNotEqual(result.returncode, 0)
|
||||||
|
(self.media / 'output/linked').symlink_to(self.media / 'input', target_is_directory=True)
|
||||||
|
self.assertNotEqual(self.launch('preset', 'mix', 'linked/voice.wav',
|
||||||
|
'instrumental.wav').returncode, 0)
|
||||||
|
self.create_audio('output/voice.wav')
|
||||||
|
self.assertNotEqual(self.launch('preset', 'mix', 'voice.wav',
|
||||||
|
'instrumental.wav').returncode, 0)
|
||||||
|
self.assertFalse(self.log.exists())
|
||||||
|
|
||||||
|
def test_mix_rejects_missing_audio_stream(self):
|
||||||
|
video = self.create_video()
|
||||||
|
self.create_audio('output/instrumental.wav')
|
||||||
|
result = self.run_preset(self.fake_media_launcher(), 'mix', video.name,
|
||||||
|
'instrumental.wav')
|
||||||
|
self.assertNotEqual(result.returncode, 0)
|
||||||
|
self.assertFalse((self.media / 'output/video1-mix.wav').exists())
|
||||||
|
|
||||||
def test_cli_has_no_network_or_host_home(self):
|
def test_cli_has_no_network_or_host_home(self):
|
||||||
result = self.launch('facefusion', 'cli', '--help')
|
result = self.launch('facefusion', 'cli', '--help')
|
||||||
self.assertEqual(result.returncode, 0, result.stderr)
|
self.assertEqual(result.returncode, 0, result.stderr)
|
||||||
@@ -65,6 +270,211 @@ class LauncherTest(unittest.TestCase):
|
|||||||
self.assertNotIn('--publish', args)
|
self.assertNotIn('--publish', args)
|
||||||
self.assertFalse(any('dbus' in arg for arg in args))
|
self.assertFalse(any('dbus' in arg for arg in args))
|
||||||
|
|
||||||
|
def test_rvc_cli_is_offline_and_mounts_only_preset_code(self):
|
||||||
|
result = self.launch('rvc', 'cli', '/work/output/job/audio.wav', '/work/output/job')
|
||||||
|
self.assertEqual(result.returncode, 0, result.stderr)
|
||||||
|
args = json.loads(self.log.read_text())
|
||||||
|
self.assertIn('--network=none', args)
|
||||||
|
self.assertIn('--entrypoint', args)
|
||||||
|
self.assertIn('python', args)
|
||||||
|
self.assertIn(str(self.root / 'preset_rvc.py') + ':/opt/preset_rvc.py:ro,Z', args)
|
||||||
|
self.assertIn('/opt/preset_rvc.py', args)
|
||||||
|
self.assertNotIn('label=disable', args)
|
||||||
|
|
||||||
|
def test_voice_preset_dispatches_to_user_service(self):
|
||||||
|
(self.media / 'input/video1.mp4').write_bytes(b'not processed in dispatch')
|
||||||
|
runner = self.root / 'systemd-run'
|
||||||
|
runner.write_text('#!/usr/bin/python3\nimport json,os,sys\n'
|
||||||
|
'open(os.environ["TEST_LOG"], "w").write(json.dumps(sys.argv[1:]))\n')
|
||||||
|
runner.chmod(0o755)
|
||||||
|
result = self.launch('preset', 'audio-convert', 'video1.mp4')
|
||||||
|
self.assertEqual(result.returncode, 0, result.stderr)
|
||||||
|
args = json.loads(self.log.read_text())
|
||||||
|
self.assertIn('--user', args)
|
||||||
|
self.assertIn('--property=Restart=no', args)
|
||||||
|
self.assertIn('audio-convert', args)
|
||||||
|
self.assertIn('video1.mp4', args)
|
||||||
|
|
||||||
|
def test_face_preset_requires_all_sources(self):
|
||||||
|
(self.media / 'input/video1.mp4').write_bytes(b'video')
|
||||||
|
self.assertNotEqual(self.launch('preset', 'video-convert', 'video1.mp4').returncode, 0)
|
||||||
|
self.assertFalse(self.log.exists())
|
||||||
|
|
||||||
|
def test_complete_preset_rejects_local_url(self):
|
||||||
|
result = self.launch('preset', 'convert', 'file:///tmp/video.mp4')
|
||||||
|
self.assertNotEqual(result.returncode, 0)
|
||||||
|
self.assertFalse(self.log.exists())
|
||||||
|
|
||||||
|
def test_old_preset_names_are_rejected(self):
|
||||||
|
for name in ('voce', 'volti', 'unisci', 'completo'):
|
||||||
|
with self.subTest(name=name):
|
||||||
|
self.assertEqual(self.launch('preset', name, 'video1.mp4').returncode, 2)
|
||||||
|
|
||||||
|
def test_all_url_presets_dispatch_one_background_job(self):
|
||||||
|
for number in range(11, 19):
|
||||||
|
(self.media / f'input/source{number}.jpg').write_bytes(b'source')
|
||||||
|
runner = self.root / 'systemd-run'
|
||||||
|
runner.write_text('#!/usr/bin/python3\nimport json,os,sys\n'
|
||||||
|
'open(os.environ["TEST_LOG"], "w").write(json.dumps(sys.argv[1:]))\n')
|
||||||
|
runner.chmod(0o755)
|
||||||
|
(self.media / 'input/audio.wav').write_bytes(b'audio')
|
||||||
|
for preset in ('audio-convert', 'video-convert', 'merge', 'split',
|
||||||
|
'split-stems', 'convert'):
|
||||||
|
with self.subTest(preset=preset):
|
||||||
|
extra = ['audio.wav'] if preset == 'merge' else []
|
||||||
|
result = self.launch('preset', preset, 'https://example.org/video', *extra)
|
||||||
|
self.assertEqual(result.returncode, 0, result.stderr)
|
||||||
|
args = json.loads(self.log.read_text())
|
||||||
|
self.assertIn('--user', args)
|
||||||
|
self.assertIn(preset, args)
|
||||||
|
self.assertIn('https://example.org/video', args)
|
||||||
|
if extra:
|
||||||
|
self.assertEqual(args[-1], 'audio.wav')
|
||||||
|
self.assertFalse(list((self.media / 'input').glob('download-*')))
|
||||||
|
|
||||||
|
def test_mux_preset_rejects_ambiguous_audio(self):
|
||||||
|
(self.media / 'input/video1.mp4').write_bytes(b'video')
|
||||||
|
(self.media / 'input/audio.wav').write_bytes(b'audio')
|
||||||
|
(self.media / 'output/audio.wav').write_bytes(b'audio')
|
||||||
|
self.assertNotEqual(self.launch('preset', 'merge', 'video1.mp4', 'audio.wav').returncode, 0)
|
||||||
|
self.assertFalse(self.log.exists())
|
||||||
|
|
||||||
|
def test_mux_preset_creates_audio_video_with_streams(self):
|
||||||
|
if subprocess.run(['bash', '-c', 'command -v ffmpeg && command -v ffprobe'],
|
||||||
|
capture_output=True).returncode != 0:
|
||||||
|
self.skipTest('ffmpeg and ffprobe required')
|
||||||
|
self.create_video()
|
||||||
|
audio = self.media / 'input/audio.wav'
|
||||||
|
subprocess.run(['ffmpeg', '-hide_banner', '-loglevel', 'error', '-f', 'lavfi',
|
||||||
|
'-i', 'sine=frequency=440:duration=1', str(audio)], check=True)
|
||||||
|
result = self.run_preset(self.fake_media_launcher(), 'merge', 'video1.mp4', 'audio.wav')
|
||||||
|
self.assertEqual(result.returncode, 0, result.stderr)
|
||||||
|
output = self.media / 'output/video1-unito.mp4'
|
||||||
|
self.assertTrue(output.is_file())
|
||||||
|
self.assertEqual(self.stream_types(output), {'video', 'audio'})
|
||||||
|
|
||||||
|
def test_voice_preset_outputs_audio_only(self):
|
||||||
|
self.create_video(audio=True)
|
||||||
|
result = self.run_preset(self.fake_media_launcher(), 'audio-convert', 'video1.mp4')
|
||||||
|
self.assertEqual(result.returncode, 0, result.stderr)
|
||||||
|
output = self.media / 'output/video1-mia_voce.wav'
|
||||||
|
self.assertEqual(self.stream_types(output), {'audio'})
|
||||||
|
self.assertFalse((self.media / 'output/video1-mia_voce.mp4').exists())
|
||||||
|
|
||||||
|
def test_split_presets_output_separate_streams_without_conversion(self):
|
||||||
|
original = self.create_video(audio=True).read_bytes()
|
||||||
|
for preset in ('split', 'split-stems'):
|
||||||
|
with self.subTest(preset=preset):
|
||||||
|
result = self.run_preset(self.fake_media_launcher(), preset, 'video1.mp4')
|
||||||
|
self.assertEqual(result.returncode, 0, result.stderr)
|
||||||
|
output = self.media / 'output' / f'video1-{preset}'
|
||||||
|
expected = {'video.mp4', 'audio.wav'}
|
||||||
|
if preset == 'split-stems':
|
||||||
|
expected |= {'vocals.wav', 'instrumental.wav'}
|
||||||
|
args = json.loads((self.media / 'rvc-args.json').read_text())
|
||||||
|
self.assertIn('--separate-only', args)
|
||||||
|
else:
|
||||||
|
self.assertFalse((self.media / 'rvc-args.json').exists())
|
||||||
|
self.assertEqual({p.name for p in output.iterdir()}, expected)
|
||||||
|
for name in expected:
|
||||||
|
self.assertEqual(self.stream_types(output / name),
|
||||||
|
{'video'} if name == 'video.mp4' else {'audio'})
|
||||||
|
self.assertEqual((self.media / 'input/video1.mp4').read_bytes(), original)
|
||||||
|
self.assertFalse(list((self.media / 'output').rglob('*mia_voce*')))
|
||||||
|
before = {p.name: p.read_bytes() for p in output.iterdir()}
|
||||||
|
repeated = self.run_preset(self.fake_media_launcher(), preset, 'video1.mp4',
|
||||||
|
job_id='repeat')
|
||||||
|
self.assertNotEqual(repeated.returncode, 0)
|
||||||
|
self.assertEqual({p.name: p.read_bytes() for p in output.iterdir()}, before)
|
||||||
|
|
||||||
|
def test_split_presets_reject_video_without_audio(self):
|
||||||
|
self.create_video()
|
||||||
|
for preset in ('split', 'split-stems'):
|
||||||
|
result = self.run_preset(self.fake_media_launcher(), preset, 'video1.mp4')
|
||||||
|
self.assertNotEqual(result.returncode, 0)
|
||||||
|
self.assertFalse(list((self.media / 'output').iterdir()))
|
||||||
|
|
||||||
|
def test_face_preset_preserves_audio_only_when_present(self):
|
||||||
|
for audio in (False, True):
|
||||||
|
with self.subTest(audio=audio):
|
||||||
|
video = self.media / 'input/video1.mp4'
|
||||||
|
if video.exists():
|
||||||
|
video.unlink()
|
||||||
|
self.create_video(audio=audio)
|
||||||
|
for number in range(11, 19):
|
||||||
|
(self.media / f'input/source{number}.jpg').write_bytes(b'source')
|
||||||
|
output = self.media / 'output/video1-facefusion.mp4'
|
||||||
|
if output.exists():
|
||||||
|
output.unlink()
|
||||||
|
result = self.run_preset(self.fake_media_launcher(), 'video-convert', 'video1.mp4',
|
||||||
|
job_id=f'test-{audio}')
|
||||||
|
self.assertEqual(result.returncode, 0, result.stderr)
|
||||||
|
self.assertEqual(self.stream_types(output),
|
||||||
|
{'video', 'audio'} if audio else {'video'})
|
||||||
|
|
||||||
|
def test_face_preset_uses_requested_options(self):
|
||||||
|
self.create_video(audio=True)
|
||||||
|
for number in range(11, 19):
|
||||||
|
(self.media / f'input/source{number}.jpg').write_bytes(b'source')
|
||||||
|
result = self.run_preset(self.fake_media_launcher(), 'video-convert', 'video1.mp4')
|
||||||
|
self.assertEqual(result.returncode, 0, result.stderr)
|
||||||
|
args = json.loads((self.media / 'facefusion-args.json').read_text())
|
||||||
|
source_start = args.index('--source-paths') + 1
|
||||||
|
self.assertEqual(args[source_start:source_start + 8],
|
||||||
|
[f'/work/input/source{number}.jpg' for number in range(11, 19)])
|
||||||
|
expected = {
|
||||||
|
'--processors': ['face_swapper'],
|
||||||
|
'--face-swapper-model': ['hyperswap_1a_256'],
|
||||||
|
'--face-swapper-pixel-boost': ['256x256'],
|
||||||
|
'--face-swapper-weight': ['0.5'],
|
||||||
|
'--face-detector-model': ['yolo_face'],
|
||||||
|
'--face-detector-size': ['640x640'],
|
||||||
|
'--face-detector-angles': ['0', '90', '180', '270'],
|
||||||
|
'--face-detector-score': ['0.5'],
|
||||||
|
'--face-selector-mode': ['one'],
|
||||||
|
'--face-selector-order': ['large-small'],
|
||||||
|
'--face-selector-gender': ['female'],
|
||||||
|
'--face-selector-race': ['white'],
|
||||||
|
'--face-mask-types': ['occlusion', 'region', 'area', 'box'],
|
||||||
|
'--face-occluder-model': ['xseg_1'],
|
||||||
|
'--face-parser-model': ['bisenet_resnet_34'],
|
||||||
|
'--face-mask-blur': ['0.3'],
|
||||||
|
'--output-video-encoder': ['libx264'],
|
||||||
|
'--output-video-preset': ['veryfast'],
|
||||||
|
'--output-video-quality': ['80'],
|
||||||
|
'--output-video-fps': ['30'],
|
||||||
|
'--execution-providers': ['cpu'],
|
||||||
|
'--output-audio-encoder': ['aac'],
|
||||||
|
'--jobs-path': ['/work/state'],
|
||||||
|
'--temp-path': ['/work/state/tmp'],
|
||||||
|
}
|
||||||
|
for flag, values in expected.items():
|
||||||
|
with self.subTest(flag=flag):
|
||||||
|
start = args.index(flag) + 1
|
||||||
|
self.assertEqual(args[start:start + len(values)], values)
|
||||||
|
|
||||||
|
def test_complete_preset_downloads_and_combines_both_results(self):
|
||||||
|
fixture = self.create_video(audio=True)
|
||||||
|
for number in range(11, 19):
|
||||||
|
(self.media / f'input/source{number}.jpg').write_bytes(b'source')
|
||||||
|
self.fake_downloader(fixture)
|
||||||
|
result = self.run_preset(self.fake_media_launcher(), 'convert',
|
||||||
|
'https://example.org/video', job_id='test')
|
||||||
|
self.assertEqual(result.returncode, 0, result.stderr)
|
||||||
|
self.assertTrue((self.media / 'input/download-test.mp4').is_file())
|
||||||
|
self.assertEqual(self.stream_types(self.media / 'output/download-test-mia_voce.wav'),
|
||||||
|
{'audio'})
|
||||||
|
self.assertEqual(self.stream_types(self.media / 'output/download-test-facefusion.mp4'),
|
||||||
|
{'video', 'audio'})
|
||||||
|
self.assertEqual(self.stream_types(self.media / 'output/download-test-completo.mp4'),
|
||||||
|
{'video', 'audio'})
|
||||||
|
face_args = json.loads((self.media / 'facefusion-args.json').read_text())
|
||||||
|
self.assertEqual(face_args[face_args.index('--face-selector-gender') + 1], 'female')
|
||||||
|
self.assertEqual(face_args[face_args.index('--output-video-fps') + 1], '30')
|
||||||
|
downloader_args = json.loads(self.log.read_text())
|
||||||
|
self.assertIn('--ignore-config', downloader_args)
|
||||||
|
self.assertIn('--no-playlist', downloader_args)
|
||||||
|
|
||||||
def test_default_gui_uses_independent_user_service(self):
|
def test_default_gui_uses_independent_user_service(self):
|
||||||
self.env.update(XDG_RUNTIME_DIR=str(self.root), WAYLAND_DISPLAY='wayland-0')
|
self.env.update(XDG_RUNTIME_DIR=str(self.root), WAYLAND_DISPLAY='wayland-0')
|
||||||
runner = self.root / 'systemd-run'
|
runner = self.root / 'systemd-run'
|
||||||
@@ -84,6 +494,72 @@ class LauncherTest(unittest.TestCase):
|
|||||||
self.assertNotIn('--pty', args)
|
self.assertNotIn('--pty', args)
|
||||||
self.assertNotIn('--wait', args)
|
self.assertNotIn('--wait', args)
|
||||||
|
|
||||||
|
def test_all_presets_download_url_before_processing(self):
|
||||||
|
fixture = self.create_video(audio=True)
|
||||||
|
self.fake_downloader(fixture)
|
||||||
|
for number in range(11, 19):
|
||||||
|
(self.media / f'input/source{number}.jpg').write_bytes(b'source')
|
||||||
|
audio = self.media / 'input/audio.wav'
|
||||||
|
subprocess.run(['ffmpeg', '-hide_banner', '-loglevel', 'error', '-i',
|
||||||
|
str(fixture), '-vn', str(audio)], check=True)
|
||||||
|
outputs = {
|
||||||
|
'audio-convert': 'mia_voce.wav', 'video-convert': 'facefusion.mp4',
|
||||||
|
'merge': 'unito.mp4', 'split': 'split', 'split-stems': 'split-stems',
|
||||||
|
'convert': 'completo.mp4',
|
||||||
|
}
|
||||||
|
for preset, suffix in outputs.items():
|
||||||
|
with self.subTest(preset=preset):
|
||||||
|
extra = ['audio.wav'] if preset == 'merge' else []
|
||||||
|
result = self.run_preset(self.fake_media_launcher(), preset,
|
||||||
|
'https://example.org/video?a=1&b=2', *extra,
|
||||||
|
job_id=preset)
|
||||||
|
self.assertEqual(result.returncode, 0, result.stderr)
|
||||||
|
self.assertEqual(result.stdout.count('Downloading one video'), 1)
|
||||||
|
self.assertTrue((self.media / f'input/download-{preset}.mp4').is_file())
|
||||||
|
output = self.media / f'output/download-{preset}-{suffix}'
|
||||||
|
self.assertTrue(output.exists())
|
||||||
|
if preset in ('split', 'split-stems'):
|
||||||
|
self.assertEqual(self.stream_types(output / 'video.mp4'), {'video'})
|
||||||
|
self.assertEqual(self.stream_types(output / 'audio.wav'), {'audio'})
|
||||||
|
else:
|
||||||
|
self.assertEqual(self.stream_types(output), {'audio'} if
|
||||||
|
preset == 'audio-convert' else {'video', 'audio'})
|
||||||
|
download_args = json.loads(self.log.read_text())
|
||||||
|
self.assertEqual(download_args[-1], 'https://example.org/video?a=1&b=2')
|
||||||
|
for flag in ('--ignore-config', '--no-playlist', '--no-overwrites'):
|
||||||
|
self.assertIn(flag, download_args)
|
||||||
|
|
||||||
|
def test_convert_also_accepts_local_video_without_download(self):
|
||||||
|
fixture = self.create_video(audio=True)
|
||||||
|
self.fake_downloader(fixture)
|
||||||
|
for number in range(11, 19):
|
||||||
|
(self.media / f'input/source{number}.jpg').write_bytes(b'source')
|
||||||
|
result = self.run_preset(self.fake_media_launcher(), 'convert', fixture.name)
|
||||||
|
self.assertEqual(result.returncode, 0, result.stderr)
|
||||||
|
self.assertFalse(self.log.exists())
|
||||||
|
self.assertEqual(self.stream_types(self.media / 'output/video1-completo.mp4'),
|
||||||
|
{'video', 'audio'})
|
||||||
|
|
||||||
|
def test_all_presets_reject_invalid_urls_before_dispatch(self):
|
||||||
|
for preset in ('split', 'split-stems', 'audio-convert', 'video-convert',
|
||||||
|
'merge', 'convert'):
|
||||||
|
for url in ('file:///tmp/video.mp4', 'https://localhost/video',
|
||||||
|
'http://192.168.1.1/video', 'https://user:password@example.org/video'):
|
||||||
|
with self.subTest(preset=preset, url=url):
|
||||||
|
extra = ['audio.wav'] if preset == 'merge' else []
|
||||||
|
result = self.launch('preset', preset, url, *extra)
|
||||||
|
self.assertNotEqual(result.returncode, 0)
|
||||||
|
self.assertFalse(self.log.exists())
|
||||||
|
|
||||||
|
def test_failed_url_download_does_not_start_processing(self):
|
||||||
|
downloader = self.root / 'yt-dlp'
|
||||||
|
downloader.write_text('#!/bin/sh\nexit 1\n')
|
||||||
|
downloader.chmod(0o755)
|
||||||
|
result = self.run_preset(self.fake_media_launcher(), 'split',
|
||||||
|
'https://example.org/video')
|
||||||
|
self.assertNotEqual(result.returncode, 0)
|
||||||
|
self.assertFalse(list((self.media / 'output').iterdir()))
|
||||||
|
|
||||||
def test_symlinked_input_is_rejected(self):
|
def test_symlinked_input_is_rejected(self):
|
||||||
(self.media / 'input').rmdir()
|
(self.media / 'input').rmdir()
|
||||||
(self.media / 'input').symlink_to(self.root)
|
(self.media / 'input').symlink_to(self.root)
|
||||||
|
|||||||
93
ansible/roles/desktop_ai_media/tests/test_preset_rvc.py
Normal file
93
ansible/roles/desktop_ai_media/tests/test_preset_rvc.py
Normal file
@@ -0,0 +1,93 @@
|
|||||||
|
import importlib.util
|
||||||
|
import os
|
||||||
|
from pathlib import Path
|
||||||
|
import sys
|
||||||
|
import tempfile
|
||||||
|
from types import ModuleType
|
||||||
|
import unittest
|
||||||
|
from unittest.mock import Mock, patch
|
||||||
|
|
||||||
|
|
||||||
|
class SeparationWorkerTest(unittest.TestCase):
|
||||||
|
def test_convert_only_applies_mia_voce_without_importing_separator(self):
|
||||||
|
spec = importlib.util.spec_from_file_location(
|
||||||
|
'preset_rvc', Path(__file__).resolve().parents[1] / 'files/preset_rvc.py')
|
||||||
|
worker = importlib.util.module_from_spec(spec)
|
||||||
|
spec.loader.exec_module(worker)
|
||||||
|
with tempfile.TemporaryDirectory() as directory:
|
||||||
|
root = Path(directory)
|
||||||
|
output = root / 'output'
|
||||||
|
job = output / 'job'
|
||||||
|
job.mkdir(parents=True)
|
||||||
|
source = job / 'audio.wav'
|
||||||
|
source.write_bytes(b'audio')
|
||||||
|
weights = root / 'state/weights/mia_voce.pth'
|
||||||
|
index = root / 'state/mia_voce/added_IVF256_Flat_nprobe_1_mia_voce_v2.index'
|
||||||
|
for path in (weights, index):
|
||||||
|
path.parent.mkdir(parents=True, exist_ok=True)
|
||||||
|
path.write_bytes(b'model')
|
||||||
|
|
||||||
|
def mapped_path(value):
|
||||||
|
return root / str(value).removeprefix('/work/') if str(value).startswith(
|
||||||
|
'/work/') else Path(value)
|
||||||
|
|
||||||
|
config = ModuleType('configs.config')
|
||||||
|
config.Config = Mock()
|
||||||
|
vc = ModuleType('infer.vc.modules')
|
||||||
|
voice = Mock()
|
||||||
|
voice.vc_single.return_value = ('Success', (40000, [0.1, 0.2]))
|
||||||
|
vc.VC = Mock(return_value=voice)
|
||||||
|
sf = ModuleType('soundfile')
|
||||||
|
sf.write = Mock(side_effect=lambda path, data, rate: path.write_bytes(b'converted'))
|
||||||
|
modules = {'configs.config': config, 'infer.vc.modules': vc,
|
||||||
|
'soundfile': sf, 'tools.pymss_webui': None}
|
||||||
|
with patch.object(worker, 'Path', mapped_path), \
|
||||||
|
patch.object(sys, 'argv', ['preset_rvc.py', str(source), str(job),
|
||||||
|
'--convert-only']), \
|
||||||
|
patch.dict(sys.modules, modules), patch.dict(os.environ):
|
||||||
|
worker.main()
|
||||||
|
voice.get_vc.assert_called_once_with('mia_voce.pth')
|
||||||
|
self.assertEqual(voice.vc_single.call_args.args[1], str(source))
|
||||||
|
self.assertEqual(voice.vc_single.call_args.args[4], str(index))
|
||||||
|
self.assertEqual((job / 'vocals-mia_voce.wav').read_bytes(), b'converted')
|
||||||
|
self.assertFalse((job / 'vocals').exists())
|
||||||
|
self.assertFalse((job / 'instrumental').exists())
|
||||||
|
|
||||||
|
def test_separate_only_does_not_require_personal_voice_weights(self):
|
||||||
|
spec = importlib.util.spec_from_file_location(
|
||||||
|
'preset_rvc', Path(__file__).resolve().parents[1] / 'files/preset_rvc.py')
|
||||||
|
worker = importlib.util.module_from_spec(spec)
|
||||||
|
spec.loader.exec_module(worker)
|
||||||
|
with tempfile.TemporaryDirectory() as directory:
|
||||||
|
output = Path(directory)
|
||||||
|
job = output / 'job'
|
||||||
|
job.mkdir()
|
||||||
|
source = job / 'audio.wav'
|
||||||
|
source.write_bytes(b'fixture')
|
||||||
|
separator = ModuleType('tools.pymss_webui')
|
||||||
|
|
||||||
|
def separate(model, audio, vocals, unused, instrumental, fmt, **kwargs):
|
||||||
|
self.assertEqual(model, 'vocals-bs-roformer-368')
|
||||||
|
self.assertEqual(audio, str(source))
|
||||||
|
(Path(vocals) / 'stem.wav').write_bytes(b'vocals')
|
||||||
|
(Path(instrumental) / 'stem.wav').write_bytes(b'instrumental')
|
||||||
|
yield 'Separated'
|
||||||
|
|
||||||
|
separator.pymss_separate = separate
|
||||||
|
|
||||||
|
def mapped_path(value):
|
||||||
|
return output if str(value) == '/work/output' else Path(value)
|
||||||
|
|
||||||
|
with patch.object(worker, 'Path', mapped_path), \
|
||||||
|
patch.object(sys, 'argv', ['preset_rvc.py', str(source), str(job),
|
||||||
|
'--separate-only']), \
|
||||||
|
patch.dict(sys.modules, {'tools.pymss_webui': separator}), \
|
||||||
|
patch.dict(os.environ):
|
||||||
|
worker.main()
|
||||||
|
self.assertTrue((job / 'vocals/stem.wav').is_file())
|
||||||
|
self.assertTrue((job / 'instrumental/stem.wav').is_file())
|
||||||
|
self.assertFalse((job / 'vocals-mia_voce.wav').exists())
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
unittest.main()
|
||||||
142
docs/ai-media-presets.md
Normal file
142
docs/ai-media-presets.md
Normal file
@@ -0,0 +1,142 @@
|
|||||||
|
# Preset offline `ai-media`
|
||||||
|
|
||||||
|
Tutti i preset video accettano un nome MP4 locale oppure un URL HTTP(S).
|
||||||
|
I file locali vanno in `~/.local/share/ai-media/input/`. I preset avviano un servizio
|
||||||
|
`systemd --user` e tornano subito; FaceFusion e RVC restano nei container
|
||||||
|
offline. Il terminale stampa il nome del job e il comando per seguirne i log.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# 1. Estrae l'audio, separa voce/strumentale, converte tutta la traccia
|
||||||
|
# vocale con mia_voce e restituisce solo l'audio finale mixato.
|
||||||
|
ai-media preset audio-convert video1.mp4
|
||||||
|
|
||||||
|
# 2. Applica source11.jpg ... source18.jpg al video: conserva l'audio
|
||||||
|
# originale se presente, altrimenti produce un video senza audio.
|
||||||
|
ai-media preset video-convert video1.mp4
|
||||||
|
|
||||||
|
# 3. Unisce un video in input/ con un audio presente in input/ oppure output/.
|
||||||
|
ai-media preset merge video1.mp4 audio.wav
|
||||||
|
|
||||||
|
# 4. Esegue voce e volti, poi unisce il video modificato con l'audio convertito.
|
||||||
|
# Se l'input è un URL, scarica prima un singolo video con yt-dlp.
|
||||||
|
ai-media preset convert 'https://esempio.org/video'
|
||||||
|
|
||||||
|
# 5. Separa il video (senza ricodificarlo) dalla prima traccia audio.
|
||||||
|
ai-media preset split video1.mp4
|
||||||
|
|
||||||
|
# 6. Come split, poi separa l'audio in voce e strumentale, senza convertirne la voce.
|
||||||
|
ai-media preset split-stems video1.mp4
|
||||||
|
|
||||||
|
# 7. Sovrappone voce e strumentale in un unico audio (non concatena le tracce).
|
||||||
|
ai-media preset mix vocals.wav instrumental.wav
|
||||||
|
|
||||||
|
# 8. Applica mia_voce direttamente a un audio, senza separazione né remix.
|
||||||
|
ai-media preset voice-convert voce.wav
|
||||||
|
```
|
||||||
|
|
||||||
|
## Applicare mia_voce a un audio
|
||||||
|
|
||||||
|
```bash
|
||||||
|
ai-media preset voice-convert voce.wav
|
||||||
|
ai-media preset voice-convert video1-split-stems/vocals.wav --output video1-mia_voce.wav
|
||||||
|
```
|
||||||
|
|
||||||
|
`voice-convert` legge un audio locale in `input/` oppure `output/`, anche in
|
||||||
|
una sottocartella, e produce `output/<nome-audio>-mia_voce.wav`. `--output`
|
||||||
|
permette di scegliere un altro nome WAV. Converte prima la traccia in WAV e
|
||||||
|
applica direttamente il modello RVC `mia_voce` con il relativo indice e RMVPE,
|
||||||
|
senza BS Roformer e senza aggiungere lo strumentale. Usare preferibilmente
|
||||||
|
una voce isolata: il preset non rimuove musica né separa parlanti.
|
||||||
|
Accetta i formati audio decodificabili dal FFmpeg installato. Richiede il
|
||||||
|
modello e l'indice personali già presenti nello stato RVC, funziona offline
|
||||||
|
in background, conserva l'originale e rifiuta risultati già esistenti.
|
||||||
|
Gli intermedi restano nella sottocartella nascosta del job in `output/`.
|
||||||
|
|
||||||
|
Per rimettere lo strumentale dopo la conversione:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
ai-media preset mix video1-mia_voce.wav video1-split-stems/instrumental.wav --output video1-mix.wav
|
||||||
|
```
|
||||||
|
|
||||||
|
## Unire voce e strumentale
|
||||||
|
|
||||||
|
`mix` usa due audio locali in `input/` o `output/`, anche nelle sottocartelle
|
||||||
|
create da `split-stems`:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
ai-media preset mix video1-split-stems/vocals.wav video1-split-stems/instrumental.wav --output video1-mix.wav
|
||||||
|
```
|
||||||
|
|
||||||
|
Il risultato è `output/video1-mix.wav`, PCM WAV a 16 bit. Senza `--output`,
|
||||||
|
il nome è `<nome-vocale>-mix.wav` (per esempio `vocals-mix.wav`). Le tracce
|
||||||
|
partono insieme da zero e vengono sommate a volume originale, senza
|
||||||
|
normalizzazione; la durata è quella della traccia più lunga. Livelli troppo
|
||||||
|
alti possono causare clipping. Il preset non esegue separazione o conversione
|
||||||
|
vocale, non modifica gli originali e non sovrascrive file esistenti. Parte in
|
||||||
|
background come gli altri preset e usa solo FFmpeg nel container offline.
|
||||||
|
Gli audio devono essere univoci tra `input/` e `output/`; percorsi assoluti,
|
||||||
|
`..`, link simbolici e URL audio non sono accettati.
|
||||||
|
|
||||||
|
## Video da URL
|
||||||
|
|
||||||
|
Per ogni preset video si può sostituire il nome del video con un URL tra virgolette:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
ai-media preset split 'https://esempio.org/video'
|
||||||
|
ai-media preset split-stems 'https://esempio.org/video'
|
||||||
|
ai-media preset audio-convert 'https://esempio.org/video'
|
||||||
|
ai-media preset video-convert 'https://esempio.org/video'
|
||||||
|
ai-media preset merge 'https://esempio.org/video' audio.wav
|
||||||
|
ai-media preset convert 'https://esempio.org/video'
|
||||||
|
# Anche convert accetta un file locale, senza download:
|
||||||
|
ai-media preset convert video1.mp4
|
||||||
|
```
|
||||||
|
|
||||||
|
Il download con `yt-dlp` avviene una sola volta nello stesso job in background,
|
||||||
|
prima dell'elaborazione. Il video scaricato resta in `input/download-<ID>.mp4`;
|
||||||
|
i risultati usano lo stesso prefisso `download-<ID>` al posto di `video1`.
|
||||||
|
Serve `yt-dlp` sull'host solo per gli URL. L'audio di `merge` rimane un file
|
||||||
|
locale in `input/` oppure `output/`. URL locali/privati o contenenti credenziali
|
||||||
|
non vengono accettati. Se il download fallisce, l'elaborazione non parte.
|
||||||
|
|
||||||
|
`split` produce `output/video1-split/video.mp4` (muto) e `audio.wav`.
|
||||||
|
`split-stems` produce `output/video1-split-stems/` con `video.mp4`, `audio.wav`,
|
||||||
|
`vocals.wav` e `instrumental.wav`. L'audio estratto è PCM WAV a 16 bit;
|
||||||
|
la separazione usa BS Roformer offline nel container RVC e non richiede
|
||||||
|
il modello personale `mia_voce`. Entrambi richiedono un video con audio,
|
||||||
|
non modificano l'originale e rifiutano una cartella risultato già esistente.
|
||||||
|
Mantengono gli intermedi nella sottocartella nascosta del job in `output/`;
|
||||||
|
i risultati pubblicati sono hard link e non duplicano lo spazio dei file.
|
||||||
|
|
||||||
|
`video-convert` e il passaggio video di `convert` usano lo stesso profilo
|
||||||
|
FaceFusion: HyperSwap 1a 256 (pixel boost 256x256, peso 0.5), rilevatore
|
||||||
|
`yolo_face` 640x640 agli angoli 0/90/180/270, selezione `one` per volto
|
||||||
|
grande, filtri `female` e `white`, maschere `occlusion region area box` con
|
||||||
|
`xseg_1` e `bisenet_resnet_34` (blur 0.3), H.264 `libx264` veryfast, qualità
|
||||||
|
80 e 30 fps. L'audio originale viene ripristinato separatamente quando esiste.
|
||||||
|
|
||||||
|
Risultati: `output/video1-mia_voce.wav`, `output/video1-facefusion.mp4` e
|
||||||
|
`output/video1-unito.mp4`. Il preset `convert` crea
|
||||||
|
`output/video1-completo.mp4` (o `output/download-<ID>-completo.mp4` da URL),
|
||||||
|
mantenendo anche l'audio e il video intermedi. Richiede `source11.jpg`–`source18.jpg`
|
||||||
|
in `input/` e un video che contenga audio. **Solo il download** tramite
|
||||||
|
`yt-dlp` usa la rete; non usa la configurazione o i cookie personali di
|
||||||
|
`yt-dlp` e non scarica playlist. I file esistenti non vengono sovrascritti. Il
|
||||||
|
primo e il secondo preset conservano i passaggi intermedi in una sottocartella
|
||||||
|
`.video1-...` di `output/`, utile per diagnosi e recupero; non viene rimossa
|
||||||
|
automaticamente.
|
||||||
|
|
||||||
|
Per controllare un job, usare il nome stampato dal comando:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
journalctl --user -fu ai-media-preset-YYYYMMDD-HHMMSS-ID
|
||||||
|
systemctl --user status ai-media-preset-YYYYMMDD-HHMMSS-ID
|
||||||
|
```
|
||||||
|
|
||||||
|
Il preset `audio-convert` converte l'intero stem vocale: non distingue automaticamente
|
||||||
|
voci maschili e femminili e non separa parlanti sovrapposti. L'elaborazione è
|
||||||
|
in background, **non** più rapida della capacità della CPU. I nomi dei video locali
|
||||||
|
devono essere semplici, senza percorsi; gli audio possono indicare sottocartelle
|
||||||
|
relative a `input/` o `output/`. Se lo stesso audio
|
||||||
|
è in `input/` e `output/`, il comando rifiuta l'ambiguità. Tutti i video di
|
||||||
|
input dei preset devono essere MP4 con un nome diverso dal risultato atteso.
|
||||||
42
docs/atlas-gitea-registry.md
Normal file
42
docs/atlas-gitea-registry.md
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
# Atlas Gitea container registry
|
||||||
|
|
||||||
|
The existing Gitea instance provides an OCI container registry at
|
||||||
|
`git.fscotto.co`. Gitea 1.25.2 enables packages by default; no separate
|
||||||
|
container, port, DNS record, or registry service is required. The existing
|
||||||
|
Gitea HTTPS proxy route is used. The setting applies to Gitea's package
|
||||||
|
registry generally, not only container images.
|
||||||
|
|
||||||
|
On 2026-10-25, both the Atlas HTTP endpoint and the public HTTPS `/v2/`
|
||||||
|
endpoint returned the expected `401` bearer authentication challenge. NPM's
|
||||||
|
effective `client_max_body_size` was `2000m`; larger individual requests may
|
||||||
|
be rejected. Authentication and an actual image push and pull have not yet
|
||||||
|
been tested. Do not interpret the unauthenticated challenge as a complete test.
|
||||||
|
|
||||||
|
## Use with Podman
|
||||||
|
|
||||||
|
Replace `OWNER`, `IMAGE`, and `TAG` with your Gitea user or organization and
|
||||||
|
image details. Log in interactively; use a personal access token when using
|
||||||
|
two-factor authentication. Do not put credentials in commands or shell history.
|
||||||
|
|
||||||
|
```sh
|
||||||
|
podman login git.fscotto.co
|
||||||
|
podman tag LOCAL_IMAGE:TAG git.fscotto.co/OWNER/IMAGE:TAG
|
||||||
|
podman push git.fscotto.co/OWNER/IMAGE:TAG
|
||||||
|
podman pull git.fscotto.co/OWNER/IMAGE:TAG
|
||||||
|
```
|
||||||
|
|
||||||
|
Choose the package's visibility and access deliberately in Gitea. Check the
|
||||||
|
package page and verify the pulled image digest when testing. No automatic
|
||||||
|
cleanup policy is configured by this document.
|
||||||
|
|
||||||
|
## Data and recovery
|
||||||
|
|
||||||
|
The observed package storage directory is
|
||||||
|
`/zpool/services/data/gitea/data/gitea/packages`, inside the existing Gitea
|
||||||
|
dataset. Package metadata also depends on the Gitea database and configuration.
|
||||||
|
Existing recursive ZFS and backup coverage must include both, but a successful
|
||||||
|
registry-specific backup and restore has not been tested. Review backup capacity
|
||||||
|
and consistency as image storage grows; a snapshot alone is not proof of an
|
||||||
|
application-consistent restore.
|
||||||
|
|
||||||
|
Reference: https://docs.gitea.com/1.25/usage/packages/container/
|
||||||
@@ -1,112 +1,105 @@
|
|||||||
$ANSIBLE_VAULT;1.1;AES256
|
$ANSIBLE_VAULT;1.1;AES256
|
||||||
38306362366434613061663337666462386565633738373039303632383537393035653562306665
|
63663833623438616565343663313331363634363833306634373834663632376563666632363732
|
||||||
3931616337326533643632353636336363653166626634370a623431663964306634356233626331
|
3264396532643463366231313765343330633663666465320a623566636432333033666639626335
|
||||||
37333434663361363263376338633132356166646131653839353866383538623965666563613031
|
37376639383062613861366339613366636238326665346331343265376339623461326431613634
|
||||||
6337393333323139630a646536383430366266653736656634396337643338373037653936623234
|
6331646163363862620a323033656264623764663365333731393233373735313061656430383035
|
||||||
32346565626363313861303231303338303533643232326534636461393761643631306662643934
|
31623264316439643134633737346235353764313638633265373533356365346161386639646630
|
||||||
62613132313734646330353132643530363337653862646635616361316631613166366533353938
|
62383532333035356339303435323133306132613636646130366635646665353738646161333264
|
||||||
66656462623835343235313136353262306266633136383830653232333931323465346334663362
|
66386230393934653164323932353239363539316631373834633564323431303336326236656232
|
||||||
61323736306262383231333234366266623465366637343964626138646463336438633465623739
|
34666236616634393263343265336665636535663035643863323132336233646439636232666335
|
||||||
33353332363065653831636563616561363434633866373735313262353732333136353034303835
|
65613361663764646639316662353134306265363764646563646230613432343563363936643861
|
||||||
37313466306161356637346463323137653363353962363139306532316463616532333935336638
|
63626539633838383031636239656364376130333761663836643863313763316264373166613434
|
||||||
61393234376331313032343033656235613138303265633963343334303239353662323563613163
|
62363062663637666339373135336432356535633333643261633935663130383130373761373964
|
||||||
39613666353961396564373966656563353064353031313935646235353635316535613861316562
|
34396336363264316232323462633332343465613037333164353562326131636335323666396136
|
||||||
65643135366339653665336633396363316166643666623366313935396539316633666432313865
|
30383830633365613463623634656532336566313436366334323963666564316136373762393566
|
||||||
37653665613663313136663231323165393830323265353732626430396263613434343931643136
|
38623234646161633636636633313163386439356337363437656164613236356266303933636566
|
||||||
62663333666337346164376564316533653039303962616262376164383432653938306565663565
|
35333065303337353636653338376236303836373135633130663463333461636338316163353232
|
||||||
35376438353932633865623631633064326332666365366537623561613664393439623938333938
|
36353436303031643433616163373637613334653837653734666637373436333763346565363431
|
||||||
64386231653339616532646632346338613362306461316631613231393065653833616266343337
|
37373461333533353933653863636633333661356366313164613935343962386131326537653536
|
||||||
38396461636364373238643330333232373630373762303636383331646433613839663765343835
|
38376636363732373437373663616431636666616166623034343730303166343065653832363933
|
||||||
32393238326135333139396334346636636237356265356331653539616434363865366137393562
|
63396339623537656565363931616437353761336361326134613132333434363363333431393965
|
||||||
63663938326431363632613836343335336232313038323334303339303236363331303831633266
|
61666436636565626338313435386534306433373064613464333464396237356239343538386565
|
||||||
66386463643964636538613031336661656237343535343734666130356337643936373333393863
|
35343930343137313262323563663262333930356461303134323438373939643564346532306266
|
||||||
38653137323633653238623063303563623835386235333138343938306166623863666432313731
|
38656231396334666533613737393836333536663030393930383138343135373265636130613431
|
||||||
31343037343930303732653666623233353136363035623865333532316463333432386636636563
|
35353762666536643539636532343163303132656261663163646533626633303831306164313363
|
||||||
35343463656332353036323832363336623035306539663537363464343939643630366231363038
|
33643938623032323830636531613664396238356331333631306530346134303565663131666663
|
||||||
36353561313837663338333233343933333039343832316237373038626632323262333539363365
|
31313930356130343736363033613939663664663137303832336663623139313634646161343837
|
||||||
66663831663134623933333961373366356131623066373464343539623438386563623561356639
|
39663439346462646134653435326565373363343632306334373139346633353832363263396361
|
||||||
38616131373865376236383164323132393736376135653936623161626132653037353332613730
|
62393330343230663964393438393163646531353466356435333237613235636535346461656639
|
||||||
66666332393461363632653735303435316661333234326364636366386663623230333138306464
|
61616639386366306433613732393830336663353736316131616464626331656566303563643966
|
||||||
63626238623364316563636634666632663939316166353333303165626336353737636531376537
|
66393133633166633363326335663762356333386133363061396233303038663839373263623762
|
||||||
38626636613864336166346364336533303437623630393466373061613433646266383766313132
|
39623361333035663934363137303539646130306434326138613764363762363861303037633439
|
||||||
33346635626135353764656666353532376163323162313439336665636563616638333735653537
|
37393763633365623838323432636230623063626432336633336639316233326363656666323135
|
||||||
63653234333562333235323531393061626239383437643334343638353538323031376133313762
|
64663762333062383030323837343965663739326366306230333031306338323034363131373837
|
||||||
36636535336637356163643534333334353033343966333163336634663134306331666334643032
|
36386230653439386635633265343939323566376632663262343438643362353837363836626566
|
||||||
34633435336339623264386466303531656336393738303431656336336432313763383239646636
|
61343464313162383862663531626238643666373064383432313431376330353130313466333733
|
||||||
62313938396237623966666130366331666138393335323032383334353961363064346637363363
|
66333039366361636161393939613039393134343530626639356566353737366266393534353663
|
||||||
64386463636637626137363032386536613162616231333636636662346339373762363363353763
|
31333635363265343736363930633831356231343936646461383934366662303838643234336533
|
||||||
35656539636664393163616338376539363036653033333238383836383036363163393264346632
|
64313164643432313665386562323138383066666638613136373161343561333064373630663034
|
||||||
39633261613435653634663765663034643036323563653037396532623561343863636361653166
|
37396665643435303330313265653730326533316362613632313761633036353562373133643835
|
||||||
34386239633462393962613662366366633939366331373939623534653661653465656133396466
|
31613033343336616132323937616137653332376336363266356363383731616638353161363863
|
||||||
63633964343537323435616631626431376339353734353639393038666438663831353732373865
|
37373963323062333630316239393332363034626364666138333230316432383261366436386661
|
||||||
62626465363431353733346664636362313435623336623137356665626362393534306266303030
|
38363963383130353762326236336161653363306164303432663934356430633935346165306339
|
||||||
37353339326439643530663762333638633264646535636639356430646366666233626231636533
|
38333566366434613265343730653663393434366533333161636363323761376630376535353263
|
||||||
65353939363133353933393434393064666631623230336166313661366564626137353139636363
|
31343539656365656639313861353836646466653237386239633264643030333037306632663462
|
||||||
64616161323032383666623166633261306466653432663062363566663535306462393933636137
|
66653932633365313766363865323232386638346266663262343136363332356163323236366438
|
||||||
63346162633563323233646366383863653664353864643735366330633634373931346132393938
|
32313862646635383935306139376435633561373962363836653330316264373937356262343464
|
||||||
36373235333264396432313231653835343436353836396662663834356538373339636237636563
|
33303033626235613363616630306562306431663562343435653231333361336362643866383664
|
||||||
36666363393833623037356336333332613566346165326333363163363437643430376131376439
|
62343862316136613166353166313465646536663964636338306439656163333933386231353962
|
||||||
31353233633839333936316130643566643533613765666439616135326665646138613763353161
|
63336464623537343232313963323831313861323134613465376433396466616336623763646234
|
||||||
65623161363761666438643062303565613261356438356635393338383132326238653766666534
|
37663235393938636165303530643139626339313561303935363036396637346262393132363437
|
||||||
31373963623139336135313766653133633037666336663562666530356338656439323834613262
|
34616439363831626332303539326437303665353937393466646264656336373061656164363138
|
||||||
63346633366262363064363137326537666565326135663764613561613838316633613130666137
|
39366464653733336634313434646365333530316431316366663866643562366230353566633764
|
||||||
62303166303531653231383435313964333437643036646462393165343265343537663130343761
|
66333231363963643837353862313233316633626337363538363637376531626335353737323234
|
||||||
30653439376636383737396266313331346664356134373134626431663861636562343635313530
|
39363533656462343635333034393633623039333336363963393766646538636533643230653834
|
||||||
66313230343930613836623232663366313433626136343737393936396464393864306136373732
|
33343032363838643163343539646335373732363866323035363766363536383536383133393832
|
||||||
37383861373364623234313866323430633331313536373938643332306233636534366138623961
|
35343538356662376635656664353539633936633535643932613663396162326334376532656137
|
||||||
61666531313033313636326265373937656236663731663164373661663131613764316130303263
|
61373164613736353934616631626263393530336533306361643537363131306262616630356137
|
||||||
34643861336631663534393036666533323134616364323464303635666637376161643662633334
|
35636336616132333830393865653831366161613534613134366135373835656335623866386538
|
||||||
31346662613433636136613965303563343231323565613463663839636366336161633536313836
|
64306362663131653938626231363162303038313333356435393639646434613830323437666130
|
||||||
38666264373034623232393663353639363733366335363938386536343966356235393638323264
|
31373034313838376234653965313138626232396462646665333365643231613566393861393036
|
||||||
34316531623239303636646434323238356662383664343961646632626638626636653631626261
|
66316430356233383634343064323236316235636466316132383536373531343662333833663934
|
||||||
35623837376661646632336566363333653965636662306131383862633866363661313731666139
|
32373561313761383565663534393766363533636538633865366438333533316537346130336563
|
||||||
38616535633434656135626461313432353838363432323463323533626661383466366237643464
|
65616238383131653461613564633436353732616332343437313032353839633639663630346533
|
||||||
65656164366466393331386239366635323636363239333439303538626534643036663365666433
|
66613336323063656134373130333933366336633066663533303030623663653862666562396565
|
||||||
33356334366632323232333634356465383034303639323732326537366632663764323133653763
|
65383138303230303030353834303264313837336365663636653535636534613737373762343638
|
||||||
61616234333738366533633736396666616262363538333762396635363835366661363039613031
|
63393636636133653630333936333230323533313061326164353839656231343037613531666539
|
||||||
30626232346635366537383830316563376630356134333264336165636265663131313064393930
|
33316635313537383662613239653463373438313434626338353435653933333633363461656337
|
||||||
36383836336630396564653630326135383637663637303564333332376634666161313963393439
|
65333938316434613631633631356264343566303165396638333861393866653261663562356138
|
||||||
35653831303436656435383864393761633131393036373832316633613137626263633631643338
|
32313538653131393238623261363235616136376334663231623033313736323030623236356465
|
||||||
34373230616366663935326339373563666434346435643064616137363539333337373739643639
|
66626663306435663133386335633638643462626234656538626464623463376264333436393238
|
||||||
31623765356335343834323164643464343132303164393334626136633562353830346631326433
|
62353131323433613338376438316261373566646136626164656463313366363332643031623033
|
||||||
33663765626365373035613434363336613832663531613463643932383038653538643839343730
|
30303431336162636561643762666237383538396335663830663336636337326366643639616335
|
||||||
32316131346438383736393663656262376534643261616161366631613166326266656363363664
|
38633930653761386435353433376665636632303566656162643461646231316232633538663961
|
||||||
30613332396133623738313836646437656464366664386266643737316234613237623461336466
|
37643632343237366464343266653730363061393031656164326139333935346262343133306231
|
||||||
64336433303932633939323562623563636333323635626563386665363366376235386438653134
|
61626564636164363163366432383832303834663430616464373664626562656235316134346433
|
||||||
34386230393332303964363862616562613337363139373437323832663133336465643037383738
|
33376661613664653434376234656431303861353365366439626562613738356231306566326663
|
||||||
65363131373936633933376231346339353037323132383030613266393335373361643262373461
|
38623064663963333032323639323162383539316562666631363530336661616537343130656564
|
||||||
32626138356663306564363663376139353566343666343536633533613438306266323664663930
|
64363135653636656634343830376261393263663533633933643736636335666463333266396465
|
||||||
65626366346539316130656231366436393863643234626263643835363561336261343461393937
|
31653139653731346436643037626536623966316434386335393334373939333837316234656334
|
||||||
36383635383161396535626334613761323361386638343939323635313365656534623238303733
|
64386264383961376333323035356264386231316439393037346438303363343139353839373935
|
||||||
66386236626134333662333436323663346330313738323137313636373266373864336633663531
|
34633235323465383233373432323166343762343664623734383735346237313135346362616433
|
||||||
34626238303534323633363264363136623532323432623939356566663330666463383935396630
|
65376439366365626332396139643962376136613032373238303234393533333562316639666538
|
||||||
39386561366236353266323763363732373434653330373238626261653361383963366662313236
|
65373566316563373564623132656235373132613036386339353664643864646436646465373666
|
||||||
36313834326632303933313666343462633037316236663962636338613536656363363263613930
|
33653634303734623936633061323736663565363464323430316565643062393930313863623036
|
||||||
30666432653239636362323238356137363164393135623230303033323862343736306434336239
|
31316663303033636136653766346431626235643265663461336339643437343661353461303831
|
||||||
38333335376662313132386335306262313332313234646563656133303765313866653064323538
|
65386363366262653564613937396434303334643565633838636262633138313762313939363031
|
||||||
37363936313562646337343566633733633930303363366161333331366636386230663861353838
|
63366439346235313230393831646531373735316332626235636634376539333639616235636530
|
||||||
64383733396135353538383438333631323433363662393336646266356134313637623066666337
|
34376135383532623738383730303330316165613730363239326137383438323861396664366133
|
||||||
37323731396231633262363562393564663933336562386339373862653733306165353033366431
|
32663238643732383966353865393165393139323532343364323836356431396165663962363034
|
||||||
62613761623731383563366530623734376334623034386362363862653466643636623237393465
|
39356233306637613535333833383431306264353234396335383631663732383430623439333566
|
||||||
35363161663435363137666632383862646565323234306531363634383935323139656236666132
|
38346633626435343934383230373839636437666330356631633830636263393838613235346139
|
||||||
36376336643735313932373434393839373338646535363633653337386436393237663563633864
|
39326231373034646537613433376330366632346136313438306465613031313166313931363063
|
||||||
38613031313862343161346231363866346430373831313731343663383733613036663931363134
|
64633365313062666361613332303338333230386261356638343333363131383536363362366533
|
||||||
65303232633366653333623830383733303832346633393861303166613932653436343233306432
|
64333962656335623531333262646234373763623862636361333565326538316632386537343664
|
||||||
33646165613465623235666561616664396339396361306162343433376230613338393035363230
|
62353436326565396131363966323836343638326239326238366339373463333435636537353866
|
||||||
62333535393732303461656139393536626264623737316164346530366434303065663637663637
|
35643635633461343138346134323261663237333639313061353238353861626639343665303031
|
||||||
36616236373866323361333365626331356663346163643735373261633365356431653139626231
|
62316339373062313232663265333765653464326333366262653735313132386162343466373866
|
||||||
36313565663830343466623230306661633365643136363963643262396438313430316339376337
|
65333231396233373235633866393339613561303931343131356461626361663337393264663530
|
||||||
37336462353739643937376234316266633138373464623132666636373965626638633331353038
|
34376661363535313937353062373631393233316235326336376262303236356661336564396135
|
||||||
32663537623564303334306663386239386365353465646461616363353231663932633138633731
|
33633366633031663533613333373439353530616434393861323563323532363439303061663831
|
||||||
66333561396164613235656563666237373261393833646662396639326632633064616538326666
|
33383838663238346166616638326539383630616666663734306433393038363038316230356337
|
||||||
37396666353032326161353130383963663730653163326531336434616666646465623363363539
|
62373839656239343463663838313865623463323361346530663337346566366461343232356664
|
||||||
32646563326333646135623139316666616538626239666230383965613233653865396466346635
|
30346665353233353066316537313634363039313566313639396262313935663562636661353635
|
||||||
61353639643461373762396233633434323333383432363663626239303361616338663166326663
|
63636335663334386433313135396463303635363761373838653138353664613930333730643939
|
||||||
36393766663838643361363333356163613539346536623831333238646233336330396338353861
|
37386132356633383161
|
||||||
65623835313436613664366339366632616164633363616162316530393464393964613631373561
|
|
||||||
63386234663133636132663163666466653764646664363464393436303861616232386265383533
|
|
||||||
39323235333364383639646266323835633162646438316339643864386563633930306533623231
|
|
||||||
65353830306362373666643130313262373461333632626334383434633165306433343334646362
|
|
||||||
62373566336631343731663839663731343133393165646131313531313166383237343239356266
|
|
||||||
38636433643065333234623532333537383934383539656630616135326233343535663965316461
|
|
||||||
393263393263653131643737316264316234
|
|
||||||
|
|||||||
Reference in New Issue
Block a user