My sister got married back in October. Prior to the wedding she asked me if there was a way I could livestream the event since she had family who couldn’t make it. After she asked me this I started looking around at what was available to achieve this. Most of the tools I found either weren’t free, or weren’t as simple as what I was looking for. I figured if I got a web-cam and my the place she was marrying had internet that it was easy enough to set-up my own server and stream it myself. So this is what I did.
I already had a variety of servers and computers to use for the recording and for the server, but I didn’t have a high quality web-cam to use to record in HD. I looked on Amazon and found a camera that was rated highly, and would work with my laptop which runs linux.
Getting a static-ip
One of my first concerns was how I was going to host the stream so that her family on the east coast would be able to access the stream. On my home server through Comcast this is very simple, I can just open up a web server on a port and send her family members my Comcast IP address. Since she was getting married down by the Mexican border south of Tucson, I had to figure out another solution. Knowing that I had a static-ip address I could utilize with my Comcast home internet I figured I would use my home internet as my host server. While down in Tucson I would upload all of my data back home to the static-ip. The real issue here was that most cell phone providers do not offer a static-ip without some high upfront costs and more hardware. With my solution I only needed either 3g or the resort to have a good wifi signal.
Writing the HLS code
Once I realized my plan of attack I decided that HLS would give a simple solution. Since avconc and ffmpeg can both record to HLS files I just needed to upload these HLS files as they came in and then upload them to my home server. All of my code for this project ended up on a [github project] (https://github.com/bafolts/node-hls-server-client). The basic idea behind the solution was.
My computer in Tucson * Upload segments as they are recorded and send the new segment and playlist file to the server
My computer at home with Comcast * Download any segments received and update accordingly. * Send proper segment and playlist files to users when requested.
This approach ended up working really well. Each segment was very small and uploaded to my home server easily. Using node-js on my home server, the multiple file requests coming in often did not take down my box. If you need help with a related project or want me to describe something more let me know. I uploaded the final results of what was recorded and streamed to youtube.