Skip to main content
Participating Frequently
April 9, 2013
Question

How to get live stream name

  • April 9, 2013
  • 1 reply
  • 2620 views

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 has been closed for replies.

1 reply

April 9, 2013

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

Participating Frequently
April 9, 2013

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.

April 9, 2013

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.