Skip to content

Commit

Permalink
Merge pull request #23 from fpaupier/master
Browse files Browse the repository at this point in the history
add: support for docker-compose
  • Loading branch information
nickorzha committed Mar 10, 2022
2 parents 7c4055d + f8ac78d commit 8fa5d42
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 4 deletions.
6 changes: 6 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
HOST=0.0.0.0
PORT=8080
FORMAT=rtsp
FCGI=false
SOURCE_RTSP=rtsp://rtsp.stream/pattern
VERBOSE=true
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
.idea
.env
*.swp
cmd/remux_example/remux_example
videostreamer
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,21 @@ website.
* Run the daemon. Its usage output shows the possible flags. There is no
configuration file.

## Running with docker-compose

1. Copy the provided example environment file `.env.example`
```shell
cp .env.example .env
```
2. Edit the `.env` environment file with your config, especially the path towards your source input.

3. Run the app with docker-compose
```shell
docker-compose up
# docker-compose up --build # if you wish to rebuild the docker image
```

4. Use your favorite browser to open the `index.html` and you're good!

## Components
* `videostreamer`: The daemon.
Expand Down
30 changes: 30 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
version: "2.3"

services:
rtsp2mp4:
container_name: videostreamer
image: popszer/rtsp2mp4:v0.0.1
build: .
env_file:
- .env
environment:
- HOST=${HOST}
- PORT=${PORT}
- FCGI=${FCGI}
- VERBOSE=${VERBOSE}
- FORMAT=${FORMAT}
- SOURCE_RTSP=${SOURCE_RTSP}
ports:
- "${PORT}:${PORT}"
command:
- /bin/bash
- -c
- |
/videostreamer -host ${HOST} \
-port ${PORT} \
-input ${SOURCE_RTSP} \
-verbose ${VERBOSE} \
-fcgi ${FCGI} \
-format ${FORMAT}
8 changes: 4 additions & 4 deletions videostreamer.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,10 @@ func main() {
func getArgs() (Args, error) {
listenHost := flag.String("host", "0.0.0.0", "Host to listen on.")
listenPort := flag.Int("port", 8080, "Port to listen on.")
format := flag.String("format", "pulse", "Input format. Example: rtsp for RTSP.")
input := flag.String("input", "", "Input URL valid for the given format. For RTSP you can provide a rtsp:// URL.")
format := flag.String("format", "rtsp", "Input format. Example: rtsp for RTSP.")
input := flag.String("input", "rtsp://rtsp.stream/pattern", "Input URL valid for the given format. For RTSP you can provide a rtsp:// URL.")
verbose := flag.Bool("verbose", false, "Enable verbose logging output.")
fcgi := flag.Bool("fcgi", true, "Serve using FastCGI (true) or as a regular HTTP server.")
fcgiVar := flag.Bool("fcgi", false, "Serve using FastCGI (true) or as a regular HTTP server.")

flag.Parse()

Expand All @@ -136,7 +136,7 @@ func getArgs() (Args, error) {
InputFormat: *format,
InputURL: *input,
Verbose: *verbose,
FCGI: *fcgi,
FCGI: *fcgiVar,
}, nil
}

Expand Down

0 comments on commit 8fa5d42

Please sign in to comment.