Написал программу для конвертации .tgs файла в webm, но видео всегда получается на черном фоне, как я понимаю при чтении файла надо что-то добавлять в layers в tgs файле, но не уверен, использую библиотеку lottie.
import os
import cv2
import logging
from lottie.parsers.tgs import parse_tgs,parse_tgs_json
from lottie.exporters.video import export_video
from PIL import Image
from lottie.objects import Animation
def convert_tgs_to_webm(tgs_file, gif_file):
try:
animation = parse_tgs_json(tgs_file)
animation = Animation.load(animation)
export_video(animation, gif_file,'webm')
return True
except Exception:
logging.exception("Error occurred while converting TGS to GIF.")
return False