What's the easiest way to merge video, audio and image files? - ruby-on-rails

We are planning a Wep App for a Hackathon that's happening in about 2 weeks.
The app basic functions are:
The users are guided step-by-step to upload a video, audio and image.
The image is used as a cover for the audio. Making it into a video file.
The two video files are merged thus creating a single video from the initial three files.
So, my problem is:
How do you create a video from an audio with an image as "cover".
How do you merge this two videos.
We are thinking of using Heroku for deployment. Is there a way to do it using something like stremio?
What would be the best approach? A VPS running a C++ script? How's the easiest way to do it?

FFMPEG would be a good start as seen here
https://stackoverflow.com/a/6087453/1258001
FFMPEG can be found at http://ffmpeg.org/
Also another option that maybe over kill would be Blender 3d as it could also provide simular results and could be controlled via shell commands and maybe more flexible in terms of complexe needs for asset compositions.
In any case your gonna want a server that can run heavy rendering processes wich will require a large amount of ram and cpu processing. It maybe a good choice to go with a render farm that can run gpu as the main processor for rendering as that will give you more bang for your buck but could be very difficult to set up and kept running correctly. I would also say a VPS would not be a good choice for this. In any case the type of resources your gonna need also so happen to be the most expensive in terms of web server costs. Best of luck please update with your results.

Related

What kind of drum sampling options does Audiokit have?

Working in audio kit and I am looking to understand how people have incorporated drums. Obviously, the sampler is an option, but I am wondering if there is a built in option similar to some of the basic synthesis options.
There are a few options. I personally like the AppleSampler/MidiSampler like in the example but instead of using audio files you can create a EXS Sampler instrument in Logic where you can assign notes for different velocities. AppleSampler can also load AUPresets made in GarageBand and SoundFonts (SF2). The DunneAudioKit Sampler is an option if you are working with SFZ files, but I think that might be a work-in-progress in AudioKit 5. Loading WAV files directly into AppleSampler is also a good option if you just want one shot sounds.
I'm assuming you're mostly talking about playback of samples, not recording.
The best built-in option I've seen (other than AppleSampler/MidiSampler) is AudioPlayer, which lets you load in a sample and play it back on demand (from an on-screen pad, etc). MIDIListener can then help you respond to external MIDI events, etc. It works (I have a pretty big branch in my app where I tried it), but not sure it works well.
I wouldn't recommend DunneAudioKit Sampler for drums. There is no one-shot playback (so playing the same note in quick succession will cut off the previous note, even if you mess with the release). If you're trying to build a complex/realistic acoustic drum instrument, you'll also want round-robins so that variations of the same hit can be played, which Dunne also doesn't have. It can load SFZ files, but only a very limited subset of SFZ's opcodes (so again, it's missing things like round robins, mute groups, one-shot, etc).
Having gone down all those roads, I would suggest starting with AppleSampler, and I would build the EXS or aupreset file in Logic or Mainstage rather than trying to build something programmatically.
If your needs are really simple, the examples in AudioKit's recently released drum pad playground is a great place to start, loading single samples into a specific note on AppleSampler.

how to read video file and split it into frames for android

My goal is as follows: I have to read in a video that is stored on the sd card, process it frame for frame and then store it in a new file on the SD card again,In each image to do image processing.
At first I wanted to use opencv for android but I did not seem to be able to read the video
here.
I am guessing you already know that doing this on a mobile device or any compute limited devices is not ideal, simply because video manipulation is very computer intensive which translates to slow execution and heavy battery usage on many devices. If you do have the option to do the processing on the server side it is definitely worth considering.
Assuming that for your use case you need to do it on the mobile device, then OpenCV on Android will now allow you to read in a video and access each frame - #StephenG mentions this in his answer to the question you refer to above.
In the past, functionality like this did not get ported to the Android OpenCv as the guidance was to use ffmpeg for frame grabbing on Android devices.
According to more recent documentation, however, this should be available for Android now using the VideoCapture class (note I have not used this myself...):
http://docs.opencv.org/java/2.4.11/org/opencv/highgui/VideoCapture.html
It is worth noting that OpenCV Android examples are all currently based around Eclipse and if you want to use Studio, getting things up an running initially can be quite tricky. The following worked for me recently, but as both studio and OpenCV can change over time you may find you have to do some forum hunting if it does not work for you:
https://stackoverflow.com/a/35135495/334402
Taking a different approach, you can use ffmpeg itself, in a wrapper in Android, for tasks like this.
The advantage of the wrapper approach is that you can use all the usual command line syntax and there is a lot of info on the web to help you get the right parameters.
The disadvantage is that ffmpeg was not really designed to be wrapped in this way so you do sometimes see issues. Having said that it is a common approach now and so long as you choose a well used wrapper library you should at least have a good community to discuss any issues you come across with. I have used this approach in a hand crafted way in the past but if I was doing it again I would use one of the popular examples such as:
https://github.com/WritingMinds/ffmpeg-android-java

Stream multiple media sources from a single software/hardware encoder?

It's been a while since I first started looking into this and I still haven't found any feasible solutions, here's to hoping someone might have some suggestions/ideas...
The situation: We currently have a couple of live streams streaming mixed source content (some of the streams are being streamed as file playlists that are modified to change the files in the playlist, while others are streamed as live video directly from input). For each new live stream we usually just end up setting up a new streamer... it's feels rather counterproductive and wasteful.
The question: Does there exist a hardware or software solution (LINUX or Windows) that would allow to live stream multiple, for example, two (independent of each other) file playlists and optionally one or two live A/V inputs, from the same encoder?
According to my findings, with the help of FFMPEG library, it is possible to stream multiple live A/V inputs and even stream file playlists ... but it requires too much hacking to get it working and playlists have to be redone by hand and restarted every time changes have been made. This might work for me personally, but this won't do for a less tech-sawy people...
I'm basically looking for a way to reduce the computer hardware instead of allowing it to exponentially grow with each addition of a new live streaming source/destination.
Thank you for all your input and all the posted solutions. By sheer luck I found the solution I was originally looking for.
For anyone else looking for this or similar solution, the combo of systems that can combat our unusual requirements (and that can be integrated into our existing workflow by adjusting the hardware/software to meet our needs instead of us adjusting to hardware/software requirements/limitations) are: Sorenson Squeeze Server 3.0, MediaExcel Hero Live and MediaExcel File

Video content heavy website

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.

What is the best way to stream opencv IplImage* video on a webpage?

I have a sequence of IplImage objects coming from a webcam, apply some processing, and I would like this video to be shown on a webpage. What is the best way to do this?
rossb As far as I know opencv has no support for streaming of opencv videos though there has been attempts to stream video over TCP using Sockets but that would not be the best way to implement for a webapp
I was able to do this with the following "hack"
1) set up an amazon aws account to use their S3 service.
2) Create an s3 "bucket". And continuously update the file (use the same name each time) into the bucket. Make sure you set the metadata attribute for no-cache and permissions for everyone to view.
3)create a simple web page where the JavaScript updates the every second (or what u prefer).
This is pretty bandwidth heavy and haven't tested at any scale. Since it's amazon, I'm not worried that things will fall apart when I scale traffic. However, users won't be happy with their bandwidth consumption. But it is free for up to 2000 puts and 20000 gets per month.
Next I want to figure out how to stream properly w codecs, etc, and am pulling my hair out figuring out a solution.
I'm happy to provide my source iOS client and JavaScript) but I'm on a train now. If you are truly interested ping me so I remember when I'm at my desk...
You could make your own webserver. Implementing just the basic GET command should be very simple. If you're using a .net language, things should be very easy for you.

Resources