Skip to content

Commit

Permalink
add: support for docker-compose
Browse files Browse the repository at this point in the history
Copy the .env.example into a .env file, update with your variable run `docker-compose up`

horgh/videostreamer#22
  • Loading branch information
nickorzha committed Feb 21, 2022
1 parent 7c4055d commit a91c2c8
Show file tree
Hide file tree
Showing 4 changed files with 42 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
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 a91c2c8

Please sign in to comment.