kaledonya clips: a Discord-friendly clip site on top of Zipline
Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
commit
e6f8905377
34 files changed
+2917
No files matched your search
@@ -0,0 +1,19 @@
|
||||
"""Stream-copy an .mkv into an .mp4 so Discord can play it inline (no re-encode)."""
|
||||
import subprocess
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
def remux_to_mp4(src: Path, dst: Path, timeout: int = 1800) -> bool:
|
||||
cmd = [
|
||||
"ffmpeg", "-v", "error", "-y", "-i", str(src),
|
||||
"-map", "0:v", "-map", "0:a?", "-c", "copy",
|
||||
"-movflags", "+faststart", str(dst),
|
||||
]
|
||||
try:
|
||||
result = subprocess.run(cmd, capture_output=True, timeout=timeout)
|
||||
ok = result.returncode == 0 and dst.exists() and dst.stat().st_size > 0
|
||||
except (OSError, subprocess.TimeoutExpired):
|
||||
ok = False
|
||||
if not ok:
|
||||
dst.unlink(missing_ok=True)
|
||||
return ok
|
||||
Reference in new issue
Block a user