mirror of
https://gitlab.crans.org/nounous/ghostream.git
synced 2024-12-23 02:42:20 +00:00
Use : as more conventional separator for user:password
This commit is contained in:
parent
596beeeb89
commit
087d6eee3b
@ -45,7 +45,7 @@ As stated by OBS wiki, when streaming you should adapt the latency to `2.5 * (th
|
|||||||
As OBS uses FFMpeg, you need to have FFMpeg compiled with SRT support. To check if SR is available, run `ffmpeg -protocols | grep srt`.
|
As OBS uses FFMpeg, you need to have FFMpeg compiled with SRT support. To check if SR is available, run `ffmpeg -protocols | grep srt`.
|
||||||
On Windows and MacOS, OBS comes with his own FFMpeg that will work.
|
On Windows and MacOS, OBS comes with his own FFMpeg that will work.
|
||||||
|
|
||||||
In OBS, go to "Settings" -> "Stream" and change "Service" to "Custom..." and "Server" to `srt://127.0.0.1:9710?streamid=demo|demo`.
|
In OBS, go to "Settings" -> "Stream" and change "Service" to "Custom..." and "Server" to `srt://127.0.0.1:9710?streamid=demo:demo`.
|
||||||
|
|
||||||
### With GStreamer
|
### With GStreamer
|
||||||
|
|
||||||
@ -56,7 +56,7 @@ gst-launch-1.0 ximagesrc startx=0 show-pointer=true use-damage=0 \
|
|||||||
! videoconvert \
|
! videoconvert \
|
||||||
! x264enc bitrate=32000 tune=zerolatency speed-preset=veryfast byte-stream=true threads=1 key-int-max=15 intra-refresh=true ! video/x-h264, profile=baseline, framerate=30/1 \
|
! x264enc bitrate=32000 tune=zerolatency speed-preset=veryfast byte-stream=true threads=1 key-int-max=15 intra-refresh=true ! video/x-h264, profile=baseline, framerate=30/1 \
|
||||||
! mpegtsmux \
|
! mpegtsmux \
|
||||||
! srtserversink uri=srt://127.0.0.1:9710/ latency=1000000 streamid=demo|demo
|
! srtserversink uri=srt://127.0.0.1:9710/ latency=1000000 streamid=demo:demo
|
||||||
```
|
```
|
||||||
|
|
||||||
## References
|
## References
|
||||||
|
@ -63,7 +63,7 @@ func TestForwardStream(t *testing.T) {
|
|||||||
|
|
||||||
ffmpeg := exec.Command("ffmpeg",
|
ffmpeg := exec.Command("ffmpeg",
|
||||||
"-re", "-f", "lavfi", "-i", "testsrc=size=640x480:rate=10",
|
"-re", "-f", "lavfi", "-i", "testsrc=size=640x480:rate=10",
|
||||||
"-f", "flv", "srt://127.0.0.1:9712?streamid=demo|")
|
"-f", "flv", "srt://127.0.0.1:9712?streamid=demo:")
|
||||||
|
|
||||||
output, err := ffmpeg.StdoutPipe()
|
output, err := ffmpeg.StdoutPipe()
|
||||||
errOutput, err := ffmpeg.StderrPipe()
|
errOutput, err := ffmpeg.StderrPipe()
|
||||||
|
@ -59,6 +59,7 @@ func Serve(cfg *Options, backend auth.Backend, forwarding chan Packet) {
|
|||||||
|
|
||||||
options := make(map[string]string)
|
options := make(map[string]string)
|
||||||
options["transtype"] = "live"
|
options["transtype"] = "live"
|
||||||
|
options["mode"] = "listener"
|
||||||
|
|
||||||
// Start SRT in listen mode
|
// Start SRT in listen mode
|
||||||
log.Printf("SRT server listening on %s", cfg.ListenAddress)
|
log.Printf("SRT server listening on %s", cfg.ListenAddress)
|
||||||
@ -135,11 +136,12 @@ func authenticateSocket(s *srtgo.SrtSocket) (string, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return "", fmt.Errorf("error while fetching stream key: %s", err)
|
return "", fmt.Errorf("error while fetching stream key: %s", err)
|
||||||
}
|
}
|
||||||
if !strings.Contains(streamID, "|") {
|
log.Println(s.GetSockOptString(C.SRTO_PASSPHRASE))
|
||||||
return streamID, fmt.Errorf("warning: stream id must be at the format streamID|password. Input: %s", streamID)
|
if !strings.Contains(streamID, ":") {
|
||||||
|
return streamID, fmt.Errorf("warning: stream id must be at the format streamID:password. Input: %s", streamID)
|
||||||
}
|
}
|
||||||
|
|
||||||
splittedStreamID := strings.SplitN(streamID, "|", 2)
|
splittedStreamID := strings.SplitN(streamID, ":", 2)
|
||||||
streamName, password := splittedStreamID[0], splittedStreamID[1]
|
streamName, password := splittedStreamID[0], splittedStreamID[1]
|
||||||
loggedIn, err := authBackend.Login(streamName, password)
|
loggedIn, err := authBackend.Login(streamName, password)
|
||||||
if !loggedIn {
|
if !loggedIn {
|
||||||
|
@ -40,7 +40,7 @@ func TestServeSRT(t *testing.T) {
|
|||||||
|
|
||||||
ffmpeg := exec.Command("ffmpeg",
|
ffmpeg := exec.Command("ffmpeg",
|
||||||
"-i", "http://ftp.crans.org/events/Blender%20OpenMovies/big_buck_bunny_480p_stereo.ogg",
|
"-i", "http://ftp.crans.org/events/Blender%20OpenMovies/big_buck_bunny_480p_stereo.ogg",
|
||||||
"-f", "flv", "srt://127.0.0.1:9711?streamid=demo|")
|
"-f", "flv", "srt://127.0.0.1:9711?streamid=demo:")
|
||||||
|
|
||||||
output, err := ffmpeg.StdoutPipe()
|
output, err := ffmpeg.StdoutPipe()
|
||||||
errOutput, err := ffmpeg.StderrPipe()
|
errOutput, err := ffmpeg.StderrPipe()
|
||||||
|
Loading…
Reference in New Issue
Block a user