Media Server for streaming videos over local network written in Go. The server has no dependencies other than the Go standard library. The web client uses Video.js
Currently, only Linux is supported. To build in your computer, you need to have installed all the build dependencies:
- git
- go
- make
- wget
Once you have everything installed, grab the code frome github.
go get github.com/GAumala/MediaServer
Once you have the repository in your computer go to the root directory and
use the make
command.
cd $GOPATH/src/github.com/GAumala/MediaServer
make
This command downloads the necessary Video.js files if they are missing and
creates an executable named MediaServer
. As long as the public
folder is its same directory it will work properly.
You can start the server with:
./MediaServer
If you open your browser and visit localhost:8080 you will find a simple HTML file listing all your available videos.
Notice that the url for watching a video could be something like
http://localhost:8080/watch?v=99653847.mp4
. You should be able to copy that
link into any player like vlc or mpv and stream it without issues.
By default it will serve the .mp4 videos in the path /home/<USER>/Videos
.
If you want to configure things like the port or the directories where to find
videos you can pass a JSON file as parameter:
{
"port": 5678,
"verbose": true,
"videoDirs": [
"/home/gabriel/Videos/",
"MEGAsync Downloads",
"/home/gabriel/Downloads/"
]
}
The file specifies a custom port 5678 and 3 directories that should be scanned to serve videos. To use it just execute:
./MediaServer myConfig.json
If you need more help about using this tool or how to manage your video library checkout the wiki.
By default the videos are streamed in a web client using video.js. The server
will try to figure out whether to serve html or raw video files based on the
client request's Accept
header. If you want to force the HTML list to show
raw file links your URL to localhost:8080/?player=0. This is useful when you have an unsupported
video player.