I've seen a lot of good example applications using the carrierwave gem for image uploading. I've not seen any for video uploading.
Can anyone share an example / demo Rails application using carrierwave and the ffmpeg gem (streemio-ffmpeg) or another video processing gem?
Thanks for sharing.
Answering my own question here, I would still really like to see some examples if anyone else cares to contribute. In the mean time there's these two:
https://github.com/zencoder/dreamlive (by Zencoder guys, a heroku app)
http://www.nickdesteffen.com/blog/video-encoding-with-uploadify-carrierwave-and-zencoder (uses uploadify [flash - argh...] but still useful overall. Found a couple of things have had to be changed as time has gone by but a lot of info is in there.)
Both are quite useful but not ideal. They use Zencoder which is not a video processing gem - it's just helps with the Zencoder API. Zencoder is a paid-for product by the people behind rVideo, one of the more comprehensive gems I noticed when on my ffmpeg hunt.
In then end I've decided that the cost of Zencoder is inconvenient but not as inconvenient as my server going down etc if I were to badly integrate my own in house video processing. I'm accepting this answer but it's not the best.
Related
I need any idea to do this with javascript in ruby on rails application.
I want the user to upload a video, then the file has to be shortened from either start or finish. The purpose of that is to make the video smaller in size.
Then the video should be uploaded to server.
I have looked at https://github.com/danielcebrian/rangeslider-videojs but maybe someone knows a better solution
For uploading I have looked at FFmpeg, for cropping the video server side.
First off I should point out that if the editing process needs user interaction in the browser then this is not a simple problem, it's pretty complex and there's a lot of ways you could do it.
Uploading is a pretty easy part nowadays, as the built in rails ActiveStorage module works pretty well.
Now, if you don't need to edit videos in the browser, just want to clip them down to a specific size, then that is not too bad. You can indeed just have rails call ffmpeg with system. The -ss option is the flag you need, it's for cropping video.
If you do need user editing of videos in browser then you'll need to investigate a good JavaScript plugin for this, because it's not something that is going to be quick to write by hand.
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
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.
I'm currently learning rails by creating a simple project management app. I've gotten to the point where I would like to be allow a user upload multiple files - pdfs, docs, xls etc. The user only needs to be able to attach one file at a time, but the possibilty to have multiple documents associated with a project is a must.
I've spent quite a lot of time researching my options, and it appears the two main plugins are attachment_fu and paperclip. From what I've read though, these appear to concentrate specifically on the upload and subsequent resizing of images, something I couldn't care less about. Is there a simpler way to achieve what I'm trying?
Thank you all in advance.
You might still consider using attachment_fu or paperclip as those are the "standard" libraries for such tasks. And they work fine for any kind of file.
The multi-upload can't be made without JS or Flash now. You need add some hack in your view to manage it.
this is quite a difficult topic by all accounts. I am building a website that requires users to upload large (multi-GB). What is the best way allow users to upload a file on a website and allow the file upload to be resumed should it fail? What is the way to write this in rails?
Any ideas greatly appreciated.
Max.
No browsers support resuming uploads.
From my Googling, Flash doesn't seem to, either.
Though I don't know enough about Java to say it's impossible, there don't seem to be any pre-rolled upload solutions that support this method.
In short, you would have to code your own out-of-browser/plugin solution. If that is not feasible, you may have to abandon this feature. Sorry!
EDIT: Actually, after using a better search query, here's a Java solution that seems to support this through partitioning the initial file: JumpLoader. Here is the documentation page for resuming downloads. Best of luck! (You will note that there are purchase links - this is only for an unbranded version, and for the source code. You can use the JumpLoader branded version for free.)
No browser support this, In fact this cannot be done over HTTP.
You will have to write your own java applet, ActiveX control or WPF browser application to achieve this. Any of this will speak to a TCP server listening on the server side to achieve pause-and-resume upload of file.
Six years since you asked, but for future viewers, take a look at ResumableJS. It uses HTML5 File API to break uploads into chunks. They also include a RoR example for accepting the upload.