Publish a local flv file to Flash Media Server through appendBytes - actionscript-3

Since i'm creating a stress tester for an FMS load balancer, i'd need to publish as many stream as i can , to see if the system will hold the load.
There's any way to send a local flv file through the NetStream.publish method?
After a little research, i found only the appendBytes solution, but it seems is not working.
Anyone has an example for this? or maybe a solution on how to fake a webcam so to send some bit of data.
Thank you all in advance.

Not sure if this will help you, but you could call functions on the server and pass large byte arrays (files, strings, whatever) as parameters.
Of course, this does not really count as a stream, but will put load on your server.
netConnection.call("functionName", responder(may be null), largeData)

Related

Is it possible to pass raw video frame TO a browser?

Is possible to pipe raw video frames to a browser/website? For instance the decoding could be done locally in Gstreamer, and then that could be forwarded somehow to a browser.
EDIT:
I realize that my description was a bit shaky. The use case I would like to have is to send encoded video to someone, decode it on their computer, do some advance filtering that cannot be done in the browser, and then pipe the frames to the browser. Obviously re-encoding it would just be a waste of time and energy.
All that I can find is ppl saying that video frames can be grabbed FROM a browser, no-one seems to be interested to SENT TO a browser. The horrible option could be to use webrtc and to re-encode the frames into VP8 and then to send it to the browser.
So my final question is whether it is possible to write to the rendering pipeline of a browser? I know next to nothing about web programming, I usually just deal with images and video.
Thank you for your support :)
PS: forgive my lack of knowledge, is it possible to have a client on someone's computer, writting to a local tcp port, and to access that tcp port from a website in the browser? (potentially asking the user to allow the connection?)
Yes, this is possible. Since you're running a local GStreamer pipeline, you might look into this project: https://github.com/Samsung/ChromiumGStreamerBackend Basically, they're using GStreamer as the native renderer in-browser.
Aside from that, you can create a browser extension which executes an application and gets data from Gstreamer, to shuffle to your application. https://developer.chrome.com/extensions/nativeMessaging
If you don't want to make an extension, you can instead create a small Web Socket server.
Either way, you can write the raw pixel data to a Canvas... no need to re-encode/decode the video. https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API

Netstream - how to publish an mp3 file using RTMFP

I want to publish a mp3 file from one of the peers and play it from other peers, very similiar to a RTMFP chat app.
From what I understand till now:
netstream.publish is used to publish a stream to RTMFP netconnection and netstream.play for playing a stream from other peers.
The steps for streaming mic and camera capture are:
netstream.attachCamera(cam);
netstream.attachAudio(mic);
netstream.publish('video');
However I don't see a way to publish (stream) mp3 files using Netstream. Note that using Netstream is essential since I want to "publish" audio to listening peers.
Please correct me if I was wrong above. Ideally what I want to achieve should be easily possible, yet I can't find any pointers for it. Is is possible to use ByteArray for the same. Any alternative streaming strategy would be welcome as long as it works with RTMFP. Links to code examples would be great too.
You stumbled upon one of the strange quirks of NetStream. It can publish sound from the microphone, but not from a arbitrary sound source. There is some workarounds, some more complex than the others.
Streaming through a virtual microphone. The easiest workaround, and the best (IMO) if your project allows you to use it. You just have to install a virtual microphone/camera software (ex : ManyCam) and use it to stream your mp3 file(s) through a virtual microphone. With that done, you just have to bind this microphone to your AS3 app. Sadly, it doesn't work for your project, since you can't reasonably ask of the publishing peer to install a virtual microphone.
Streaming usingSound.extract(), NetStream.send() and SampleDataEvent.SAMPLE_DATA. As you might know, NetStream.send() can be used to send messages to peers. The thing is, those messages are serialized and can be ByteArray. Thus, you can send audio data samples with NetStream.send(). The publishing pee apps can obtain the data samples with Sound.extract(), and the receiving apps can play them thanks to the SAMPLE_DATA event. One of the problems will be to know when you should send new samples. To manage that, you would recommend also using the SAMPLE_DATA in the publishing app and send new data each time the SAMPLE_DATA event occurs. The main issue with this method is that since you don't use the standard way of RTMP to stream audio, it needs a custom app for the receiver to play it. Given what you said of your project, it shouldn't be a problem.
Reproducing the RTMFP protocol using Socket. It would be long, very complex, and error-prone. I would never recommend to do this except perhaps as a learning experience. You would need to read, understand and implement most of the RTMFP Specification.

Recording output volume from machine using flash

I successfully created an application where i can record microphone sound using flash and then save that stream to a server called "Red5" .
But lately i came across a strange requirement of capturing the output volume from machine and then saving that stream to red5 server.Like if i listen to a song or a skype call or listening to any other sound.I just want to capture those sounds.
I searched for this sort of situation just to get an headstart but i havent found any solution so that i can proceed with it.
Can anyone here provide a start up solution for this.
Can this be done through flash?Or any other way ?
Any help will be appreciated.Please provide suggestions
Thanks
Certainly there are ways to get this done, however using Flash as is I don't see it being possible (most likely a security concern, don't want ads arbitrarily recording peoples conversations).
Programs like Audacity are capable of recording off of the StereoMix output of a computer which is essentially what you're asking about. You could potentially build an AIR app that includes an ANE that packages the functionality from Audacity, but would require quite a bit of porting and... well time.

Save sound from SoundChannel object AS3 Flash

I'm planning to program a small piano in flash that have an x number of notes to play through a SoundChannel.
What I have not found is a way to record what is playing through SoundChannel and send it as byteArray to a server side script that will save it as WAV (or mp3).
I know Flash Player 10.1 allows you to record sound, but everything I have found is about recording sound using the microphone class. It seems the way to go is to send the sound data to the microphone. That doesn't seem very right or possible though... But I don'r really know, has anyone had a similar idea and attempted to do it? Any possible solutions? Thank you!
If you listen for the SampleDataEvent.SAMPLE_DATA of the sound object then you can readBytes as they are played, and save it to a bytearray. Or use the extract method on the sound object to get the bytes.
You can send the bytes to a server for processing into a file. This answer might help with some of the details.
Also this thread might help even more: http://www.kirupa.com/forum/showthread.php?t=338647
From my experience it's not possible to record anything except through the microphone. Some other drawbacks that are related:
You can't send sound data to the microphone
You can't get the raw sound data from a microphone or from streaming.

Flash player breaks when loading .csv file with URLLoader

Greetings everyone...
I've made a little flash, with AS3, to view the data generated by some program I wrote... The data is in a .csv file and are loaded to the memory with a URLLoader object.
The flash loads well .csv files which can come to almost 50 MB in size... But when I try to load a file with 160 MB, the player just stop working... I run the last flash player version, outside of the browser...
I've heard that the Flash has limitations on the amount of memory it can store... But in another question, they say it has not.
What may be causing the crash? - I don't think it is the code, since it runs smooth for small files...
Thank you in advance!
I did some quick googling and it looks like URLLoader stores the download in memory so there could be some limitations. Another Stack Overflow answer recommends using URLStream along with FileStream. I'd think this would be the most appropriate way to deal with large files based on my experience on other platforms. Are you loading from an http:// or a file:// url?
Working with flash now, it came to me the error:
Error: Error #1502: A script has executed for longer than the default timeout period of 15 seconds.
In the menu File > Publish Settings..., we can make the timeout period longer on the Flash tab.
I also found an implementation of something like asynchronous processing in actionscript... It's a very interesting approach and I'll try to implement my loading method that way...
Thank you all for your help!