You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
joy4/examples/rtmp_publish/main.go

28 lines
637 B
Go

package main
import (
"github.com/Danile71/joy4/av/pktque"
"github.com/Danile71/joy4/format"
"github.com/Danile71/joy4/av/avutil"
"github.com/Danile71/joy4/format/rtmp"
)
func init() {
format.RegisterAll()
}
// as same as: ffmpeg -re -i projectindex.flv -c copy -f flv rtmp://localhost:1936/app/publish
func main() {
file, _ := avutil.Open("projectindex.flv")
conn, _ := rtmp.Dial("rtmp://localhost:1936/app/publish")
// conn, _ := avutil.Create("rtmp://localhost:1936/app/publish")
demuxer := &pktque.FilterDemuxer{Demuxer: file, Filter: &pktque.Walltime{}}
avutil.CopyFile(conn, demuxer)
file.Close()
conn.Close()
}