Skip to main content
Participating Frequently
Apr 9, 2013 4:03 AM UTC
Question

How to get live stream name

Dear all!

I use ffmepg to push a livestream to my flash media server. Then I want to catchup live stream to file.

/opt/ffmpeg-1.1.1/bin/ffmpeg -i udp://238.1.1.2:1234 -filter:v yadif -acodec libfaac -ac 2 -ar 44100 -b:a 96k -af volume=5 -b:v 1000k -c:v libx264 -preset fast -pix_fmt yuv420p -s 720x476 -r 25 -threads 0 -t 300 -f flv "rtmp://10.84.70.120/dvrcast_origin/vtv22"

After, I create an application that main.asc file is:

application.onConnect = function (){

        name = Stream.name();

        stream = Stream.get(name);

        if(stream){

        stream.record();

        }

}

I can not catch live stream to file.

Can you show me how to get a live stream name?

Thanks!

This topic is closed to new replies. Start a new post to keep the conversation going.

11 replies

Apr 9, 2013 4:34 AM UTC

Hi,

If you want to record your livestream into a file on disk you can try this -

 

application.onPublish = function(clientObj,streamObj){

  trace("          in application publish : " + streamObj.name);

          streamObj.record("record");

}

 

application.onUnpublish = function(clientObj,streamObj){

trace("          on unpublish : " + streamObj.type + ":" + streamObj.name);

streamObj.record(false);

}

Let me know if this helps.

Thanks,

Apurva

Translate
Participating Frequently
Apr 9, 2013 5:11 AM UTC

Thanks Apurva!

I've copy your suggest to file that name is main.asc

But not ok. Can you show me step by step to record a live stream?

I am a fresher with FMS.

Translate
Apr 9, 2013 5:16 AM UTC

Here is the full code for main.asc:

application.onConnect=function(clientObj){

          trace("          on connect ");

          return true;

};

 

application.onDisconnect=function(clientObj){

          trace("          on disconnect ");

};

 

application.onPublish = function(clientObj,streamObj){

  trace("          in application publish : " + streamObj.name);

          streamObj.record("record");

}

 

application.onUnpublish = function(clientObj,streamObj){

trace("          on unpublish : " + streamObj.type + ":" + streamObj.name);

streamObj.record(false);

}

Let me know if this works.

Translate