Update tgs_converter to match updated lottieconverter (#694)
This commit is contained in:
@@ -223,7 +223,7 @@ bridge:
|
|||||||
# Format to which animated stickers should be converted.
|
# Format to which animated stickers should be converted.
|
||||||
# disable - No conversion, send as-is (gzipped lottie)
|
# disable - No conversion, send as-is (gzipped lottie)
|
||||||
# png - converts to non-animated png (fastest),
|
# 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
|
# webm - converts to webm video, requires ffmpeg executable with vp9 codec and webm container support
|
||||||
target: gif
|
target: gif
|
||||||
# Arguments for converter. All converters take width and height.
|
# Arguments for converter. All converters take width and height.
|
||||||
@@ -231,8 +231,7 @@ bridge:
|
|||||||
args:
|
args:
|
||||||
width: 256
|
width: 256
|
||||||
height: 256
|
height: 256
|
||||||
background: "020202" # only for gif
|
fps: 25 # only for webm and gif (2, 5, 10, 20, 25 and 50 recommended)
|
||||||
fps: 30 # only for webm
|
|
||||||
# End-to-bridge encryption support options. These require matrix-nio to be installed with pip
|
# 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.
|
# and login_shared_secret to be configured in order to get a device for the bridge bot.
|
||||||
#
|
#
|
||||||
|
|||||||
@@ -64,10 +64,10 @@ if lottieconverter:
|
|||||||
return ConvertedSticker("application/gzip", file)
|
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:
|
**_: Any) -> ConvertedSticker:
|
||||||
proc = await asyncio.create_subprocess_exec(lottieconverter, "-", "-", "gif",
|
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,
|
stdout=asyncio.subprocess.PIPE,
|
||||||
stdin=asyncio.subprocess.PIPE)
|
stdin=asyncio.subprocess.PIPE)
|
||||||
stdout, stderr = await proc.communicate(file)
|
stdout, stderr = await proc.communicate(file)
|
||||||
|
|||||||
Reference in New Issue
Block a user