Browse Source

rename conf.yml into rtsp-simple-server.yml

pull/31/head v0.9.0
aler9 5 years ago
parent
commit
3451060548
  1. 14
      Makefile
  2. 14
      README.md
  3. 4
      conf.go
  4. 2
      main.go
  5. 0
      rtsp-simple-server.yml

14
Makefile

@ -113,25 +113,25 @@ release-nodocker:
$(eval GOBUILD := go build -ldflags '-X main.Version=$(VERSION)') $(eval GOBUILD := go build -ldflags '-X main.Version=$(VERSION)')
rm -rf tmp && mkdir tmp rm -rf tmp && mkdir tmp
rm -rf release && mkdir release rm -rf release && mkdir release
cp conf.yml tmp/ cp rtsp-simple-server.yml tmp/
GOOS=windows GOARCH=amd64 $(GOBUILD) -o tmp/rtsp-simple-server.exe GOOS=windows GOARCH=amd64 $(GOBUILD) -o tmp/rtsp-simple-server.exe
cd tmp && zip -q $(PWD)/release/rtsp-simple-server_$(VERSION)_windows_amd64.zip rtsp-simple-server.exe conf.yml cd tmp && zip -q $(PWD)/release/rtsp-simple-server_$(VERSION)_windows_amd64.zip rtsp-simple-server.exe rtsp-simple-server.yml
GOOS=linux GOARCH=amd64 $(GOBUILD) -o tmp/rtsp-simple-server GOOS=linux GOARCH=amd64 $(GOBUILD) -o tmp/rtsp-simple-server
tar -C tmp -czf $(PWD)/release/rtsp-simple-server_$(VERSION)_linux_amd64.tar.gz --owner=0 --group=0 rtsp-simple-server conf.yml tar -C tmp -czf $(PWD)/release/rtsp-simple-server_$(VERSION)_linux_amd64.tar.gz --owner=0 --group=0 rtsp-simple-server rtsp-simple-server.yml
GOOS=linux GOARCH=arm GOARM=6 $(GOBUILD) -o tmp/rtsp-simple-server GOOS=linux GOARCH=arm GOARM=6 $(GOBUILD) -o tmp/rtsp-simple-server
tar -C tmp -czf $(PWD)/release/rtsp-simple-server_$(VERSION)_linux_arm6.tar.gz --owner=0 --group=0 rtsp-simple-server conf.yml tar -C tmp -czf $(PWD)/release/rtsp-simple-server_$(VERSION)_linux_arm6.tar.gz --owner=0 --group=0 rtsp-simple-server rtsp-simple-server.yml
GOOS=linux GOARCH=arm GOARM=7 $(GOBUILD) -o tmp/rtsp-simple-server GOOS=linux GOARCH=arm GOARM=7 $(GOBUILD) -o tmp/rtsp-simple-server
tar -C tmp -czf $(PWD)/release/rtsp-simple-server_$(VERSION)_linux_arm7.tar.gz --owner=0 --group=0 rtsp-simple-server conf.yml tar -C tmp -czf $(PWD)/release/rtsp-simple-server_$(VERSION)_linux_arm7.tar.gz --owner=0 --group=0 rtsp-simple-server rtsp-simple-server.yml
GOOS=linux GOARCH=arm64 $(GOBUILD) -o tmp/rtsp-simple-server GOOS=linux GOARCH=arm64 $(GOBUILD) -o tmp/rtsp-simple-server
tar -C tmp -czf $(PWD)/release/rtsp-simple-server_$(VERSION)_linux_arm64.tar.gz --owner=0 --group=0 rtsp-simple-server conf.yml tar -C tmp -czf $(PWD)/release/rtsp-simple-server_$(VERSION)_linux_arm64.tar.gz --owner=0 --group=0 rtsp-simple-server rtsp-simple-server.yml
GOOS=darwin GOARCH=amd64 $(GOBUILD) -o tmp/rtsp-simple-server GOOS=darwin GOARCH=amd64 $(GOBUILD) -o tmp/rtsp-simple-server
tar -C tmp -czf $(PWD)/release/rtsp-simple-server_$(VERSION)_darwin_amd64.tar.gz --owner=0 --group=0 rtsp-simple-server conf.yml tar -C tmp -czf $(PWD)/release/rtsp-simple-server_$(VERSION)_darwin_amd64.tar.gz --owner=0 --group=0 rtsp-simple-server rtsp-simple-server.yml
define DOCKERFILE_IMAGE define DOCKERFILE_IMAGE
FROM --platform=linux/amd64 $(BASE_IMAGE) AS build FROM --platform=linux/amd64 $(BASE_IMAGE) AS build

14
README.md

