Welcome to pytgvoip

pypi libwheels-win libtgvoip-win license

Telegram VoIP Library for Python

Community

PytgVoIP is a Telegram VoIP library written in Python and C++.

It uses libtgvoip (a library used in official clients) for voice encoding and transmission, and pybind11 for simple generation of Python extension written in C++.

Features

  • Making and receiving Telegram calls
  • Python callbacks for sending and receiving audio stream frames allow flexible control
  • Pre-built Windows wheels in PyPI

Requirements

  • Python 3.4 or higher
  • An MTProto client (i.e. Pyrogram, Telethon)

Installing

Refer the corresponding section: Installation

Encoding audio streams

Streams consumed by libtgvoip should be encoded in 16-bit signed PCM audio.

$ ffmpeg -i input.mp3 -f s16le -ac 1 -ar 48000 -acodec pcm_s16le input.raw  # encode
$ ffmpeg -f s16le -ac 1 -ar 48000 -acodec pcm_s16le -i output.raw output.mp3  # decode