Skip to content

Instantly share code, notes, and snippets.

@xacnio
Last active March 27, 2025 06:44
Show Gist options
  • Save xacnio/902a750d0858dd8dd468c3cd73166dc4 to your computer and use it in GitHub Desktop.
Save xacnio/902a750d0858dd8dd468c3cd73166dc4 to your computer and use it in GitHub Desktop.
Telegram - Create Video Sticker (.WEBM) with FFMPEG

Command

ffmpeg -y -i animated_sticker.mov -r 30 -t 2.99 -an -c:v libvpx-vp9 -pix_fmt yuva420p -s 512x512 -b:v 400K output.webm
  • If .webm file size greater than 256 KB, you should reduce "-b:v 400K"
  • .mov video file may has alpha channel but not required.
  • My video sticker pack for example: https://t.me/addstickers/msn_animations

Telegram Sticker Command

  • Go to @Stickers and type "/newvideo"
  • Type a name for sticker pack.
  • Send your .webm file, then type any emoji.
  • Follow bot's directions.
@andreyorst
Copy link

If the video has non 1:1 aspect ratio this command will make the resulting video stretched. Here's a fix:

ffmpeg -y -i animated_sticker.mov -r 30 -t 2.99 -an -c:v libvpx-vp9 -pix_fmt yuva420p -vf 'scale=512:512:force_original_aspect_ratio=decrease' -b:v 400K output.webm

@xacnio
Copy link
Author

xacnio commented Jun 28, 2022

If the video has non 1:1 aspect ratio this command will make the resulting video stretched. Here's a fix:

ffmpeg -y -i animated_sticker.mov -r 30 -t 2.99 -an -c:v libvpx-vp9 -pix_fmt yuva420p -vf 'scale=512:512:force_original_aspect_ratio=decrease' -b:v 400K output.webm

@andreyorst Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment