Video content heavy website - ruby-on-rails

For developing a video content heavy website like youtube which language/framework might be a better option from performance and support for video conversion/compression plugins point of view. Some points worth considering may be.
CPU vs I/O time
Support for compression/conversion plugin (existing mods/gems/libs)
Ease of learning is not very important though inputs are welcome
I know the question sounds a bit subjective however my intention is to understand the technicalities involved from someone who has had experience developing similar kind of site(s).

Unfortunately there isn't one or two APIs/Libraries/Frameworks you can knit together to produce a video serving website.
Invariably this will require heavy involvement on all levels of the stack:
Server back-end will require the following problems to be solved:
Video Encoding
FFMPEG or MPlayer experience for encoding any number of video formats to either FLV or more recent h264 for HTML5 supported formats
A reliable mechanism to transcode video in a background process; initially on one server but eventually on multiple servers as your services scales
Video resizing
Bandwidth Management to throttle connection just enough so that the video trickles down to the user
Storing video files and a file sharding and naming mechanism
API Server - Something like Rails, Django or NodeJS Express to serve as a JSON service layer between web clients and the video encoding/serving service.
Front end will require the following issues to be solved:
Playing back the video reliably across multiple OSes (Windows, OSX, Linux, Tablets, Mobile) and Platforms (IE, Chrome/Safari, Firefox, Opera) with fallback support for older browsers
DRM - are your videos free or commercial? If the latter, this is another issue that needs to be addressed
I'd strongly recommend an Event Driven system on your back-end as it is much easier to develop code that supports concurrency. NodeJS would be a good pick. It is worth looking at node-fluent-ffmpeg module for NodeJS as a good starting point.
As for your front-end I'd recommend frameworks such as Backbone.js or AngularJS to develop you web-app.
It was a fun and challenging journey when I attempted something similar a few years ago. I wish you good fortune in your journey.

For a site like that, I guess will need to choose several tools to do the job.
For the web, you could use any framework, so rails would be OK, to deal with videos you'll need something like ffmpeg or transconding to convert the videos.
For streaming, if you can use HTML5 check this question otherwise you'll need a player whith flash fallback.
Remember that the heavy part in terms of storage and CPU is video compressing/conversion.

Related

All factors when live streaming in Swift?

I am attempting to make my app, this is an app that will integrate live streaming that could be accessed by anyone that is signed up. I have been searching and the information is very vague.
What factors do I have to take into consideration to make an IOS app with live streaming?
I would have no clue how to implement any of this and I haven't seen much documentation about how to implement this. What third party software would I have to use, would I need to create something in a different programming language?
This app is going to be only for IOS for now.
Thanks,
The question is, how many users? How much do you want to spend? How critical is performance/quality/downtime, etc.? Is this a business app?
Due to having multiple users connect to one stream, I would suggest that the streamer streams it to a server, whereby the server deals with the bandwidth requirements to clients, allowing for it to more easily scale. If it is a one-on-one or up to maybe one on three, you could still think of p2p for a social stream (e.g. streaming to family) but not e.g. a business conference (unless you want them to have e2e encryption, avoiding server, etc. which is usually complete overkill, though do implement encryption if possible, quite easy using libraries).
Now if you're asking coding wise, look for some tutorials, e.g. https://www.raywenderlich.com/5191-video-streaming-tutorial-for-ios-getting-started is quite nice, it's quite straight forward and will probably do what you want for the client accessing it. Use the AVFoundation Playback https://developer.apple.com/av-foundation/ it has links to HTTP live streaming and how to implement it as well.

Options for embedded video on website other than YouTube?

Been having trouble with YouTube lately with regards to autoplay, looping and playlists. Currently using the AS3 embedded player and it was working fine until recently when autoplay and playlist options became mutually exclusive. I am also finding the loop option doesn't work with autoplay.
So, looking at options other than YouTube as we will have access to the video anyway and can either upload or stream using whatever technology is appropriate. My application is for touchscreen interactive kiosks which will be largely unattended and I want to be able to run embedded video with all controls turned off to prevent anyone from jumping off to some other website at any point. This is crucial! I don't mind if a touch can pause the video like it does with YouTube but links must not be available to jump out.
My web app is written in Rails 3 with HTML, CSS3 and JQuery where required. It runs on IE8/9 on the kiosks and Safari mainly during development. I'm using Heroku.com for hosting.
Hopefully I've given enough background here to attract some good answers but please let me know if I've missed anything important.
Thanks for your time,
Craig.
This service is awesome in quality and price.
http://sublimevideo.net/
If you are using heroku for your hosting, you should take advantage of their add-on. The interface is super clean and you have full flexibility to mold playlists or behavior.
Panda Stream
http://addons.heroku.com/pandastream

Best way to add video uploading, encoding and streaming functionality to my Rails app?

