From b31f29024a55d06c1bf26273e41fddb2c3b87457 Mon Sep 17 00:00:00 2001 From: ed Date: Mon, 20 Apr 2026 20:39:14 +0200 Subject: [PATCH] audioplayer: opus: enforce 1ch or 2ch; downmix 3+ --- copyparty/mtag.py | 1 + copyparty/th_srv.py | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/copyparty/mtag.py b/copyparty/mtag.py index 1d4df60e..38caeb21 100644 --- a/copyparty/mtag.py +++ b/copyparty/mtag.py @@ -216,6 +216,7 @@ def au_unpk( def ffprobe( abspath: str, timeout: int = 60 ) -> tuple[dict[str, tuple[int, Any]], dict[str, list[Any]], list[Any], dict[str, Any]]: + # ffprobe -hide_banner -show_streams -show_format -- cmd = [ b"ffprobe", b"-hide_banner", diff --git a/copyparty/th_srv.py b/copyparty/th_srv.py index 93ce8c22..eb039e3f 100644 --- a/copyparty/th_srv.py +++ b/copyparty/th_srv.py @@ -1219,6 +1219,13 @@ class ThumbSrv(object): self.log("conv2 %s [%s]" % (container, enc), 6) benc = enc.encode("ascii").split(b" ") + ac = b"2" + try: + if tags["chs"][1] in ("mono", "1", "1.0"): + ac = b"1" + except: + pass + # fmt: off cmd = [ b"ffmpeg", @@ -1228,6 +1235,7 @@ class ThumbSrv(object): b"-i", fsenc(abspath), ] + tagset + [ b"-map", b"0:a:0", + b"-ac", ac, ] + benc + [ b"-f", container, fsenc(tpath) @@ -1268,6 +1276,7 @@ class ThumbSrv(object): b"-i", fsenc(abspath), b"-map_metadata", b"-1", b"-map", b"0:a:0", + b"-ac", b"2", ] + benc + [ b"-f", b"opus", fsenc(tmp_opus)