12 Replies Latest reply on Dec 28, 2012 4:20 PM by ospn2012

    question about live streaming screen capture




      at my office we conduct live video broadcasts using widows media encoder, and we're working on moving away from it to a newer method, which most likely will be something flash related.


      how the procedure is done today is that a user logs in the windows media encoder program, starts the broadcast, the broadcast starts building an asf file in the server people watch, our users get the link and they join. once the broadcast is finished, the host that did the broadcast exits and saves the file, in the video server. the broadcast is a screen capture presentation of what a host has in his computer.


      I want to achieve this or something similar, using a broadcast on flash streaming, so that both, users can log to a link we provide to them, the video server saves the file (preferably as .flv) and of course the broadcast is done nice and smoothly without interruptions or gaps (or at least with a minimum amount).


      my question would be,


      what process do you guys use to broadcast ? say other members. I'm talking about a simultanous broadcast for about 200 people, I guess it's similar to the numbers that you handle.


      I'm pretty wide open on slight modifications on the process, such as maybe the host of the broadcast, saving the broadcast file in his computer and uploading it into the video server afterwards, although I would pprefer of course if it's pushed directly.


      resources that I have available:


      we have a windows media server -the one we're using right now, and we also have an adobe flash media server, with full license. we have a flash encoder but so far we haven't been able to figure out how to maintain a screencapture broadcast. it works, but only for about 2 minutes and then the player stops reproduction of the broadcast, however the encoding still goes on.


      so, while you can answer my request, if you can talk about your broadcasting experience, on broadcasting screen capture...


      I am open to all recommendations and suggestions, and I am thankful to all your responses.

        • 1. Re: question about live streaming screen capture
          SE_0208 Adobe Employee

          The use case you mentioned is very much possible using FMS. I will give you brief workflow here of how you need to go about it:


          You will need a screen capture device basically a video filter that allows capturing of computer screen which can be recognized by FMLE. FMLE is Flash Media Live Encoder which publishes input stream to Flash Media Server.


          Since you want recording too at server-end, you could server-side record of the incoming stream from FMLE and make it available DVR way to your clients.


          So FMLE takes input from capture filter, publishes it to any application on FMS , application has code which does server-side recording, recorded file gets created , user has option to subscriber to live or DVR stream (record in progress file)


          I will try to give more details about it in my next post but let me know if this suits you.

          • 2. Re: question about live streaming screen capture
            SE_0208 Adobe Employee

            Below are two screen capture filters whuch you can use:






            Please install them and they will get listed in Video Device filter in FMLE.


            If you don't have FMLE install , please install it from here :http://www.adobe.com/products/flashmediaserver/flashmediaencoder/


            Server-side recording can be achieved by using following code:


            application.onPublish = function(myClient,myStream){






            application.onUnpublish = function(myClient,myStream){






            I would suggest you can use dvrcast apps for better and simplified working and taking load from you to manage how to go about server-side aspect

            You can find dvrcast apps here: http://www.adobe.com/products/flashmediaserver/tool_downloads/ - DVRCAST APPLICATION FOR FLASH MEDIA INTERACTIVE SERVER 3.5 ( i am assuming you have Flash Media Server 3.5 or above - if not please let me know and i would see how we develop solution with your needs)


            Try this out first and let me know if you want more details.

            • 3. Re: question about live streaming screen capture

              thank you for your response,


              yes we have flash media server and last week we started a few tests using flash media encoder with camtasia and another program called VH something, I think it's the one you mentioned. we started the broadcast with camtasia and for some reason it wouldn't work; with the other program it worked with the server creating a new file and building it in size as the broadcast went on going.


              we noticed that flash encoder would make them available as devices to select to record.


              I had my laptop watching the broadcast from outside the network and it would effectively work too, but at around the 2minute 2 minute 30 second mark, the reproduction would stop, I don't know why, I'm guessing the player is not good enough ?


              anyway, yes we have flash encoder and server, so so  far I understand what you mean.


              now questions, where do I add the code your giving to me ?.... I didn't understand that part.


              what will DVR cast exactly do regarding managing data in the server ?


              my key problem as right now is:



              guarantee a secure non stop broadcast for at least 30 minuntes up to an hour. (note, the broadcast doesn't stop, it's the playing that halts).


              and authentication for hosts that are going to perform the broadcast (not mandatory but preferable).


              thanks so far for all your help, I definetlly would like to see this to be solved .

              • 4. Re: question about live streaming screen capture
                SE_0208 Adobe Employee

                You add the code at server end. Basically you need to create an application (basically a folder or directory) under "applications" folder for FMS (you can find it under you installed directory). Lets say we name it as "test". So under "test" you need to create a file name main.asc and put the code which i had given. (You can just create a text file , paste the code there and change its extension from .txt to .asc.


                I was talking about dvrcast apps, as Adobe has already developed ready-to-use applications for DVR workflow and you can use them directly without building your own app. You just need to place them under "applications" directory.



                To answer why your playing halts, are you using you own client application for subscribing, if yes please make sure your ns.play is of this kind ns.play("livestream",0,-1,true) for DVR or ns.play("livestream",-1,-1,true) for live stream


                Let me know if you have more queries.


                There is authentication add-in which comes with FMLE, you can use it for authenticating hosts.

                • 5. Re: question about live streaming screen capture
                  Adobe Matt

                  Thank you for the code, but where do you put it?


                  Server-side recording can be achieved by using following code:


                  application.onPublish  = function(myClient,myStream){






                  application.onUnpublish  = function(myClient,myStream){






                  I have FMS Developer version 3.5. I use the Flash Media Live Encoder 3.


                  I have a VOD directory and a LIVE directory in my Applications. I can get streaming and I can get video on demand.


                  Where do I add code to get the stream from FMLE3 to be recorded on the server? Can I give the file a name and set its location?


                  Rather beyond me. I have seen many references to it, but no one gives WHERE to put the code.

                  • 6. Re: question about live streaming screen capture
                    SE_0208 Adobe Employee

                    Just create a new folder say "myapp" in applications directory of FMS (same directory where you find Live and VOD applications). Then inside "myapp" folder , create a file named "main.asc" and put the code there.


                    Now you should connect your FMLE to "myapp" to publish and you work should be done

                    • 7. Re: question about live streaming screen capture
                      Randall Perry

                      Was looking for a way to do this, capturing stream on the server.


                      I created the app and it works like a charm.


                      Question: is there a way to code FMS to move the file into the /vod/media directory after the stream ends, or is this something that should be done manually, or with shell scripts (on Linux).

                      • 8. Re: question about live streaming screen capture



                        Can you share your code for your solution and please tell me if you found a solution for moving the file to /vod/media directory.


                        Thanks in advance.

                        • 10. Re: question about live streaming screen capture
                          rickzki Level 1

                          That's assuming you have AMS Professional or Enterprise, correct? What if you only have AMS Standard? Would one end up having to manually post-process the f4v files to mp4 and moving them to the VOD media directory?


                          Where I work , we're trying to augment our current streaming video solution (SIRE Video+, which relies on Windows Media Services) with a more cross-platform solution. When a meeting is stopped in SIRE Video+ it is automatically saved to a VOD directory in a format that is immediately available for consumption.


                          With AMS and FMLE, I'm discovering that not only do I have to manually post-convert the file to mp4 (since f4v can't be consumed via HTTP on iOS), I also have to move that resulting file to the correct archive location. Is there any way other than writing a PowerShell script to watch a particular folder, call the post-processing executable, and then having it moved to a specific directory for archival / VOD purposes, if  you're running AMS Standard?


                          Additionally, is there any planned update to FMLE that will allow it to save directly to mp4 without having to post-process the file?


                          Alternatively, are there any software encoding / rtmp solutions other than FMLE that have a richer feature set and that can stream to AMS Standard?




                          Message was edited by: rickzki

                          • 11. Re: question about live streaming screen capture
                            ospn2012 Level 1

                            FileCopyTo(); works fine in the onUnpublish(); application in main.far. I can post an example along with onPublish(); creating a timestamp of the f4f file before it is copied too /livepkgr/store. The directory also needs added to Application.xml "<VirtualDirectory>store/</VirtualDirectory>" as well for the livepkgr application has access rights to the folder.  You must turn off fragment/segment duration where the livepkgr application creates only 1 fragment .f4f when in &adbe-record-mode=record string is passed from FMLE.  the 1 fragment .f4f can be immediately played back through the vod service by soft symlink to the application/livepkgr/store directory to /application/media/ directory with proper permissions set. Also you must modify the Application.xml in the VOD service to add the soft sym link to the /store directory so that Apache doesn't forbid the connection through RTMP VOD service.

                            Hope this helps.

                            • 12. Re: question about live streaming screen capture
                              ospn2012 Level 1



                              application.onPublish = function(clientObj, streamObj)


                                      var objToday = new Date(),

                                      weekday = new Array('Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday


                                      dayOfWeek = weekday[objToday.getDay()],

                                      domEnder = new Array( 'th', 'st', 'nd', 'rd', 'th', 'th', 'th', 'th', 'th', 'th' ),

                                      dayOfMonth = streamTimestamp + (objToday.getDate() < 10) ? '0' + objToday.getDate() + domEnder[

                              objToday.getDate()] : objToday.getDate() + domEnder[parseFloat(("" + objToday.getDate()).substr(("" + o

                              bjToday.getDate()).length - 1))],

                                      months = new Array('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'S

                              eptember', 'October', 'November', 'December'),

                                      curMonth = months[objToday.getMonth()],

                                      curYear = objToday.getFullYear(),

                                      curHour = objToday.getHours() > 12 ? objToday.getHours() - 12 : (objToday.getHours() < 10 ? "0"

                              + objToday.getHours() : objToday.getHours()),

                                      curMinute = objToday.getMinutes() < 10 ? "0" + objToday.getMinutes() : objToday.getMinutes(),

                                      curSeconds = objToday.getSeconds() < 10 ? "0" + objToday.getSeconds() : objToday.getSeconds(),

                                      curMeridiem = objToday.getHours() > 12 ? "PM" : "AM";

                                      var streamTimestamp = curHour + curMinute + curSeconds + curMeridiem + "_" + curMonth + "-" + d

                              ayOfMonth + "-" + curYear + "_" +clientObj.ip;

                                      streamObj.savename = streamTimestamp;



                                      // a race can happen during republish. if onPublish is called

                                      // before onUnpublish, we need to wait for onUnpublish to

                                      // complete before calling onPublish for the new stream.

                                      if (streamObj.publishing == true)


                                              // onUnpublish has not been called yet

                                              //trace("Unpublish pending...");

                                              streamObj.publishingClient = clientObj; // save and call onPublish later



                                      streamObj.publishing = true;



                                      trace("onPublish : " +streamObj.name+ " with File Time Stamp: " +streamTimestamp);




                              application.onUnpublish = function(clientObj, streamObj)


                                      trace("onUnpublish : " + streamObj.name);

                                      trace("onUnpublish : " + clientObj.ip);



                                      var s = application.s[streamObj.name];

                                      if (s && s!= undefined)




                                              s.liveEvent = "";

                                              application.s[streamObj.name] = null;


                                      var fileObject = new File("streams/_definst_/"+streamObj.name+"/"+streamObj.name+"Seg1.f4f");



                                              trace("This Publish was successfully copied to : " +application.name+"/store/"+streamOb