Add OpenWRT Makefile (#970)
* add openwrt makefile * update and normalize makefile * add OpenWRT instructions to the README --------- Co-authored-by: aler9 <46489434+aler9@users.noreply.github.com>
This commit is contained in:
parent
ea158caed8
commit
c3f7639e98
55
README.md
55
README.md
|
@ -53,6 +53,7 @@ Features:
|
|||
* [Installation](#installation)
|
||||
* [Standard](#standard)
|
||||
* [Docker](#docker)
|
||||
* [OpenWRT](#openwrt)
|
||||
* [Basic usage](#basic-usage)
|
||||
* [General](#general)
|
||||
* [Configuration](#configuration)
|
||||
|
@ -68,7 +69,7 @@ Features:
|
|||
* [HTTP API](#http-api)
|
||||
* [Metrics](#metrics)
|
||||
* [pprof](#pprof)
|
||||
* [Compile and run from source](#compile-and-run-from-source)
|
||||
* [Compile from source](#compile-from-source)
|
||||
* [Publish to the server](#publish-to-the-server)
|
||||
* [From a webcam](#from-a-webcam)
|
||||
* [From a Raspberry Pi Camera](#from-a-raspberry-pi-camera)
|
||||
|
@ -127,6 +128,38 @@ docker run --rm -it -e RTSP_PROTOCOLS=tcp -p 8554:8554 -p 1935:1935 -p 8888:8888
|
|||
|
||||
Please keep in mind that the Docker image doesn't include _FFmpeg_. if you need to use _FFmpeg_ for an external command or anything else, you need to build a Docker image that contains both _rtsp-simple-server_ and _FFmpeg_, by following instructions [here](https://github.com/aler9/rtsp-simple-server/discussions/278#discussioncomment-549104).
|
||||
|
||||
### OpenWRT
|
||||
|
||||
1. In a x86 Linux system, download the OpenWRT SDK corresponding to the wanted OpenWRT version and target from the [OpenWRT website](https://downloads.openwrt.org/releases/) and extract it.
|
||||
|
||||
2. Open a terminal in the SDK folder and setup the SDK:
|
||||
|
||||
```
|
||||
./scripts/feeds update -a
|
||||
./scripts/feeds install -a
|
||||
make defconfig
|
||||
```
|
||||
|
||||
3. Download the server Makefile and set the server version inside the file:
|
||||
|
||||
```
|
||||
mkdir package/rtsp-simple-server
|
||||
wget -O package/rtsp-simple-server/Makefile https://raw.githubusercontent.com/aler9/rtsp-simple-server/main/openwrt.mk
|
||||
sed -i "s/v0.0.0/$(git ls-remote --tags --sort=v:refname https://github.com/aler9/rtsp-simple-server | tail -n1 | sed 's/.*\///; s/\^{}//')/" package/rtsp-simple-server/Makefile
|
||||
```
|
||||
|
||||
4. Compile the server:
|
||||
|
||||
```
|
||||
make package/rtsp-simple-server/compile -j$(nproc)
|
||||
```
|
||||
|
||||
5. Transfer the .ipk file from `bin/packages/*/base` to the OpenWRT system and install it with:
|
||||
|
||||
```
|
||||
opkg install [ipkg-file-name].ipk
|
||||
```
|
||||
|
||||
## Basic usage
|
||||
|
||||
1. Publish a stream. For instance, you can publish a video/audio file with _FFmpeg_:
|
||||
|
@ -512,29 +545,41 @@ go tool pprof -text http://localhost:9999/debug/pprof/heap
|
|||
go tool pprof -text http://localhost:9999/debug/pprof/profile?seconds=30
|
||||
```
|
||||
|
||||
### Compile and run from source
|
||||
### Compile from source
|
||||
|
||||
#### Standard
|
||||
|
||||
Install Go ≥ 1.18, download the repository, open a terminal in it and run:
|
||||
|
||||
```sh
|
||||
go run .
|
||||
go build .
|
||||
```
|
||||
|
||||
In order to compile and run with support for the Raspberry Pi Camera:
|
||||
The command will produce the `rtsp-simple-server` binary.
|
||||
|
||||
#### Raspberry Pi
|
||||
|
||||
In case of a Raspberry Pi, the server can be compiled with native support for the Raspberry Pi Camera. Install Go ≥ 1.18, download the repository, open a terminal in it and run:
|
||||
|
||||
```sh
|
||||
cd internal/rpicamera/exe
|
||||
make
|
||||
cd ../../../
|
||||
go run -tags rpicamera .
|
||||
go build -tags rpicamera .
|
||||
```
|
||||
|
||||
The command will produce the `rtsp-simple-server` binary.
|
||||
|
||||
#### Compile for all supported platforms
|
||||
|
||||
Compilation for all supported platform can be launched by using:
|
||||
|
||||
```sh
|
||||
make binaries
|
||||
```
|
||||
|
||||
The command will produce tarballs in folder `binaries/`.
|
||||
|
||||
## Publish to the server
|
||||
|
||||
### From a webcam
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=rtsp-simple-server
|
||||
PKG_VERSION:=v0.0.0
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://github.com/aler9/rtsp-simple-server
|
||||
PKG_SOURCE_VERSION:=$(PKG_VERSION)
|
||||
|
||||
PKG_BUILD_DEPENDS:=golang/host
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
PKG_USE_MIPS16:=0
|
||||
|
||||
GO_PKG:=github.com/aler9/rtsp-simple-server
|
||||
GO_PKG_LDFLAGS_X:=github.com/aler9/rtsp-simple-server/internal/core.version=$(PKG_VERSION)
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
include $(TOPDIR)/feeds/packages/lang/golang/golang-package.mk
|
||||
|
||||
GO_MOD_ARGS:=-buildvcs=false
|
||||
|
||||
define Package/rtsp-simple-server
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
TITLE:=rtsp-simple-server
|
||||
URL:=https://github.com/aler9/rtsp-simple-server
|
||||
DEPENDS:=$(GO_ARCH_DEPENDS)
|
||||
endef
|
||||
|
||||
define Package/rtsp-simple-server/description
|
||||
ready-to-use and zero-dependency server and proxy that allows users to publish, read and proxy live video and audio streams through various protocols
|
||||
endef
|
||||
|
||||
$(eval $(call GoBinPackage,rtsp-simple-server))
|
||||
$(eval $(call BuildPackage,rtsp-simple-server))
|
Loading…
Reference in New Issue