tgrtmp
tgrtmp is a high-performance RTMP(S) publishing client for Telegram livestreams.
Features
tgrtmp offers numerous advantages, including:
- Easy to Use: One call to go live; a worker thread does the rest
- High Performance: Demuxing, pacing, and sending run in a fast native engine
- Zero Transcoding: H.264/AAC frames pass through untouched
- Player Controls: Pause, play, mute, and a live position, VLC-style, from any thread
- Playlists: Queue files, skip, reorder, and chain episodes while live; it all plays on one connection
- Endless Channels: Looping restarts a file on the same timeline: one uninterrupted stream, forever
- DVR for Live Sources: Any growing
.read(n)handle, with an opt-in rolling window (buffer_size) that lets pause hold its point
Requirements
- Python 3.10+
- A Telegram livestream RTMP URL and stream key
- Media in H.264 + AAC (MPEG-TS, MP4, or MKV); other codecs are rejected, not transcoded
Installation
pip install --upgrade tgrtmp
tgrtmp builds from source on install, so it needs a C++ compiler and the OpenSSL development headers; the installation guide has the one command for your system.
Examples
Publish a file and hold the last frame when it ends:
import time
import tgrtmp
player = tgrtmp.publish(
"movie.mp4",
"rtmps://dc4-1.rtmp.t.me/s/",
"STREAM_KEY",
log=print,
)
# The file plays in real time; at the end the last frame is held
# so the stream stays live until you stop it.
while not player.stopped:
time.sleep(1)
Control it while it runs; every call is thread-safe:
player.pause() # viewers see a still frame; the connection stays alive
player.play()
player.mute()
player.position # seconds into the source
player.stats # one dict: bitrate, frames, loops, state
player.stop()
Turn it into a 24/7 channel:
player = tgrtmp.publish("movie.mp4", url, key, loop=True)
Queue a playlist and edit it while live:
player = tgrtmp.publish("intro.mp4", url, key, playlist=["a.mp4", "b.mp4"])
player.next() # skip the intro
player.add("c.mp4") # append to the queue
Not sure about a file? Ask before you stream:
tgrtmp.needs_transcode("clip.mkv") # True means: transcode it first
For more examples, check the examples folder.
Documentation
The full documentation (quick start, guides, and API reference) lives at tgrtmp.pages.dev.
Thanks to
-
You for viewing or using this project.
-
MadelineProto for documenting the RTMP behavior of Telegram's servers
License
MIT License
Metadata
Release files for tgrtmp 0.6.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| tgrtmp-0.6.2.tar.gz | 117.5 kB | With provenance | Details for tgrtmp-0.6.2.tar.gz |
Release files / tgrtmp-0.6.2.tar.gz
| Download URL | tgrtmp-0.6.2.tar.gz |
|---|---|
| Size | 117.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0cabd88e7f80b0b9f71c9bc99dbec3a117cfdfda17a51a21ebc9e845c54ab643
|
|
BLAKE2b-256 checksum How to use checksums |
2e903a3ef23b70082aea64caad7eae3afde65df93654c8f13913125b0627cdf5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 13, 2026.
Transparency logSecurity for tgrtmp 0.6.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
1 file in this release has been uploaded with provenance metadata.
Attestation for tgrtmp-0.6.2.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 13, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.