I'm looking for a way of taking an audio asset and jpeg from my app that are both stored on Amazon S3 and merge them into a video that's format will be accepted at Youtube. Basically, the song with static album artwork for the duration.
I've seen this post that refers to Ming-Ruby Create videos programatically? but i'm wondering if the Gem is active and maintained or if anyone else has experience of doing something similar and can offer some tips or alternative approaches?
You could look into using ffmpeg. Here's some examples of creating a video slideshow of images. http://ffmpeg.org/trac/ffmpeg/wiki/Create%20a%20video%20slideshow%20from%20images I'm sure you could find info out there on how to also add in audio. At that point you should just need to find a ffmpeg gem to wrap the calls you need to make or work directly with it via system calls (be careful with that though).
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.
I need suggestions for a good way to store backend song previews (right now looking at itunes and maybe spotify and soundcloud). The idea is that I need to pre-download and maybe cache the 30-second and less audio files with easy recall.
Then I need a good way of overlaying the audio preview to a user video quickly and generating a new asset for that.
I imagine there are already good libraries for these tasks.
I'm thinking S3 right now for storage? Maybe that or something else? Thanks in advance
Here's a couple of microservices that might help: audio and video if you're ok using a mBAAS.
When uploading a file I know I can access its properties but is it always the same or it varies? I mean, I am writing an app for myself where I can upload songs or videos to my server to watch later, and I'd like to populate the info about said files automatically as much as possible so I was wondering if it's possible to get things like length, quality, name, artists, artwork, or pick a first image like youtube does for its videos?
I'm fairly new to ruby (using rails) so I am unsure as to where to find this or if it's even possible
You can do that using FFMpeg (read the license first).
FFMpeg gives you everything you were asking about and some more.
it's very powerful.
For mp3, check out mp3-info, I haven't used it before but looks promising...
User can upload any video of any type... after that I need to convert this video to *.flv
How can I do this using RoR?
We do this with paperclip and ffmpeg. Paperclip allows you to add custom processors to a Paperclip attachment. We created such a processor which just calls ffmpeg on the command line to create the flash version of the video. ffmpeg even allows you to extract stills from the video for thumbnail representations.
With paperclip and ffmpeg and flvtool2
Have look at this gist with all you'll need. https://gist.github.com/507804
It has:
Video to thumbnails
Video to flash
Correct geometry calculations etc...
There are two ways to do it, yourself or hosted solution.
If you want to do it yourself, start with Bert's solution and go from there. Remember transcoding is CPU intensive, so you likely need to have a another server/on-demand instance doing this
If you want to go for a hosted solution, see Kaltura.com or encoding.com
sign up for pandastream - available as a heroku add-on as is zencoder
they're not cheap options though so maybe look around for something less costly first
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