Giter VIP home page Giter VIP logo

video-server's Introduction

GoDoc Sourcegraph Go Report Card GitHub tag

Golang-based video-server for re-streaming RTSP to HLS/MSE

Table of Contents

About

Simple WS/HTTP server for re-streaming video (RTSP) to client in MSE/HLS format.

It is highly inspired by https://github.com/deepch and his projects. So why am I trying to reinvent the wheel? Well, I'm just trying to fit my needs.

Instalation

Binaries

Linux - link

From source

go get github.com/LdDl/video-server
# or just clone it
# git clone https://github.com/LdDl/video-server.git

Go to root folder of downloaded repository, move to cmd/video_server folder:

cd $CLONED_PATH/cmd/video_server
go build -o video_server main.go

Usage

video_server -h
-conf string
    Path to configuration JSON-file (default "conf.json")
-cpuprofile file
    write cpu profile to file
-memprofile file
    write memory profile to file

Start server

Prepare configuration file (example here). Then run binary:

video_server --conf=conf.json

Test Client-Server

For HLS-based player go to hls-subdirectory.

For MSE-based (websockets) player go to mse-subdirectory.

Then follow this set of commands:

npm install
npm run dev

You will se something like this after succesfull fron-end start:

DONE  Compiled successfully in 1783ms                                                                                                                                                                         12:09:30 PM
App running at:
- Local:   http://localhost:8080/ 

Paste link to the browser and check if video loaded successfully.

Dependencies

GIN web-framework - https://github.com/gin-gonic/gin. License is MIT

Media library - http://github.com/deepch/vdk. License is MIT.

UUID generation and parsing - https://github.com/google/uuid. License is BSD 3-Clause

Websockets - https://github.com/gorilla/websocket. License is BSD 2-Clause

m3u8 library - https://github.com/grafov/m3u8. License is BSD 3-Clause

errors wrapping - https://github.com/pkg/errors . License is BSD 2-Clause

License

You can check it here

Developers

Roman - https://github.com/webver

Pavel - https://github.com/Pavel7824

Dimitrii Lopanov - https://github.com/LdDl

Morozka - https://github.com/morozka

video-server's People

Contributors

lddl avatar morozka avatar pavel7824 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

video-server's Issues

[BUG] can't sync dependency

Describe the bug

can't sync dependency

To Reproduce

  1. clone this repository
  2. cd the root of this repository
  3. run go mod tidy
  4. the console output
~/go/src/github.com/LdDl/video-server(master) » go  mod tidy                                                                                                                                                                                   
verifying github.com/morozka/[email protected]: checksum mismatch
	downloaded: h1:pPU9EkyU6k8xIET23Q+VZgyozCwLkiRUB0feoKynKYM=
	go.sum:     h1:pRCLahoaYW8OCyavzCdB/3c/DONVg1PEvknlsYrRwl8=

SECURITY ERROR
This download does NOT match an earlier download recorded in go.sum.
The bits may have been replaced on the origin server, or an attacker may
have intercepted the download attempt.

For more information, see 'go help module-auth'.

Expected behavior

after run go mod tidy, it should produce

~/go/src/github.com/LdDl/video-server(master*) » go mod tidy                                                                                                                                                                                  
go: finding module for package github.com/morozka/vdk/av
go: finding module for package github.com/morozka/vdk/format/rtsp
go: finding module for package github.com/morozka/vdk/format/ts
go: finding module for package github.com/morozka/vdk/format/mp4f
go: found github.com/morozka/vdk/av in github.com/morozka/vdk v0.0.0
go: found github.com/morozka/vdk/format/mp4f in github.com/morozka/vdk v0.0.0
go: found github.com/morozka/vdk/format/rtsp in github.com/morozka/vdk v0.0.0
go: found github.com/morozka/vdk/format/ts in github.com/morozka/vdk v0.0.0

Describe the solution you'd like and provide pseudocode examples if you can

