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

27 lines
652 B
Go

3 years ago
package main
import (
"gitlab.com/ics_cinnamon/joy4/av/avutil"
"gitlab.com/ics_cinnamon/joy4/av/pktque"
"gitlab.com/ics_cinnamon/joy4/format"
"gitlab.com/ics_cinnamon/joy4/format/rtmp"
3 years ago
)
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()
}