mirror of
https://github.com/9001/copyparty.git
synced 2026-06-18 20:22:27 -06:00
audioplayer: opus: enforce 1ch or 2ch; downmix 3+
This commit is contained in:
parent
3a9ff67ab0
commit
b31f29024a
|
|
@ -216,6 +216,7 @@ def au_unpk(
|
||||||
def ffprobe(
|
def ffprobe(
|
||||||
abspath: str, timeout: int = 60
|
abspath: str, timeout: int = 60
|
||||||
) -> tuple[dict[str, tuple[int, Any]], dict[str, list[Any]], list[Any], dict[str, Any]]:
|
) -> tuple[dict[str, tuple[int, Any]], dict[str, list[Any]], list[Any], dict[str, Any]]:
|
||||||
|
# ffprobe -hide_banner -show_streams -show_format --
|
||||||
cmd = [
|
cmd = [
|
||||||
b"ffprobe",
|
b"ffprobe",
|
||||||
b"-hide_banner",
|
b"-hide_banner",
|
||||||
|
|
|
||||||
|
|
@ -1219,6 +1219,13 @@ class ThumbSrv(object):
|
||||||
self.log("conv2 %s [%s]" % (container, enc), 6)
|
self.log("conv2 %s [%s]" % (container, enc), 6)
|
||||||
benc = enc.encode("ascii").split(b" ")
|
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
|
# fmt: off
|
||||||
cmd = [
|
cmd = [
|
||||||
b"ffmpeg",
|
b"ffmpeg",
|
||||||
|
|
@ -1228,6 +1235,7 @@ class ThumbSrv(object):
|
||||||
b"-i", fsenc(abspath),
|
b"-i", fsenc(abspath),
|
||||||
] + tagset + [
|
] + tagset + [
|
||||||
b"-map", b"0:a:0",
|
b"-map", b"0:a:0",
|
||||||
|
b"-ac", ac,
|
||||||
] + benc + [
|
] + benc + [
|
||||||
b"-f", container,
|
b"-f", container,
|
||||||
fsenc(tpath)
|
fsenc(tpath)
|
||||||
|
|
@ -1268,6 +1276,7 @@ class ThumbSrv(object):
|
||||||
b"-i", fsenc(abspath),
|
b"-i", fsenc(abspath),
|
||||||
b"-map_metadata", b"-1",
|
b"-map_metadata", b"-1",
|
||||||
b"-map", b"0:a:0",
|
b"-map", b"0:a:0",
|
||||||
|
b"-ac", b"2",
|
||||||
] + benc + [
|
] + benc + [
|
||||||
b"-f", b"opus",
|
b"-f", b"opus",
|
||||||
fsenc(tmp_opus)
|
fsenc(tmp_opus)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue