by zhangpeihao

zhangpeihao / gortmp

Implement RTMP protocol by golang

451 Stars 147 Forks Last release: Not found MIT License 49 Commits 0 Releases

Available items

No Items, yet!

The developer of this repository has not created any items for sale yet. Need a bug fixed? Help with integration? A different license? Create a request here:

GoRTMP Build Status


RTMP protocol implementation.


  • RTMP - http://www.adobe.com/devnet/rtmp.html
  • AMF0 - http://download.macromedia.com/pub/labs/amf/amf0spec121207.pdf
  • AMF3 - http://download.macromedia.com/pub/labs/amf/amf3spec121207.pdf


  • Inbound side


// To connect FMS server
obConn, err := rtmp.Dial(url, handler, 100)

// To connect err = obConn.Connect()

// When new stream created, handler event OnStreamCreated() would been called func (handler *TestOutboundConnHandler) OnStreamCreated(stream rtmp.OutboundStream) { // To play err = stream.Play(*streamName, nil, nil, nil) // Or publish err = stream.Publish(*streamName, "live") }

// To publish data stream.PublishAudioData(data, deltaTimestamp) // or stream.PublishVideoData(data, deltaTimestamp) // or stream.PublishData(tagHeader.TagType, data, deltaTimestamp)

// You can close stream by stream.Close()

// You can close connection by obConn.Close()

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.