Update tgs_converter to match updated lottieconverter (#694)

This commit is contained in:
SOT-TECH
2021-11-16 02:07:13 +03:00
committed by GitHub
parent 2cc439853f
commit b4d4f84161
2 changed files with 4 additions and 5 deletions
+2 -3
View File
@@ -223,7 +223,7 @@ bridge:
# Format to which animated stickers should be converted.
# disable - No conversion, send as-is (gzipped lottie)
# png - converts to non-animated png (fastest),
# gif - converts to animated gif, but loses transparency
# gif - converts to animated gif
# webm - converts to webm video, requires ffmpeg executable with vp9 codec and webm container support
target: gif
# Arguments for converter. All converters take width and height.
@@ -231,8 +231,7 @@ bridge:
args:
width: 256
height: 256
background: "020202" # only for gif
fps: 30 # only for webm
fps: 25 # only for webm and gif (2, 5, 10, 20, 25 and 50 recommended)
# End-to-bridge encryption support options. These require matrix-nio to be installed with pip
# and login_shared_secret to be configured in order to get a device for the bridge bot.
#
+2 -2
View File
@@ -64,10 +64,10 @@ if lottieconverter:
return ConvertedSticker("application/gzip", file)
async def tgs_to_gif(file: bytes, width: int, height: int, background: str = "202020",
async def tgs_to_gif(file: bytes, width: int, height: int, fps: int = 25,
**_: Any) -> ConvertedSticker:
proc = await asyncio.create_subprocess_exec(lottieconverter, "-", "-", "gif",
f"{width}x{height}", f"0x{background}",
f"{width}x{height}", str(fps),
stdout=asyncio.subprocess.PIPE,
stdin=asyncio.subprocess.PIPE)
stdout, stderr = await proc.communicate(file)