Skip navigation
Huy Mai
Currently Being Moderated

Live Streaming from static video file

Apr 15, 2012 8:18 PM

Hi everybody,

 

I'm using Amazon Cloud & Flash MMedia Server 4.5.
I would like to take one of my exits videos (a static file), and turn it into a live stream. People can view this video (synchronous). I'm using Flash Media Live Encoder 3.2, but it only capture video from devices as camera...

How I can do it?

 

Cheers.

 
Replies
  • Currently Being Moderated
    Apr 15, 2012 11:37 PM   in reply to Huy Mai

    Hi Huy,

    For your issue there are several routes availiable:

     

    1. You can provide input to FMLE using a DVD player and a sound card and then your FMLE will publish this stream from DVD player to FMS like a live stream.

    2. Alternatively, you can install the Development Edition of FMS on your local machine, write a Server-Side Action Script cpde that can publish this stream to your FMS hosted on your cloud.

    3. Alternatively, put the tatic file as VoD, but am not sure if that is your valid use case.

    4. Alternatively, you can use tools like manycam to get the video stream, and a sound card to capture the audio and publish it to FMS using FMLE, but I believe it will run into synchronization issues.

     

    Please see if any of these options are viable and then probably we can help you more if you run into some other issues while using these alternative methods.

     

    Regards,

    Shiraz Anwar

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 16, 2012 3:40 AM   in reply to Huy Mai

    Hi Huy,

    Please find the zip attached where I have written the scripts for you to deploy on your local FMS server, in context of option 2:

    You may like to follow these steps:

     

    1. unzip the folder.

    2. deploy FLVpublishonLoad (in case your recorded file is a FLV use case) on your lcoal server

    3. deploy toPublish on your remote aws server

    4. make sure to correct the path for aws in FLVPublishonLoad application @ line#19:

     

    // Please mention your aws instance hostname instead of localhost , and application name ....
    nc.connect("rtmp://localhost/toPublish");

     

    5. go to admin console of your local development server and load the instance of FLVPublishonLoad as shown in the howtoLoadfromAdminConsole.png image attached for refrence purpose.

    6. it will automatically connect to the "toPublish" app on your remote server and start publishing your local vod file as a live stream to your aws instance

    7. start your subscriber app and subscribe to the stream you have used in FLVPublishonLoad app for Stream.get() method, see line#29 and the subscriberScreenExample.png file attached for the illustration purpose.

     

    few points to note here:

     

    1. I have removed the sample.flv and "sample1_1500kbps.f4v" for keeping the zip size lower.

    2. You need to put your stream name at line#55 where you call mystream.play()

    3. The stream name that you specify in Stream.get() will be used by subscribers.

    4. if your use case is mp4, then please use "MP4PublishonLoad" instead of "FLVPublishonLoad" application.

     

    =============

    As I am unable to attach the files here therefore copy-pasting the code for you and others to be re-used:

    =======

     

    main.asc code for FLVPublishonLoad:

    --------------------------------------

     

    var nc;

    var ns;

     

    application.onAppStart = function()

    {

        trace("hello client: ");

        publishIt();

     

    }

     

     

     

    function publishIt()

    {

        trace("publishing");

        nc = new NetConnection();

       

        // Please mention your aws instance hostname instead of localhost , and application name ....

        nc.connect("rtmp://localhost/toPublish");

       

        nc.onStatus = function(info)

        {

            trace(info.code);

        }

       

        ns = new NetStream(nc);

       

        // Exact stream name available for subscribers .....

        mystream = Stream.get("myvodfile");

       

           

           

        mystream.onStatus = function(sinfo)

        {

            trace("mystream.onStatus: "+sinfo.code);

            if(sinfo.code == "NetStream.Publish.Start")

            {

                attach_retVal = ns.attach(mystream);

               

                if(attach_retVal==true)

                   

                    {

                        trace("stream attach was successful ...");

                        startPublish();

                    }

               

                else

                {

                    trace("The attempt to attach stream source to NetStream failed");

                }

            }

        }

       

        // Please put the stream name here inside double-quotes that you want to publish and is available there in streams/_definst_ folder ......

        mystream.play("sample",0,-1,true);

       

    }

     

    function startPublish()

    {

        ns.publish(mystream.name,"live");

    }

     

    --------------------------------------

     

     

    main.asc code for MP4PublishonLoad:

    --------------------------------------

     

    var nc;

    var ns;

     

    application.onAppStart = function()

    {

        trace("hello client ");

        publishIt();

     

    }

     

     

     

    function publishIt()

    {

        trace("publishing");

        nc = new NetConnection();

       

        // Please mention your aws instance hostname instead of localhost , and application name ....

        nc.connect("rtmp://localhost/toPublish");

       

       

        nc.onStatus = function(info)

        {

            trace(info.code);

        }

       

        ns = new NetStream(nc);

       

        // Exact stream name available for subscribers .....

        mystream = Stream.get("mp4:myvodfile.f4v");

       

           

           

        mystream.onStatus = function(sinfo)

        {

            trace("mystream.onStatus: "+sinfo.code);

            if(sinfo.code == "NetStream.Publish.Start")

            {

                attach_retVal = ns.attach(mystream);

               

                if(attach_retVal==true)

                   

                    {

                        trace("stream attach was successful ...");

                        startPublish();

                    }

               

                else

                {

                    trace("The attempt to attach stream source to NetStream failed");

                }

            }

        }

       

        // Please put the stream name that you want to publish and is available there in streams/_definst_ folder ......

        mystream.play("mp4:sample1_1500kbps.f4v",0,-1,true);

       

    }

     

    function startPublish()

    {

        trace("#### " + mystream.name);

        ns.publish("mp4:" + mystream.name,"live");

    }

     

     

    --------------------------------------

     

    main.asc code for "toPublish" app

     

    =====================

     

    application.onPublish = function(clientObj, streamObj)

    {

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

    }

     

    =====================

     

     

    Please revert back to me in case of further query.

     

    Regards,

    Shiraz Anwar

     

    howtoLoadfromAdminConsole.png

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 16, 2012 3:43 AM   in reply to Shiraz Anwar
     
    |
    Mark as:
  • Currently Being Moderated
    Apr 19, 2012 8:32 AM   in reply to Huy Mai

    Hi Huy.

    Please find your answers below:

    1. You can put "FLVPublishonLoad" or "MP4PublishonLoad" on your AWS and make sure they connect with "toPublish" as localhost. Also, streams that you want to publish should be there in respective streams folder.

    2. Subscriber app is a client application where you can view the published streams, you are correct, it may be an osmf player, you need to paste the link as  rtmp://myhost/toPublish/streamname, streamname should be same as you have used in Stream.get() method e.g. in my case it is myvodfile

    3. if you are using a playlist, and playing all the streams in a single streamobject, they all will be recorded in a single file e.g. myvodfile in above case. If you are recording all of the different streams in single stream object, you need to make sure these all different files are encoded similarly, e.g. bitrate, framerate, filesize dimensions should be similar, otherwsie resulting myvodfile may be unpredicatable.

     

    Regards,

    Shiraz Anwar


     
    |
    Mark as:
  • Currently Being Moderated
    Apr 19, 2012 11:20 PM   in reply to Huy Mai

    Thanks for the confirmation Huy,

    Good to know that these steps solved your problem ....

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 26, 2012 1:54 PM   in reply to Shiraz Anwar

    Hi Shiraz,

     

    I trying to do the same thing as Huy Mai, publishing videos on the server as a live stream. i don't see and attached files in this thread. Could you also please provide me more information on how i manage the playlist and how to install the files you provided.

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 26, 2012 9:40 PM   in reply to ravichandrach

    Hi Ravi,

    You can look at the correct answer above, it has all the necessary code for yuor purpose. Just in case, if you want to have zip file, pelase send me your mail id as a private msg and I will forward it to you.

    Regards,

    Shiraz Anwar

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points