@ -54,19 +54,19 @@ Download and launch the image:
docker run --rm -it --network=host aler9/rtsp-simple-server docker run --rm -it --network=host aler9/rtsp-simple-server
``` ```
The `--network=host` argument is mandatory since Docker can change the source port of UDP packets for routing reasons, and this makes RTSP routing impossible. An alternative consists in disabling UDP and exposing the RTSP port, by creating a configuration file named `conf.yml` with the following content: The `--network=host` argument is mandatory since Docker can change the source port of UDP packets for routing reasons, and this makes RTSP routing impossible. An alternative consists in disabling UDP and exposing the RTSP port, by creating a file named `rtsp-simple-server.yml` with the following content:
```yaml ```yaml
protocols: [tcp] protocols: [tcp]
``` ```
and passing it to the container: and passing it to the container:
``` ```
docker run --rm -it -v $PWD/conf.yml:/conf.yml -p 8554:8554 aler9/rtsp-simple-server docker run --rm -it -v $PWD/rtsp-simple-server.yml:/rtsp-simple-server.yml -p 8554:8554 aler9/rtsp-simple-server
``` ```
#### Full configuration file #### Full configuration file
To change the configuration, it's enough to edit the `conf.yml` file, provided with the executable. The default configuration is [available here](conf.yml). To change the configuration, it's enough to edit the `rtsp-simple-server.yml` file, provided with the executable. The default configuration is [available here](rtsp-simple-server.yml).
#### Usage as RTSP Proxy #### Usage as RTSP Proxy
@ -74,7 +74,7 @@ An RTSP proxy is usually deployed in one of these scenarios:
* when there are multiple users that are receiving a stream and the bandwidth is limited, so the proxy is used to receive the stream once. Users can then connect to the proxy instead of the original source. * when there are multiple users that are receiving a stream and the bandwidth is limited, so the proxy is used to receive the stream once. Users can then connect to the proxy instead of the original source.
* when there's a NAT / firewall between a stream and the users, in this case the proxy is installed in the NAT and makes the stream available to the outside world. * when there's a NAT / firewall between a stream and the users, in this case the proxy is installed in the NAT and makes the stream available to the outside world.
Edit `conf.yml` and replace everything inside section `paths` with the following content: Edit `rtsp-simple-server.yml` and replace everything inside section `paths` with the following content:
```yaml ```yaml
paths: paths:
proxied: proxied:
@ -91,7 +91,7 @@ Users can then connect to `rtsp://localhost:8554/proxied`, instead of connecting
#### Publisher authentication #### Publisher authentication
Edit `conf.yml` and replace everything inside section `paths` with the following content: Edit `rtsp-simple-server.yml` and replace everything inside section `paths` with the following content:
```yaml ```yaml
paths: paths:
all: all:
@ -115,7 +115,7 @@ WARNING: RTSP is a plain protocol, and the credentials can be intercepted and re
_rtsp-simple-server_ is an RTSP server: it publishes existing streams and does not touch them. It is not a media server, that is a far more complex and heavy software that can receive existing streams, re-encode them and publish them. _rtsp-simple-server_ is an RTSP server: it publishes existing streams and does not touch them. It is not a media server, that is a far more complex and heavy software that can receive existing streams, re-encode them and publish them.
To change the format, codec or compression of a stream, you can use _FFmpeg_ or _Gstreamer_ together with _rtsp-simple-server_, obtaining the same features of a media server. For instance, to re-encode an existing stream, that is available in the `/original` path, and publish the resulting stream in the `/compressed` path, edit `conf.yml` and replace everything inside section `paths` with the following content: To change the format, codec or compression of a stream, you can use _FFmpeg_ or _Gstreamer_ together with _rtsp-simple-server_, obtaining the same features of a media server. For instance, to re-encode an existing stream, that is available in the `/original` path, and publish the resulting stream in the `/compressed` path, edit `rtsp-simple-server.yml` and replace everything inside section `paths` with the following content:
```yaml ```yaml
paths: paths:
all: all:
@ -146,7 +146,7 @@ Flags:
--version print version --version print version
Args: Args:
[<confpath>] path to a config file. The default is conf.yml. Use 'stdin' to [<confpath>] path to a config file. The default is rtsp-simple-server.yml. Use 'stdin' to
read config from stdin read config from stdin
``` ```

4
conf.go

@ -55,8 +55,8 @@ func loadConf(fpath string, stdin io.Reader) (*conf, error) {
return nil return nil
} else { } else {
// conf.yml is optional // rtsp-simple-server.yml is optional
if fpath == "conf.yml" { if fpath == "rtsp-simple-server.yml" {
if _, err := os.Stat(fpath); err != nil { if _, err := os.Stat(fpath); err != nil {
return nil return nil
} }

2
main.go

@ -192,7 +192,7 @@ func newProgram(sargs []string, stdin io.Reader) (*program, error) {
"rtsp-simple-server "+Version+"\n\nRTSP server.") "rtsp-simple-server "+Version+"\n\nRTSP server.")
argVersion := k.Flag("version", "print version").Bool() argVersion := k.Flag("version", "print version").Bool()
argConfPath := k.Arg("confpath", "path to a config file. The default is conf.yml. Use 'stdin' to read config from stdin").Default("conf.yml").String() argConfPath := k.Arg("confpath", "path to a config file. The default is rtsp-simple-server.yml. Use 'stdin' to read config from stdin").Default("rtsp-simple-server.yml").String()
kingpin.MustParse(k.Parse(sargs)) kingpin.MustParse(k.Parse(sargs))

0
conf.yml → rtsp-simple-server.yml

Loading…
Cancel
Save