views:

83

answers:

3

Hi,

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 :

  1. in rails app (backoffice or frontoffice) : Video upload (.mov, .avi, ...)
  2. VOE : video encoding in FLV format + storage in Amazon S3
  3. 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).
  4. 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 !

A: 

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

alexy13
Thx. Can you advice me some server-side video encoding working nicely with Rails ? Do you think my solution (Rails+VOE+S3) will be to complex to develop / maintain ?
Fro_oo
*Edited question*. I think it sounds good to me, the online video encoder (as I mentioned above) I feel a little skeptical about it.
alexy13
Thx for the Link, I'll try that..
Fro_oo
I've tried... it's a bit to complicated to get a professional and persistent solution without a lot of time -)
Fro_oo
A: 

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 [email protected] 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

felixge
Thx for your answer. I agree, I will not made my own encoder. I'll rather go with a VOE as I've said. Transloadit sounds nice too and the pricing fair enough. :-) My main problem is about the streaming part. Do you think I can use Transloadit + S3 + CloudFront + myOwnCustomFlashPlayer and enjoy a real video streaming ? I think it's possible but I really need a confirmation from an expert ;-) http://www.learningapi.com/streamingmedia-articles/amazon-cloudfront-streaming/
Fro_oo
Yes, in fact one of our customers is doing exactly that: Transloadit + S3 + CloudFront + FlowPlayer -> http://www.tvype.com/en/market . CloudFront handles the streaming perfectly, so you can skip within the video.
felixge
A: 

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

Preston Marshall
Thx! Yes I'll create a small Flash App to display streamed videos. I was thinking that Amazon CloudFront could stream the FLV movie, but if I understand well, I still need a streaming solution on my Rails server ?
Fro_oo
I don't THINK so, but I've never played with it myself. You might be able to get flash to load an flv remotely, but it won't be a stream (so it wont support seeking without buffering first), so the user experience will suffer.
Preston Marshall
Damn! Manage to create that streamed Videos App is more difficult that I've thought in the first place :-) But what about this : http://www.learningapi.com/streamingmedia-articles/amazon-cloudfront-streaming/ Isn't that a real video stream through CloudFront without FMS/Red5 on my Server ?
Fro_oo
If you look at the example code, you will see the RTMP protocol mentioned, this means its streaming somehow.
Preston Marshall