"I've been googling for some time now, and still have yet to find a working example of Python multicast"
Behold gumd.
Grande Unicast M ulticast D aemon
Latest is v.0.0.17
- Install
python3 -mpip install gumd
Use gumd (Daemon) programmatically
>>>> from gumd import GumD
>>>> gumd =GumD('235.35.3.5:3535',ttl=1)
>>>> gumd.send_stream("/home/a/stuff")
stream uri: udp://@235.35.3.5:3535
>>>>
Use gumc (Client) programmatically
>>>> from gumc import GumC
>>>> gumc = GumC("udp://@235.35.3.5:3535")
>>>> data = gumc.read(8)
>>>> data
b'Helloooo'
Cli tools
- The cli tools gumd and gumc try to install to ~/.local/bin
- make sure ~/.local/bin is in your path I have this at the end my .bashrc
PLAN9=/home/a/plan9port export PLAN9
PATH=/home/a/.local/bin:$PLAN9:$PATH export PATH
if you dont get them installed, roll your own.
- gumd (Daemon)
#!/usr/bin/env python3
from gumd import cli
cli()
- gumc (Client)
#!/usr/bin/env python3
from gumc import cli
cli()
Install cli tools
install gumd /usr/local/bin # or ~/.local/bin
install gumc /usr/local/bin # or ~/.local/bin
Use gumd (Daemon) cli
-
Supported input mpegts URIs:
-
files
gumd -i /home/me/vid.ts -
http(s)
gumd -i https://futzu.com/xaa.ts -
udp
gumd -i udp://127.0.0.1:4000 -
multicast
gumd -i udp://@235.1.2.3:4567 -
reading from stdin
cat myvideo.ts | gumd
-
usage: gumd [-h] [-i INPUT] [-a ADDR] [-u] [-b BIND_ADDR] [-t TTL] [-v]
optional arguments:
-h, --help show this help message and exit
-i INPUT, --input INPUT
like "/home/a/vid.ts" or "udp://@235.35.3.5:3535" or "https://futzu.com/xaa.ts"
-a ADDR, --addr ADDR Destination Address:Port like "227.1.3.10:4310"
-u, --unicast Use Unicast instead of Multicast
-b BIND_ADDR, --bind_addr BIND_ADDR
Local IP and Port to bind to like "192.168.1.34:5555". Default is "0.0.0.0:1025"
-t TTL, --ttl TTL Multicast TTL 1 - 255
-v, --version Show version
start gumd (Daemon) cli
a@debian:~/gumd$ gumd -i /home/a/abc.py
stream uri: udp://@235.35.3.5:3535
a@debian:~/gumd$
use gumc (Client) cli
usage: gumc [-h] [-i INSTUFF] [-b BYTESIZE] [-v]
options:
-h, --help show this help message and exit
-i INSTUFF, --instuff INSTUFF
default is 'udp://@235.35.3.5:3535'
-b BYTESIZE, --bytesize BYTESIZE
Number of bytes to read. default is 1
-v, --version Show version
start gumc (Client) cli
a@debian:~/build/clean/gumd$ gumc -i udp://@235.35.3.5:3535 -b 1024
Test gumd and gumc together
- first terminal, start the client, gumc
a@debian:~/build/clean/gumd$ pypy3 gumc.py -b 5 -i udp://@235.35.3.5:3535
- second terminal,start the daemon, gumd__ and send a "hello"
a@debian:~/build/clean/gumd$ printf 'hello' | gumd -a 235.35.3.5:3535
stream uri: udp://@235.35.3.5:3535
play gumd (Daemon) stream with ffplay
ffplay udp://@235.35.3.5:3535
segment stream from gumd (Daemon) into hls with x9k3
pypy3 x9k3.py -i udp://@235.35.3.5:3535
read 13 bytes from a multicast stream with gumc (Client)
gumc -i udp://@235.35.3.5:3535 -b 13
read 10000 bytes from a multicast stream with gumc (Client)
gumc -i udp://@235.35.3.5:3535 -b 10000
Note: a multicast client works a little differently than most people expect.
You must specify a size to read or the client will never return.
.
Phase One: Expose the Pep Deep State
* [Phase One has begun](https://github.com/python/peps/compare/main...futzu:peps:main)Metadata
Release files for gumd 0.0.21
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 |
|---|---|---|---|---|
| gumd-0.0.21.tar.gz | 4.9 kB | Without provenance | Details for gumd-0.0.21.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| gumd-0.0.21-py3-none-any.whl | Python 3 | none | any | Details for gumd-0.0.21-py3-none-any.whl |
Total release size: 10.9 kB
Release files / gumd-0.0.21.tar.gz
| Download URL | gumd-0.0.21.tar.gz |
|---|---|
| Size | 4.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f365faa712f88a28140a9454822f5630f47dd954f9e257b1521c62a9e9fe24a2
|
|
BLAKE2b-256 checksum How to use checksums |
df1e81907f80da8c6463c02abae9f05394be9a7bbad269e15892740d2ed7026b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.1
|
Release files / gumd-0.0.21-py3-none-any.whl
| Download URL | gumd-0.0.21-py3-none-any.whl |
|---|---|
| Size | 5.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a01db0a1fc3a2e1a2f6107ca47d5338fe1b0b406dadbc13d14fac6450239c88f
|
|
BLAKE2b-256 checksum How to use checksums |
8399f8fd8ad59a49ef27aa25324f7f318309efe3a3f2784eb684aa3bd56b37a7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.1
|
Security for gumd 0.0.21
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A 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.