add client-play-format-h264-mpeg4audio-save-to-disk example (#230) (#582)

This commit is contained in:
Alessandro Ros
2024-06-21 23:01:46 +02:00
committed by GitHub
parent 13d994d77a
commit 3ee5fbdcf7
11 changed files with 299 additions and 19 deletions

View File

@@ -13,7 +13,7 @@ import (
// This example shows how to
// 1. connect to a RTSP server
// 2. check if there's a Opus format
// 3. save the content of the format into a file in MPEG-TS format
// 3. save the content of the format in a file in MPEG-TS format
func main() {
c := gortsplib.Client{}
@@ -55,19 +55,15 @@ func main() {
fileName: "mystream.ts",
track: &mpegts.Track{
Codec: &mpegts.CodecOpus{
ChannelCount: func() int {
if forma.IsStereo {
return 2
}
return 1
}(),
ChannelCount: forma.ChannelCount,
},
},
}
mpegtsMuxer.initialize()
err = mpegtsMuxer.initialize()
if err != nil {
panic(err)
}
defer mpegtsMuxer.close()
// setup a single media
_, err = c.Setup(desc.BaseURL, medi, 0, 0)