Skip to content

eqld/bsm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Byte Stream Multicast

The service allows one to broadcast arbitrary stream of bytes to several clients over TCP.

Parameters:

  • -buffer-frame-size - size of buffer frame in bytes (default 1048576)
  • -buffer-frames - amount of buffer frames (default 1024)
  • -listen-input - protocol ('tcp', 'tcp4', 'tcp6', 'unix' or 'unixpacket') and address to listen for input stream suppliers (default "unix:///tmp/bsm.sock")
  • -listen-output - protocol ('tcp', 'tcp4', 'tcp6', 'unix' or 'unixpacket') and address to listen for output stream consumers (default "tcp://0.0.0.0:4096")

Usage example:

Stream a video from MacBook's built-in camera to external network clients over TCP.

  1. Run the service on your MacBook:
go run . -listen-input tcp://127.0.0.1:1024 -listen-output tcp://0.0.0.0:4096
  1. In another terminal run ffmpeg to capture a video from the camera and send it to the supplier's TCP socket of the service:
ffmpeg -f avfoundation -r 30 -i "default" -v 0 -vcodec mpeg4 -f mpegts - | netcat 127.0.0.1 1024

Note: Frame rate -r parameter may vary depending from the model of your camera.

  1. On one or more other computers in your local network or Internet start to read the data from the consumer's TCP socket of the service and pass it to ffplay:
netcat <ip_address_of_the_service> 4096 | ffplay -

Note: Significant latency between video capture and video playback is caused by the buffer of ffplay itself, not by the buffer of the service. To verify that, pass the output of the ffmpeg right away to the ffplay bypassing the service and watch the result:

ffmpeg -f avfoundation -r 30 -i "default" -v 0 -vcodec mpeg4 -f mpegts - | ffplay -

About

Byte stream multicast.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages