1

I have a website working the same as youtube. At this moment I am trying to create a video image captured by WEBCAM. The video image should be saved on my computer (by FLV format) first and then if the user is satisfied, he or she can upload it on the server

I am trying to use Actionscript3 in Adobe flash CS5 and Flash media server4

1- How can I do that? 2- Is the flash media server needed?

Please pay attention that we would like to allow the user to save video on his/her computer and then be able to uploaded to the server.

Many thanks.

M.Yazdian
  • 67
  • 4
  • 11

2 Answers2

0

Assuming the computer can take the overhead of doing the encoding on the fly (or has enough memory to buffer the data then can run the data through an encoding process) then the library mentioned in the SO answer here should work: Encode video from any format to .flv format in AS3

I believe the Flash media server would only really be necessary in this case for broadcast.

Pseudocode example

private var cam:Camera;

public function Whatever()
{
    //In constructor
    addEventListener(Event.ENTER_FRAME, grabFrame);

    cam = Camera.getCamera(); 
    if (cam != null) 
    { 
        var vid:Video = new Video(cam.width, cam.height); 
        vid.attachCamera(cam); 
        addChild(vid); 
    }
}
private function grabFrame(event:Event):void
{
     var bd:BitmapData = new BitmapData(cam.width, cam.height)
     bd.draw(vid);
     //now the BitmapData has a frame of the video, at this point you also
     //would want to capture the audio then use the FLV class in the library
 }
Community
  • 1
  • 1
shaunhusain
  • 19,630
  • 4
  • 38
  • 51
  • Using a Video object you attach the Camera object to the Video. Using BitmapData's draw method you can take "snapshots" of the Video instance... I'll do some pseudocode up top. – shaunhusain Apr 09 '13 at 09:16
  • On the address provided above (Encode video from any format to .flv format in AS3) I read: There's a FLV encoder AS3 library.It requires image bytes and audio bytes for a frame. But you will have to get image data and sound data somewhere. You play the video in flash and grab 'screenshots'. please advise how can play the video in flash and grab 'screenshots' I read: But everyone uses a server-side script to convert videos, This will be the simplest, fastest solution. Please advise how can we convert video formats into FLV format (the articles I looked in did not help) meny thanks – M.Yazdian Apr 09 '13 at 09:42
  • I would say your best bet really, is to go with a server side solution... I have played a bit with FMS, but it's been a while so the details are fuzzy, but I know you can have it accept a connection with a NetStream and will encode FLV files. There's an open source alternative I've heard good things about, but you'll have to work out the details yourself as I don't have any examples of this kind of work: http://www.red5.org/ – shaunhusain Apr 09 '13 at 09:46
  • You could even potentially use Red5 on the client machine but I'm not sure about the legal implications of packaging Red5 with your application so you may need to just link to it and have instructions for the end user to configure things. – shaunhusain Apr 09 '13 at 09:49
  • Ugg been falling behind on this stuff... so apparently Alchemy is now FlasCC if you're interested in trying the client side solution but in any case dealing with video encoding is never a simple task: http://gaming.adobe.com/technologies/flascc/ – shaunhusain Apr 09 '13 at 10:02
0

You can also check out using Red5 as an alternative open source video stream recorder.

http://distriqt.com/post/493

Cheers

Michael
  • 3,776
  • 1
  • 16
  • 27
  • Hi michael, It is better I use the server streaming in the windows OS. because I've written the other application in .Net platform for my project. Thanks for suggestion – M.Yazdian Apr 10 '13 at 07:39