Developing a video streaming server and a data visualization tool

I’m looking to develop what is essentially a video streaming server that will stream video to mobile clients on Android and iOS and potentially to web clients (desktop and mobile) as well down the line - any client really. There will also be a data visualization portal that will allow video uploaders to view statistics about their video views - how many views, geographic distribution, etc. I’ll be providing a mobile client SDK so that third parties can plug in to the platform in order to be able to stream the hosted videos on the platform within their apps.

I’m coming from a Rails background - is this something that would be suitable/optimal to be developed in Meteor or am I better off with another framework. Considerations are speed of development, streaming capabilities, scalability (concurrent video streams) - note that the video streaming itself can actually be handled by AWS or some other content hosting facility. On a personal level, I am of course interested in learning to develop with Meteor, but ultimately want to do what’s best for the platform.

Would it make sense to do the streaming server with some other framework and then the data visualization web app in Meteor? Not sure really, so looking for some feedback.

Advice, pointers, recommendations, all welcome and appreciated!

2 Likes

Hi @saads

Part of the application we are busy developing in meteor involves video uploads and sharing and so on. Will share some info of what I have learned along the way. It may not be all meteor specific but here it goes.

My fist approach was to use one of the existing file upload packages thats available on atmosphere and upload the file through the meteor server to mongo gridfs storage. They all worked 100% for this, but the problem came in with playing back the videos. None of them supported byte serving capabilities so together with the help of some guys we implemented it in meteor-file-collection. We had to upgrade gridfs-stream npm package as well (used by meteor-file-collection) to use the new node style streams with flow control which works fantastic for video streaming. So with this solution hosted on a cheap digital ocean vm in another country I saw very impressive HD video streaming capabilities. Range request were instant and you can click around on the seek bar until you are blue in the face it works very nice. It did not use a lot of resources (https://atmospherejs.com/vsivsi/file-collection is very efficient) and should not be a problem to scale but you will have to do some tests yourself as I did not go that far. The reason we stopped going that way is that we want to provide a free solution and to minimize our operating/hosting cost we are not able to store all the videos/files in mongodb thats replicated (x3 mongo dbs) as its very expensive.

So the way we are going now is to make use of azures low cost storage options, uploading videos directly to azure blob storage and streaming directly from azure blob storage. Im still investigating the encoding solutions, heywatch looks very promising atm. Just remember that if you use h264 codec (encoding and decoding) that there might be a cost involved for the royalties or you will have to use openh264 binaries. If you use heywatch then its not a problem but if you encode the videos yourself just watch out. There are a few nice uploaders currently available to upload to the cloud storage providers but non yet for azure with the specifications im interested in. So im busy developing a package that I will open source for a fault-taulerent, resumable (even over sessions), concurrent chunked uploader to azure blob storage that is build with strict security in mind. Will also integrate a video encoder api with this. On cordova the plan is to send the chunks via the cordova file transfer pluggin to avoid reading/sending the bytes via javascript as it consumes a lot of resources on the mobile device. Will also integrate a circular cache to store vidoes/images.

I think meteor is the great solution for something like this and the problems that you will face with video streaming is not meteor specific but a general problem in the html world. If it wasnt for meteor we (just 3 devs) would not have the time/money/resources to pull off the projects that we do. Awesome intro to meteor -> https://www.discovermeteor.com/

Data visualization is perfect for meteor as you can build nice D3 graphs ( http://d3js.org/) and other stats/counters that changes live without any problems - as this is one of the platforms ‘selling’ points and it works fantastic!

Hope this helps! Let us know if you find something interesting.

Regards,
Riaan

7 Likes

That was really helpful @riaan53, thank you.

I am just at the beginning of this experiment so will report back when I have more insight to give. But I just wanted to see if there are any major flags or warnings that I need to be aware of prior to embarking.

Your post actually gave me a bit of comfort. I am sure I am not the first person to try using Meteor for uploading/streaming of video, but most of the real key use cases I have been reading on for the framework are to do with its real benefit in developing comprehensive web applications (with full on front-end web apps). In my case the web app front end will primarily be the data analytics visualizer and the upload tool, and the focus is really on the back end for storing, scheduling and streaming the content.

I was actually always thinking that it would be better for me not to store and stream the video content directly but to use a third party, like AWS or Azure or an equivalent. Your post also helped to further reinforce that this makes more sense.

Why did you choose Azure over the multiple alternatives? Your views on that could be helpful.

I’m going through the discover book now - and thanks for the pointer on the D3 visualization package :thumbsup: :thumbsup:

I am very new to data visualization and use Koolchart for creating charts and graphs. They too have real time charts which works fantastically.

Glad it helped!

Remember that there are lots of worker packages that can offload heavy tasks to any number of normal node servers (or other) for video encoding or other CPU intensive tasks. For example https://github.com/vsivsi/meteor-job-collection .

You can more or less hook up anything to meteor via the simple DDP protocol or use one of the packages ( https://www.npmjs.com/package/ddp ) or via normal REST API. For instance I have a raspberry PI with some sensors on that runs a normal node application that talks DDP to my meteor server and now I have live sensor status and controls on a browser and cordova.

Most of the cloud storage providers have comparable prices, security and features (except rackspace seemed a bit expensive) and I have prototyped a few of them. 2 main reasons why I have chosen azure:

  1. Its the only one (between google cloud, s3 and azure) where I got acceptable video streaming capabilities including byte serving directly from the storage account. Just remember to set your service version correct if you want to try it out otherwise byte serving wont work. There might have been issues on google cloud or s3 (or ive done something wrong) that has been solved since so maybe try it out yourself before you decide.

  2. They have an office team developing and maintaining nodejs packages for all the azure features with a great API. This is a big deal as you can use npm packages in meteor. http://azure.microsoft.com/en-us/develop/nodejs/ https://www.npmjs.com/package/azure-storage https://www.npmjs.com/package/azure

Im not having that much luck with the azure CDN to serve private content but I think im going to use replication instead but still need to investigate.

Let me know the direction you are going and the storage provider you have chosen.

1 Like

I have done some investigation into amazon s3 + cloudfront and it works pretty good for video streaming atm. The cloudfront CDN also supports private content serving.

1 Like

riaan53,

I’ve been working with Meteor for just a little while, but still have lots to learn! Wondering if you would mind sharing how you were able to accomplish the solution with the raspberry PI and sensors. I’m not using a raspberry PI, but am attempting to pull in data from a couple of sensors and aac audio from one IP, while a h.264 video comes in RTSP from another IP. This is all streaming from a piece of hardware that will give me distance and a timestamp as well. My challenge is to display it all. If this can be accomplished with Meteor, and I hope it is, the next hurdle is to save the data and make use of the timestamp to sync it all for playback. Any insight you can share is greatly appreciated!

1 Like

Hi,

I used a normal node app with https://github.com/rwaldron/johnny-five and https://www.npmjs.com/package/ddp. There are ddp clients for various other languages see http://meteorpedia.com/read/DDP_Clients.

So the node app ran on the pi and used johnny five to interface with the sensors/leds/switches. I used the normal meteor collections to transport the signals. So just call a method if you want to update a sensor value and use a observer and event emitter to reflect changes from the server.

Hope this help a bit. Please ask if you need more info.

1 Like

I am more on the embed part of livestreams, indexing twitch, hitbox, livecoding and testing various ways how to do search etc.
Meteor is nice framework if u need to provide additional personal value for every user. As without logged in users, these DDP connections can be expensive.
But still Meteor helps with server side sync things, no need to worry about async hell as much.

After deep consideration, I am probably going to use mongodb just for user management. And all other will be handled by Neo4j, as I will be doing a lot of relations heavy stuff, like discover/suggestion stuff based on user likes/ratings etc.

Maybe I will add that live current speaker/topic in mongo as meteor microservice.
Plus integration with IBM watson, so the event owner can turn on paid Speech2text live integration + live translation if he want. For people with hearing problems it can be added value, or for non-native speakers translation.
These added live things will probably use some DDP connect to microservice which enable them, but that would be in separate mongoDB, so we dont spam oplog.

But as a meta framework which just index and connect various APIs Meteor seems quite useful.
My sandbox http://shocki.tv
And some added value to 1 stream (branding, sli.do to engage audience, next to event logo is event name and current speaker + next 1 or 2 speakers/topics , in the work donate buttons and rating system) http://shocki.tv:90/event/codecon-2015

1 Like

@riaan53
Hi,
I got involved with livehacks.tv to do some interfaces regarding video upload lifecycle.
What would you suggest for simple uploading of video, recoding to let’s say 3 quality settings - fullhd, sd, mobile and than streaming to client on our site with player which will give u that quality option and we can limit it so it would be embeddable only on our picked sites.
I would want to offload whole uploading to client, thinking about slingshot to storage and than continuing with recoding using one of these Azure media encoders (on fast look the standard encoder should be sufficient to me).

What would you suggest ?

Just a general note. In a project we had a lot of success with https://zencoder.com

Hi @shock,

Just remember that if you want to support “all” the browsers you will have to use different codecs as well. If you have webm and h264 you should be well covered for all major browsers and iOS / android as well. So its 3 quality settings x 2 codecs = 6 video encodings that you need to store for every upload. Also note the if you use H.264 about the royalties which may or may not apply depending on lots of stuff: http://www.streaminglearningcenter.com/articles/h264-royalties-what-you-need-to-know.html.

Slingshot will work for uploading directly to the cloud storage, but it does not support Azure out of the box and does not support resuming so for large video uploads it may be a problem.

After its uploaded you can use a simple and cheap service like http://coconut.co/ for the encodings. Wrap https://www.npmjs.com/package/coconutjs in a meteor package to control your encodings. Also have a look at the amazon elastictranscoder.

I would suggest just plain and simple amazon s3 for video storage and amazon cloudfront for the CDN. Theres lots of npm package for amazon that you can use in meteor. A note on Azure: it gets expensive and they do not support WEBM or OGV codecs last time I checked. They charge for populating the CDN nodes as well.

But like @dinos mentioned above, theres a lot of cloud encoders available so try them out and see which one suites your business requirements the best.

Now if you are done with that you need a nice html5 video player, theres lots available but http://videojs.com/ with all the add-ons like the HD/SD buttons works pretty good.

Hope it helps.

1 Like

AWS also allows you to use https://aws.amazon.com/elastictranscoder/ and lambda function to trigger encoding instantly. So you just upload with slingshot. Then AWS takes over and will handle the whole process of encoding. Then you can get a notification when it’s done so you can work further in Meteor. That keeps things more separated.

2 Likes

Hi,

is it possible to send video stream from Android app to Meteor server? Do I have to use Android-ddp on Android app or I can use the normal socket class in Android and in the Meteor server capture the video stream through DDP protocol?

Thanls in advance!

We had a similar use case for our concert website. We decided to go with a cloud video transcoding service called Qencode. They provided all the features we needed from AWS, but ended up much cheaper and more responsive to custom requests.

Not sure if this is what you were looking for, but here’s the link to their api for reference: https://portal.qencode.com/docs