feat: pass WAV paths as CLI args to verify_sync
This commit is contained in:
1 parent
30015d5cad
commit
eaa23604a5
2 files changed
+19
-12
No files matched your search
+16
-12
@@ -652,6 +652,8 @@ def main():
|
||||
ap.add_argument("--config", default="config.toml")
|
||||
ap.add_argument("--a", default=None, help="Video file A")
|
||||
ap.add_argument("--b", default=None, help="Video file B")
|
||||
ap.add_argument("--wav-a", default=None, help="WAV file for audio A")
|
||||
ap.add_argument("--wav-b", default=None, help="WAV file for audio B")
|
||||
ap.add_argument("--synced", default=None, help="Synced MKV output (full mode)")
|
||||
ap.add_argument("--lag", type=float, default=0.0, help="Lag in seconds")
|
||||
ap.add_argument("--mode", choices=["short", "full"], default="short",
|
||||
@@ -679,10 +681,12 @@ def main():
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
ext = cfg.get("extract", {})
|
||||
|
||||
if args.mode == "full":
|
||||
synced = args.synced
|
||||
if not synced:
|
||||
video_a = ext.get("file_a", "")
|
||||
video_a = args.a or ext.get("file_a", "")
|
||||
stem = os.path.splitext(os.path.basename(video_a))[0]
|
||||
synced = os.path.join(out_dir, f"{stem}_synced.mkv")
|
||||
if not os.path.exists(synced):
|
||||
@@ -701,8 +705,7 @@ def main():
|
||||
|
||||
# Determine which streams to extract from synced MKV
|
||||
# A's streams are first, B's delayed streams follow
|
||||
ext = cfg.get("extract", {})
|
||||
video_a = ext.get("file_a", "")
|
||||
video_a = args.a or ext.get("file_a", "")
|
||||
a_streams_in = probe_audio_streams(video_a) if os.path.exists(video_a) else []
|
||||
n_a = len(a_streams_in)
|
||||
sel_a = _state.get("audio_stream_a", 0) or 0
|
||||
@@ -745,18 +748,19 @@ def main():
|
||||
else:
|
||||
video_a = args.a or ext.get("file_a", "")
|
||||
video_b = args.b or ext.get("file_b", "")
|
||||
|
||||
out_dir_extract = ext.get("out_dir", "extracted")
|
||||
|
||||
def find_wav(video_path: str) -> str:
|
||||
if not video_path:
|
||||
return ""
|
||||
stem = os.path.splitext(os.path.basename(video_path))[0]
|
||||
cand = os.path.join(out_dir_extract, f"{stem}_audio.wav")
|
||||
return cand if os.path.exists(cand) else cand
|
||||
if args.wav_a:
|
||||
wav_a = args.wav_a
|
||||
else:
|
||||
stem_a = os.path.splitext(os.path.basename(video_a))[0]
|
||||
wav_a = os.path.join(out_dir_extract, f"{stem_a}_audio.wav")
|
||||
|
||||
wav_a = find_wav(video_a)
|
||||
wav_b = find_wav(video_b)
|
||||
if args.wav_b:
|
||||
wav_b = args.wav_b
|
||||
else:
|
||||
stem_b = os.path.splitext(os.path.basename(video_b))[0]
|
||||
wav_b = os.path.join(out_dir_extract, f"{stem_b}_audio.wav")
|
||||
|
||||
if not video_a or not os.path.exists(video_a):
|
||||
print(f"ERROR: video A not found: {video_a}", file=sys.stderr); sys.exit(1)
|
||||
|
||||
Reference in new issue
Block a user