how to make a simple audio/video streaming server

Kiyor | Created: 03-17-14 11:23:58



  • Music are pretty custom, hard to find a public streaming website that really fit for you.
  • You have download music everyday. More and more storage you use, you might never out of space on you desktop, but how about your iphone, ipad, android device? or your working laptop?
  • How to sync your music to different device? Each time download new music will need sync to different device.
  • In 90%, you have wifi, not necessary have everything on your device.
  • Download from torrent, then put to different device, after that you already not interested any more…
  • I have Linux server skill!!!

If you have problem above, then you need it.

  1. Sync audio/video folder to your VPS or download by torrent.
  2. VPS auto detecting file type.
  3. VPS generate playlist for you.
  4. You able to access from all your device by access your VPS over html.
cd /tmp
wget http://curl.haxx.se/download/curl-7.36.0.tar.gz
tar xvzf curl-7.36.0.tar.gz
cd curl-7.36.0
make && make install
cd /tmp
wget https://github.com/downloads/libevent/libevent/libevent-2.0.21-stable.tar.gz
tar xvzf libevent-2.0.21-stable.tar.gz
cd libevent-2.0.21-stable
./configure
make && make install
cd /tmp
wget http://download.transmissionbt.com/files/transmission-2.82.tar.xz
tar xvfJ transmission-2.82.tar.xz
cd transmission-2.82
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
./configure
make && make install
  • Setup http mount point
useradd nginx

my example nginx vhost conf ( since I have lot of japanese content, I set html charset to shift_jis )

server {
    listen      80;
    server_name hostname;
    charset utf-8;
    root /home/nginx/html;
    location / {
        index index.html index.htm;
        autoindex on;
    }
    location /= {
        alias /home/nginx/html;
        index index.html index.htm;
        autoindex on;
    }
    location ~* \.(html|htm|txt)$ {
        index index.html index.htm;
        charset Shift_JIS;
    }
    location ~* player$ {
        index index.html index.htm;
        default_type 'text/html';
    }
}
  • Init transmission config
su - nginx
transmission-daemon
killall transmission-daemon

suggestion config ( ~/.config/transmission-daemon/settings.json )

"rpc-enabled": true,
"rpc-username": "login username",
"rpc-password": "login password", 

transmission smart enough if you using text password, it will convert to hash automatically

go get github.com/kiyor/playlist
go install github.com/kiyor/playlist
cp -r templates html/ #cp my repo's templates file to you html directory ( html/templates/*.tmpl )
cd html
git clone git@github.com:johndyer/mediaelement.git
git clone git@github.com:kiyor/mep-feature-playlist.git
  • Download or upload something to you html folder
su - nginx
transmission-daemon
  1. go to hostname:9091, upload torrent or magnet link and download to your html/bt
  2. after downloaded, try access your hostname/bt
  3. run playlist -dir ‘your html dir’, it would generate a file call player
  4. access your player in all your device
  • current only support mp3/wav as audio mp4 as video%


Category: none