ehForwarderBot / efb-telegram-master

EFB Telegram Master Channel, a channel for EH Forwarder Bot.
GNU Affero General Public License v3.0
223 stars 79 forks source link

Support to TGS (Lottie/Bodymovin) Animated Stickers #63

Open blueset opened 5 years ago

blueset commented 5 years ago

Background

On 5 July 2019, Telegram released new animated stickers feature, which is using a vector based format generated using After Effect with a tailored extension.

Technical details

Through inspection of the extension and some sample files, Telegram is found to be using a subset/fork of Lottie (a.k.a. Bodymovin), which is led by Airbnb. The TGS format is a gzip-ed JSON file with a similar structure with Lottie, and an extra attribute "tgs": 1. By a simple look through, TGS is semmingly compatible with Lottie format.

Issues on supporting animated stickers

  1. Telegram Bot API

    As of when the issue is created, bot API is yet to support the new message type, this prevents ETM to send or receive any TGS animated stickers. We need to wait Telegram Bot API updates to process this kind of message.

    [Update 31 July 2019]:
    Telegram Bot API has released animated sticker support. [3]

  2. python-telegram-bot (PTB) support of new bot API

    Our upstream dependency, PTB need to update to support the latest bot API update which incorporates the new animated stickers format.

    Update: Animated sticker support has arrived in PTB.

  3. Lottie animation rendering

    Despite being able to render in a wide range of platforms (Android, iOS, Web, React Native, and Windows), we did not find a way to encode Lottie animation into a more universally accepted format (e.g. MP4 [1, 2]). This prevent us to pass on TGS animations to other IM platforms as Telegram is seemingly the only IM platform that renders Lottie animations.

blueset commented 5 years ago

Update:

mattia.basaglia/tgs has provided a Python toolkit on a wide variety of helpers to deal with TGS format, including converting TGS to GIF of MP4.

Further details including external dependencies, usability and performance will be investigated in near future.

blueset commented 5 years ago

Support to tgs format has been added to the latest version of ETM, but has been hidden behind a experimental flag due to it unstability.

TTTPOB commented 4 years ago

according to the project page, the module tgshas been moved/renamed to lottie, and yesterday the author uploaded a broken version of tgs image , dont yet know if it was intended.

blueset commented 4 years ago

according to the project page, the module tgshas been moved/renamed to lottie

Thanks for the update, I have pushed a commit (f668a8e) to address this change, it should be there in the next version.