views:

268

answers:

2

I am in the process of building a rails/flex application which requires audio to be recorded and then stored in our amazon s3 account. I have found no alternative to using some form of RTMP server for recording audio through flash, but our hosting environment will not allow us to install anything like FMS, Red5, etc.

Is there any existing Ruby/Rails RTMP solution that will allow audio recording? If not, is it possible for Rails to at least intercept the RTMP stream and then I can hope to reference red5's source or something for parsing the data (long shot, I know)?

The other alternative I can think of is hosting a red5 server on another host and communicating with our rails app once the saving/uploading is done, which is not preferred.

Am I going to have any luck here?

A: 

I was able to get this to work

1) Flash Player 10.1 can get the microphone's ByteArray

2) I captured this ByteArray, used Adobe's WavWriter class (from a microphone tutorial they put together) to create a new ByteArray in proper wav format

3) Sent this over to rails through RubyAMF

4) Used something along the lines of

wav_data = rubyamf_params[0][:wav_data]

f = File.new('c:/hello.wav')
f << wav_data.pack('c'*wav_data.length)
f.close

Once I've got this wav data it won't be too far of a stretch to convert it to an mp3, woo

Lowgain
A: 

Good idea about wav, but don't forget about traffic. WAV takes about 700kbit/s for one stream. It is more, than simple video stream!

When there will be at least 5-10 clients, you will need to switch to streaming server. Btw, check erlyvideo, it will consume less CPU/memory, than Red5.

Max Lapshin