audioplayer: opus: enforce 1ch or 2ch; downmix 3+

This commit is contained in:
ed 2026-04-20 20:39:14 +02:00
parent 3a9ff67ab0
commit b31f29024a
2 changed files with 10 additions and 0 deletions

View file

@ -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",

View file

@ -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)