Wowza Community

Pulling an http stream to push via rtmp

We’re trying to pull http streams from Limelight, repackage them as rtmp, and push them back to Limelight using the Push-Publish module. The code example I have has me creating an onPublish() method that pushes the stream. I’m assuming this means the http streams would have to pushed to the Wowza server in order to trigger the onPublish(). What I need to do is to pull the streams. How do I accomplish this?

Wowza does not support http ingress but you can use VLC in between:

https://www.wowza.com/docs/how-to-use-vlc-as-a-live-stream-encoder-with-wowza-media-server-mpeg-ts).

Look at the Transcode examples at the bottom. You can swap the RTSP input with the HTTP URL.

vlc -vvv [url]http://domain.com/streamname[/url] --sout "#transcode{venc=x264{keyint=60,profile=baseline,level=3.0,nocabac},vcodec=x264,vb=150,scale=0.5,acodec=mp4a,ab=96,channels=2,samplerate=48000}:rtp{dst=127.0.0.1,port=10000,mux=ts}"

Richard

Wowza can re-stream shoutcast/icecast from http, is an exception.

Richard

Follow this tutorial:

https://www.wowza.com/docs/how-to-re-stream-audio-from-shoutcast-icecast

Richard

You should start the stream in StreamManager or /conf/StartUpStreams.xml with MediaCaster type “shoutcast” to kick off the push publisher.

Wowza MediaCaster system has built-in monitor that will keep trying to reconnect. There is this optional Advanced Monitor:

https://www.wowza.com/docs/how-to-enable-advanced-monitoring-and-resetting-of-mediacaster-streams

With push publish, when re-connect succeeds, that should push another stream. JW Player has live stream reconnector for this kind of case.

Richard

Do this:

PushPublisher.setRemoveDefaultAppInstance(true);

Richard

I’m confused. I was able to get Wowza to pull an http stream (the stream is a never-ending mp3) and return it as an rtmp stream, so Wowza can clearly pull a stream. What I need is to have Wowza push the result to Limelight, since Limelight can’t pull it. I figure the must be a way to tell Wowza to pull a stream and, using Push-Publish, push it to Limelight.

I’m sorry. The streams we’re talking about are icecast. How do I get Wowza to pull the stream and push it as rtmp?

Follow this tutorial:

https://www.wowza.com/docs/how-to-re-stream-audio-from-shoutcast-icecast

Richard

I think I get it. I need to create a file in the content directory, containing the url of the icecast stream, for each of the streams. When the system comes up, my onPublish() method will get called for each stream.

If one of the icecast stream goes down, how does it recover when it comes back up?

The documentation for the Push-Publish left out a step. How does the system get my module class? My guess has been that I package it in a jar and stick it in the lib directory.

I’m attaching the source for my onPublish() method. Does it look right?

public void onPublish(IMediaStream stream, String streamName, boolean isRecord, boolean isAppend)

{

try

{

IApplicationInstance appInstance = stream.getStreams().getAppInstance();

synchronized(publishers)

{

PushPublisherRTMP publisher = new PushPublisherRTMP();

// Source stream

publisher.setAppInstance(appInstance);

publisher.setSrcStreamName(streamName);

// Destination stream

publisher.setHostname(streamName + “.pri.XXX.fmspush.llnw.net”);

publisher.setPort(1935);

publisher.setDstApplicationName(“XXX”);

publisher.setDstStreamName(streamName);

publisher.setSendFCPublish(true);

publisher.setSendReleaseStream(true);

PushPublishRTMPAuthProviderLimelight limelightRTMPAuthProvider = new PushPublishRTMPAuthProviderLimelight();

limelightRTMPAuthProvider.init(publisher);

limelightRTMPAuthProvider.setUserName(“XXX”);

limelightRTMPAuthProvider.setPassword(“XXX”);

publisher.setRTMPAuthProvider(limelightRTMPAuthProvider);

publisher.connect();

}

}

catch(Exception e)

{

WMSLoggerFactory.getLogger(null).error("ModulePushPublishSimpleExample#StreamNotify.onPublish: "+e.toString());

}

}

I’ve been able to get this most working. I’m down to one problem. I can’t figure out how to get it not to insert definst in the push URL. Here is the output from the server.

INFO stream publish http://xxx.ic.llnwd.net/stream/xxx_stream_1 -

INFO server comment - ShoutCastReceiver.init: shoutcastMP3GroupCount:4

INFO server comment - VHost.startStartupStreams: Stream successfully started [live/definst]: flv:http://xxx.ic.llnwd.net/stream/xxx_stream_1

INFO server comment - Wowza Media Server is started!

INFO server comment - PushPublisher.sessionOpened[rtmp://fmspush.sjc.llnw.net:1935/xxx/definst/xxx_stream_1]:

INFO server comment - PushPublisher.resetConnection[rtmp://fmspush.sjc.llnw.net:1935/xxx/definst/xxx_stream_1]: com.wowza.wms.plugin.pushpublish.protocol.rtmp.PushPublisherRTMPSession@3a835d

INFO server comment - PushPublisher.sessionClosed[rtmp://fmspush.sjc.llnw.net:1935/xxx/definst/xxx_stream_1]

INFO server comment - PushPublisher.sessionOpened[rtmp://fmspush.sjc.llnw.net:1935/xxx/definst/xxx_stream_1]:

INFO server comment - ShoutCastReceiver.internalConnect: http://xxx.ic.llnwd.net:80/stream/xxx_stream_1

INFO server comment - ShoutCastDecoder.checkHeader[http://xxx.ic.llnwd.net/stream/xxx_stream_1]: HTTP OK

Do this:

PushPublisher.setRemoveDefaultAppInstance(true);

Richard

No change. Here’s my code:

public void onPublish(IMediaStream stream, String fullStreamName, boolean isRecord, boolean isAppend)

{

try

{

IApplicationInstance appInstance = stream.getStreams().getAppInstance();

synchronized(publishers)

{

int pos = fullStreamName.lastIndexOf("/");

String streamName = fullStreamName.substring(pos + 1);

PushPublisherRTMP publisher = new PushPublisherRTMP();

// Source stream

publisher.setAppInstance(appInstance);

publisher.setSrcStreamName(streamName);

// Destination stream

publisher.setHostname(“fmspush.sjc.llnw.net”);

publisher.setPort(1935);

publisher.setDstApplicationName(“xxx”);

publisher.setDstStreamName(streamName);

publisher.setRemoveDefaultAppInstance(true);

publisher.setSendFCPublish(true);

publisher.setSendReleaseStream(true);

PushPublishRTMPAuthProviderLimelight limelightRTMPAuthProvider = new PushPublishRTMPAuthProviderLimelight();

limelightRTMPAuthProvider.init(publisher);

limelightRTMPAuthProvider.setUserName(“xxx”);

limelightRTMPAuthProvider.setPassword(“xxx”);

publisher.setRTMPAuthProvider(limelightRTMPAuthProvider);

publisher.connect();

}

}

catch(Exception e)

{

WMSLoggerFactory.getLogger(null).error("ModulePushPublishSimpleExample#StreamNotify.onPublish: "+e.toString());

}

}