Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


How to build a free, cheap in recourses but efficient video streaming server in minutes!
New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

How to build a free, cheap in recourses but efficient video streaming server in minutes!

jvnadrjvnadr Member
edited January 2014 in Tutorials

I was playing during the last months with red5, crtmp and others, trying to build a live streaming video server for the needs of my site.
Red5 is very powerful but very difficult to set up and lacks in support and manuals. Crtmp is easier, but still… I did some setups with both platforms, but I managed to setup the ultimate easy, in-minute and for n00bies platform to create a live video (or audio) streaming service with recording capabilities.
I have to mention that this solution is for use just by you and manually and not by clients / reselling / others.

The VLC solution

I was familiar with VLC, but as powerful it is, also hungry for resources is. Not always.

For our example, you will need a vps with as much BW as you can (or need). I used a box with 1GB memory and 2 virtual cores and I had 0.03 – 0.10 load when just re-transmitting stream and 0.22 – 0.35 load when I was re-encoded the stream. Memory was as low as 70 – 90MB! These values was valid with 4-5 viewers, I couldn’t test it with more. When I will use it for live site, I will update this.

You can manage your vlc via terminal, of course, but it is much easier if you start and configure your streams via remote desktop. The load values I wrote earlier, are with tightvnc remote console open, in an lxde desktop.
Install lxde desktop (or any other desktop you prefer) and a vnc server to your box. I used debian with lxde and vnc4server.
Create a non-root user (in our example user1) for your vnc and manage remotely your vps via desktop with that user (if you use root user, then vlc won’t open).

Install vlc both in your home pc and your vps.
Go to your home pc. Open a video to vlc or a capture device.

I used wmv3 encoding, because it is very powerful in lower bitrates and easily embed in a web page, but of course you can use any encoding you prefer. I also prefer h264 when retransmitting my video for watching in vlc or any media player and don’t want to embed it in a web page.

When opening the video or capture device, don’t select play but stream.
Add a http destination, chose port (you have to redirect in to your pc in your router, if you don’t have direct access to the web) and path (any name you want. If you don’t use path, then your address will be http://xx.xx.xx.xx:port/).
In transcoding options, chose “activate transcoding” and in the right, create a new profile for your needs.
I created for the wmv example, an ASF encapsulation, wmv2 video and audio profile.
Select the profile and press “stream”.

Now, go to your vps via remote desktop and open VLC.

Open “network stream” and use the address of your home pc (http://xx.xx.xx.xx:port/). I use no-ip to my router, so, I always have a url (http://example.no-ip.info) to use for my streams. Then, don’t select play but stream. In destination tab, create a http new destination, chose a port (you have to open the port to your iptables or any other firewall you use), select “activate transcoding” and then create a new profile, as you did in your home pc. To use fewer resources, check “keep original video and audio tracks” in the video and audio codec tab. It will not transcode the stream and will keep server load at minimum.
Then, press “stream”.

Now, your live stream is up and going. Watch it in a media player (e.g. vlc or classic media player).

If you want to embed it, that’s easy: create an .asx file like this:

<ASX version ="3.0">
<TITLE>live</TITLE>
<ENTRY>
<REF HREF ="http://xx.xx.xx.xx:yourport"/>
</ENTRY>
</ASX>

You will use your vps ip with the port that you used for streaming in the vps’s VLC.

Save it and use it in a web page, that has to contain this in the body section:

<embed src ="livestream.asx" width="xxx" height="xxx">

Use width and height same with your stream.

Voila! You are streaming to the world with your own server!


_
PS: I wanted to publish help code for installing xlde and vnc with separate users, but editing system didn't let me do it... Too long? Maybe, but when I tried to edit it I had a cloudflare message asked me for a captcha that didn't even shown!_

Thanked by 1Jupiter

Comments

  • Nice thx dude.

  • jcalebjcaleb Member
    edited January 2014

    the streaming part is the easy one. it's the client part that is difficult. just no standards for viewing streaming for all devices (desktop, ios, android).

  • jcaleb said: the streaming part is the easy one. it's the client part that is difficult. just no standards for viewing streaming for all devices (desktop, ios, android).

    Indeed. If client uses a media player/viewer (in any device) with the url, that is easy. But, if you want to embed it to webpage or webservice, then, it will be pain in the ass! Easy to embed a .flv stream, but needs a web server and the quality isn't so good as other encoding options (h264 or even wmv: h263 or vp8 lacks when used in flash). On the other hand, html5 embeding is not for all purposes. Best platform remains wowza, but that solution is too expensive for most of us (over $1K for just one server).
    But yet, I managed to receive wmv live stream in embed webpage in WIN, Linux and android (I have no access to MAC and I will shortly try to test it in my brother's i-phone and i-pad). In pc, you just have to load a firefox or chrome plugin (in explorer and opera is standard) that is, nowdays, a must of because a lot of radio (mostly) stations uses ms technology for streaming.
    In Android, you have to load an app (I use mx player that can handle almost all live and on demand video streams). The app will load automatically when the browser detects a video stream (flash, h264, mp4 or wmv).

    ironhide said: Anyone tried MiniDLNA ?

    I havn't used it yet, but I think it is only for mp3 streaming (audio). For my audio needs, i use shoutcast or icecast servers. There are some free solutions for handling them, but I will present them in another tutorial! :-)

  • i have a wowza license for streaming, i get it for a customers, and it worth it. is expensive, but is the only can stream to android or ios.

    im playing with it on my site, maybe we can fix something to share that media server ;)

  • I recommend GNUMP3d, easy and simple but works well. You just gotta connect to it using wmplayer or vlc

  • sc754 said: I recommend GNUMP3d, easy and simple but works well. You just gotta connect to it using wmplayer or vlc

    This is a mp3 streaming server, not a live stream (as shoutcast) server and cannot restream video files as wmv, h263 or h264. It can only stream video ogg files that are located to server and imported to the db.

  • ihatetonyyihatetonyy Member
    edited January 2014

    Wowza is extortionate - try https://github.com/arut/nginx-rtmp-module. It's FOSS and has all the good major features related to live streaming.

    I was going to write a tutorial late last month and forgot..

  • ihatetonyy said: I was going to write a tutorial late last month and forgot..

    I recently discovered this, but it lacks to tutorials. So, waiting yours! :-P

  • I'll get out the old stone tablet and chisel and finish it up then.

Sign In or Register to comment.