I remove go.mod and go.sum and run go mod init go mod tidy, it works, maybe I should send a pull request later.
I think this may caused by vdk updated the source code

Additional context

my environment:

  1. OS: Arch Linux, rolling release
  2. go version:
~/go/src/github.com/LdDl/video-server(master) » go version
go version go1.15.6 linux/amd64

[BUG] Security vulnerabilities message

Describe the bug
So we have next message
image

Describe the solution you'd like and provide pseudocode examples if you can
Need to move for new Gin version and JWT

Additional context
nope

Fix Format may be raw PCM 97 96

[GIN-debug] [WARNING] Running in "debug" mode. Switch to "release" mode in production.

  • using env: export GIN_MODE=release
  • using code: gin.SetMode(gin.ReleaseMode)

2020/09/18 22:23:35 Server has been started (awaiting signal to exit)
2020/09/18 22:23:35 Stream must be establishment for 'c2680f08-07cc-4dee-9231-685893e2661f' by connecting to rtsp://admin:[email protected]/h265/ch1/main/av_stream
2020/09/18 22:23:35 Fix Format may be raw PCM 97 96

[FEATURE REQUEST] WebRTC

Is your feature request related to a problem? Please describe.
Consider WebRTC output

Describe the solution you'd like and provide pseudocode examples if you can

  • Implement server side: provide API + provide configuration for the application
  • Implement example of client side: copy-paste VueJS code for MSE (or HLS) + modify it for WebRTC workflow

[BUG] Cannot read property 'appendBuffer' of null

hi. I have a problem 'appendBuffer' in MsePlayer. Server written in rast. I getting streams in 'arrayBuffer', but i get the error: Cannot read property 'appendBuffer' of null. I need help. I will be grateful for the help.

[FEATURE REQUEST] Local storage and archive

Is your feature request related to a problem? Please describe.
Consider storing (optionally) archive videos in filesystem

Describe the solution you'd like and provide pseudocode examples if you can

  • Add configuration for storing files ('every 1 hour', 'every 5 min' and etc.)
  • Write necessary procedures (like HLS one)
  • Produce new API for archive videos for HLS / MSE
  • Update client examples

[FEATURE REQUEST] Type of output streams

Is your feature request related to a problem? Please describe.
There are MSE+HLS output always for every possible stream.
It should be optional for some cases: sometimes you just do not need, i.e., HLS output.

Describe the solution you'd like and provide pseudocode examples if you can
Add necessary filed to *.json configuration file.
Update HTTP/WS handlers.
Update StartStreams function

Describe alternatives you've considered and provide pseudocode examples if you can
nope

Additional context
nope

[FEATURE REQUEST] Improve error handling

Is your feature request related to a problem? Please describe.
Here is example of code without any client feedback about error:

func wshandler(wsUpgrader *websocket.Upgrader, w http.ResponseWriter, r *http.Request, app *Application) {
	...
	...
	streamIDSTR := r.FormValue("suuid")
	streamID, err := uuid.Parse(streamIDSTR)
	if err != nil {
		log.Printf("Can't parse UUID: '%s' due the error: %s\n", streamIDSTR, err.Error())
		return
	}
	...
	...
}

It's bad practice, because client doesn't even know who (client or server) is wrong in case when there is no video-stream in player without talking to Back-end programmer.

Describe the solution you'd like and provide pseudocode examples if you can
Just wrtie some fancy error codes (with text) for most of cases.

Describe alternatives you've considered and provide pseudocode examples if you can
nope

Additional context
nope

[FEATURE REQUEST] CORS as an option

Is your feature request related to a problem? Please describe.
CORS is hardcoded currently. It ill be good to have an option for it.

Describe the solution you'd like and provide pseudocode examples if you can
Edit *.json configuration file. Update Go's structs, add some conditions checks.

Describe alternatives you've considered and provide pseudocode examples if you can
nope

Additional context
nope

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.