What is the best way to add video uploading, encoding and streaming functionality to my Rails app ?
I'm thinking about a mix as : Rails app + Video Online Encoder + Amazon S3. What do you think ?
For the Video Online Encoder (VOE), which one is the easier to use with Rails : heywatch, panvidea, encoding.com, pandastream, ... ?
By the way, the application will allow users to play streamed videos with dynamic Texts, Schemas and Sounds added to them at the run time. There's an example :
in rails app (backoffice or frontoffice) : Video upload (.mov, .avi, ...)
VOE : video encoding in FLV format + storage in Amazon S3
in rails app, backoffice : in a home-made Flash application, "add" to the video a Text and a Schemas showed after 1 minute for example (informations stored in the Rails app DB).
in rails app, frontoffice : play the streamed video from Amazon S3 (+Cloudfront) in a home-made Flash player which show dynamicaly the Text and the Schema over the video after 1 minute of playing.
The part I really don't understand is the FLV video Stream. I was thinking that Cloudfront could do that.
I hope I'm clear enough ;-)
Thank you all for your answers !
Disclaimer: I am a co-founder for transloadit.com.
I would discourage you from rolling your own solution. The link alexy13 posted will certainly get you an application that can receive user videos and encode them. However, you'll end up with a few limitations:
Resized videos will be distorted unless their aspect ratio is 4:3. To avoid that you need to sniff their dimension before the conversion and then apply a set of padding -vfilters to ffmpeg. Sniffing the dimension correctly will require a cocktail of at least 2 command lines tools (ffmpeg itself and exiftool) + a bunch of crazy code to deal with display aspect ratios that differ from the pixel aspect ratios.
Not all videos will convert. Sometimes you need to do additional sniffing on the video content and set some custom flags, otherwise you'll receive an error. Granted, 95% of all videos will probably work - but getting those last 5% is hard.
You will need an additional web server that does the video encoding, otherwise your site will be very sluggish while a video is being encoded. You can work around this by using the nice command to limit the CPU resources used by ffmpeg, but that will result in significantly longer encoding times.
This is a short list of problems, but generally you are ~100 hours away from having a system that runs without hickups and can deal with some load.
So I would encourage you to re-consider going with a service. Our competitors are quite nice, but of course I'd also be very happy if you would check out our service (transloadit.com) or shoot me an email at felix.geisendoerfer#transloadit.com if you have any questions.
There is also a Rails3 sample application for using transloadit with paperclip and S3:
http://github.com/joerichsen/transloadit-paperclip-example
--fg
Zencoder looks cool and it probably has the API support you want. Use flash for the player I'm guessing? You will need FMS or Red5 for that. Here is a link to a really simple example that transcodes something stored in S3 for you, in Ruby of course!: http://zencoder.com/docs/integration-libraries/#library
I would feel skeptical using a free third party online service. I would consider using server-side video encoding because the third-party web service could have variable performance, and could do basically anything to the video. If you don't have many CPU's then a third-party service might be a good choice.
EDIT: This Link should help you a bit

How to add video chat capability to my rails application?

I've been googling about how to accomplish oneline chat for rails application and I've implemented a text chat version using Juggernaut. But for video chat, I only find flash&red5 might be a solution for me, but it's flash and java, which I'm relatively not good at. Is there a better solution?
I have researched this a little and the options are not great.
There are some nice-looking packages that cost real money. Tokbox.com, ooVoo (http://www.oovoo.com, looks free at first but free version has limits), VideoWhisper.com looks interesting -- they seem to sell a 2-way video chat package for a one-time fee, but it is PHP-based.
A simple Flash-based solution is definitely a good way to go. Flash has good video support and virtually everyone has it installed already. It's not that hard to learn enough Flash basics to do a simple 2-way video chat (see http://www.derekentringer.com/blog/fms-video-chat/ for an example of a trivial video chat script that is something like 30 lines of code). And you don't need to learn Java to use Red5 unless you want to customize it -- Red5 is the open-source video streaming server that makes it so you don't need to buy really a expensive Adobe Media Streaming server system. You just need to learn enough to set it up and get it running.
I'm certain there's an open-source or low-cost Flash script out there that handles a basic 2-way video chat, but I have yet to find it. If anyone does, please post it!
Here is a rails implementation of tokbox:
http://github.com/njacobeus/tokboxer/
Try using Raydash. There is a rails gem available at https://github.com/gersh/Raydash-Ruby-on-Rails. You just need to register at http://www.raydash.com to use it.

Embed video on a asp.net-mvc website

I will be embedding a video to my asp.net mvc website.
A video on the homepage which will help people to better understand the website.
I have never done this. Can anyone tell me whats the best way of doing it.
Flash or silverlight??
I've used JW FLV Media Player. I was pretty happy with it, and it's easy to use. Flash-based.
http://www.longtailvideo.com/
My suggestion would be to go with Flash and to achieve what you're looking for, utilize swfobject. It's really quite simple to use and has a bunch of options that will be useful when you get more used to using video.
I have had pretty good success using silverlight with the Silverlight 2 Video Player as an example. However, it depends on what your requirements are.
Pros to Silverlight:
Performs Video Streaming very well
Easier to develop/customize if you are a .NET developer
Works on a variety of browser and platforms
Cons to Silverlight:
Does not support every video media type (the example above only plays .WMV files, Silverlight in general supports .WMV and .MP4)
Is not installed on as many client machines (less penetration)
Is not as well known (users may be reluctant to install it compared to Flash)
Is not as popular so there are less solutions/resources out there
Here is another discussion on the topic.
I would go with flash for only one reason: the 99% (or whatever it is today) installed base.
Then go with swfobject or JW FLV Media Player as suggested in the other answers. There is also a jQuery plugin floating around somewhere that helps deal with flash video on a site.

Resources