diff --git a/Makefile b/Makefile index b6020716..3cc30338 100644 --- a/Makefile +++ b/Makefile @@ -80,10 +80,10 @@ define CONFIG_RUN paths: all: -# runOnPublish: ffmpeg -i rtsp://localhost:8554/$$RTSP_SERVER_PATH -c copy -f mpegts myfile_$$RTSP_SERVER_PATH.ts +# runOnPublish: ffmpeg -i rtsp://localhost:8554/$$RTSP_PATH -c copy -f mpegts myfile_$$RTSP_PATH.ts # readUser: test # readPass: tast -# runOnDemand: ffmpeg -re -stream_loop -1 -i testimages/ffmpeg/emptyvideo.ts -c copy -f rtsp rtsp://localhost:8554/$$RTSP_SERVER_PATH +# runOnDemand: ffmpeg -re -stream_loop -1 -i testimages/ffmpeg/emptyvideo.ts -c copy -f rtsp rtsp://localhost:8554/$$RTSP_PATH # proxied: # source: rtsp://192.168.2.198:8554/stream diff --git a/README.md b/README.md index ec10ea74..e2c4faee 100644 --- a/README.md +++ b/README.md @@ -108,7 +108,7 @@ Edit `rtsp-simple-server.yml` and replace everything inside section `paths` with ```yaml paths: cam: - runOnInit: ffmpeg -f v4l2 -i /dev/video0 -f rtsp rtsp://localhost:8554/$RTSP_SERVER_PATH + runOnInit: ffmpeg -f v4l2 -i /dev/video0 -f rtsp rtsp://localhost:8554/$RTSP_PATH runOnInitRestart: yes ``` @@ -128,7 +128,7 @@ Then edit `rtsp-simple-server.yml` and replace everything inside section `paths` ```yaml paths: cam: - runOnInit: gst-launch-1.0 rpicamsrc preview=false bitrate=2000000 keyframe-interval=50 ! video/x-h264,width=1920,height=1080,framerate=25/1 ! rtspclientsink location=rtsp://localhost:8554/$RTSP_SERVER_PATH + runOnInit: gst-launch-1.0 rpicamsrc preview=false bitrate=2000000 keyframe-interval=50 ! video/x-h264,width=1920,height=1080,framerate=25/1 ! rtspclientsink location=rtsp://localhost:8554/$RTSP_PATH runOnInitRestart: yes ``` @@ -140,7 +140,7 @@ Edit `rtsp-simple-server.yml` and replace everything inside section `paths` with ```yaml paths: ondemand: - runOnDemand: ffmpeg -re -stream_loop -1 -i file.ts -c copy -f rtsp rtsp://localhost:8554/$RTSP_SERVER_PATH + runOnDemand: ffmpeg -re -stream_loop -1 -i file.ts -c copy -f rtsp rtsp://localhost:8554/$RTSP_PATH runOnDemandRestart: yes ``` @@ -153,7 +153,7 @@ To change the format, codec or compression of a stream, you can use _FFmpeg_ or paths: all: original: - runOnPublish: ffmpeg -i rtsp://localhost:8554/$RTSP_SERVER_PATH -b:a 64k -c:v libx264 -preset ultrafast -b:v 500k -max_muxing_queue_size 1024 -f rtsp rtsp://localhost:8554/compressed + runOnPublish: ffmpeg -i rtsp://localhost:8554/$RTSP_PATH -b:a 64k -c:v libx264 -preset ultrafast -b:v 500k -max_muxing_queue_size 1024 -f rtsp rtsp://localhost:8554/compressed runOnPublishRestart: yes ``` diff --git a/externalcmd/externalcmd.go b/externalcmd/externalcmd.go index 558809d4..6659f999 100644 --- a/externalcmd/externalcmd.go +++ b/externalcmd/externalcmd.go @@ -79,7 +79,7 @@ func (e *ExternalCmd) runInner() bool { // on Windows the shell is not used and command is started directly // variables are replaced manually in order to guarantee compatibility // with Linux commands - args := strings.Fields(strings.ReplaceAll(e.cmdstr, "$RTSP_SERVER_PATH", e.pathName)) + args := strings.Fields(strings.ReplaceAll(e.cmdstr, "$RTSP_PATH", e.pathName)) cmd = exec.Command(args[0], args[1:]...) } else { @@ -88,7 +88,7 @@ func (e *ExternalCmd) runInner() bool { // variables are inserted into the environment cmd.Env = append(os.Environ(), - "RTSP_SERVER_PATH="+e.pathName, + "RTSP_PATH="+e.pathName, ) cmd.Stdout = os.Stdout diff --git a/main_test.go b/main_test.go index cffad20c..8ac95664 100644 --- a/main_test.go +++ b/main_test.go @@ -692,7 +692,7 @@ func TestRedirect(t *testing.T) { func TestRunOnDemand(t *testing.T) { p1, err := testProgram("paths:\n" + " all:\n" + - " runOnDemand: ffmpeg -hide_banner -loglevel error -re -i testimages/ffmpeg/emptyvideo.ts -c copy -f rtsp rtsp://localhost:8554/$RTSP_SERVER_PATH\n") + " runOnDemand: ffmpeg -hide_banner -loglevel error -re -i testimages/ffmpeg/emptyvideo.ts -c copy -f rtsp rtsp://localhost:8554/$RTSP_PATH\n") require.NoError(t, err) defer p1.close() @@ -716,7 +716,7 @@ func TestHotReloading(t *testing.T) { err := ioutil.WriteFile(confPath, []byte("paths:\n"+ " test1:\n"+ - " runOnDemand: ffmpeg -hide_banner -loglevel error -re -i testimages/ffmpeg/emptyvideo.ts -c copy -f rtsp rtsp://localhost:8554/$RTSP_SERVER_PATH\n"), + " runOnDemand: ffmpeg -hide_banner -loglevel error -re -i testimages/ffmpeg/emptyvideo.ts -c copy -f rtsp rtsp://localhost:8554/$RTSP_PATH\n"), 0644) require.NoError(t, err) @@ -742,7 +742,7 @@ func TestHotReloading(t *testing.T) { err = ioutil.WriteFile(confPath, []byte("paths:\n"+ " test2:\n"+ - " runOnDemand: ffmpeg -hide_banner -loglevel error -re -i testimages/ffmpeg/emptyvideo.ts -c copy -f rtsp rtsp://localhost:8554/$RTSP_SERVER_PATH\n"), + " runOnDemand: ffmpeg -hide_banner -loglevel error -re -i testimages/ffmpeg/emptyvideo.ts -c copy -f rtsp rtsp://localhost:8554/$RTSP_PATH\n"), 0644) require.NoError(t, err) diff --git a/rtsp-simple-server.yml b/rtsp-simple-server.yml index 5e1b45f3..3acb7b21 100644 --- a/rtsp-simple-server.yml +++ b/rtsp-simple-server.yml @@ -82,7 +82,7 @@ paths: # command to run when this path is initialized. # this can be used to publish a stream and keep it always opened. # this is terminated with SIGINT when the program closes. - # the path name is available in the RTSP_SERVER_PATH variable. + # the path name is available in the RTSP_PATH variable. # the restart parameter allows to restart the command if it exits suddenly. runOnInit: runOnInitRestart: no @@ -90,7 +90,7 @@ paths: # command to run when this path is requested. # this can be used to publish a stream on demand. # this is terminated with SIGINT when the path is not requested anymore. - # the path name is available in the RTSP_SERVER_PATH variable. + # the path name is available in the RTSP_PATH variable. # the restart parameter allows to restart the command if it exits suddenly. runOnDemand: runOnDemandRestart: no @@ -103,14 +103,14 @@ paths: # command to run when a client starts publishing. # this is terminated with SIGINT when a client stops publishing. - # the path name is available in the RTSP_SERVER_PATH variable. + # the path name is available in the RTSP_PATH variable. # the restart parameter allows to restart the command if it exits suddenly. runOnPublish: runOnPublishRestart: no # command to run when a clients starts reading. # this is terminated with SIGINT when a client stops reading. - # the path name is available in the RTSP_SERVER_PATH variable. + # the path name is available in the RTSP_PATH variable. # the restart parameter allows to restart the command if it exits suddenly. runOnRead: runOnReadRestart: no