[Red5] Relay stream from FMS through Red5

Jake Hilton red5 at jakehilton.com
Tue Jun 9 08:01:29 PDT 2009


Is there anyway if I can tell if this call is succeeding or failing?

STREAMS.get(s).pushMessage(null, (IMessage) streamPacket);

Thanks,
Jake

On Jun 9, 2009, at 8:16 AM, Jake Hilton wrote:

> The idea is to not have to pre-prevision servers to handle load for  
> a specific stream. Servers can be brought online as needed via spawn  
> API and then merely direct traffic to them and know that they will  
> pick up the correct stream.
>
> I think my next step is to test each aspect separately and see if  
> everything is working. I would assume that passing non audio and  
> video packets wouldn't cause a problem right?.. should I filter on  
> just audio and video packets?
>
> Thanks,
> Jake
>
> On Jun 8, 2009, at 7:47 PM, Andy Shaules wrote:
>
>> Seems to me using server side action script on FCS to publish to  
>> red5 would be all that is needed.
>>
>>
>> ----- Original Message -----
>> From: Jake Hilton
>> To: red5 at osflash.org
>> Sent: Monday, June 08, 2009 6:12 PM
>> Subject: Re: [Red5] Relay stream from FMS through Red5
>>
>> Yes.. with FMS it's easy to do what I'm trying to do and have done  
>> it with FMS. I'm  just trying to use red5 as a solution to offload  
>> some of the load. So the idea is to have red5 subscribe to an FMS  
>> stream and then broadcast it to clients that connect to red5. So  
>> more of red5 pulling the stream than FMS pushing it.
>>
>> So the audio and video packets seem to be getting recognized by  
>> red5.. but the StreamingProxy doesn't seem to be doing it's job...
>>
>> Jake
>>
>> On Jun 8, 2009, at 6:59 PM, Andy Shaules wrote:
>>
>>> I dont know if I missed something, but cant you just on flash Comm  
>>> Server use serverside actionscript to take the incoming netstream  
>>> and re-publish it?
>>>
>>> Im prettty sure it can be done that way too.
>>>
>>>
>>> ----- Original Message -----
>>> From: Jake Hilton
>>> To: red5 at osflash.org
>>> Sent: Monday, June 08, 2009 4:24 PM
>>> Subject: Re: [Red5] Relay stream from FMS through Red5
>>>
>>> I just tried that but no dice.. same result. It seems that the  
>>> messages aren't getting pushed out because no packets are being  
>>> received on the FMS end.
>>>
>>> Jake
>>>
>>> On Mon, Jun 8, 2009 at 5:21 PM, Jake Hilton <jakehilton at gmail.com>  
>>> wrote:
>>> I have this method:
>>>
>>> public void broadcastPacket(IStreamPacket streamPacket)
>>> {
>>> String s="test_out";
>>>
>>> switch(streamPacket.getDataType())
>>> {
>>> case FLVData.TYPE_VIDEO:
>>> log.info("found video type");
>>> //          
>>> ((VideoData 
>>> )packet 
>>> ).setTimestamp 
>>> (Integer.valueOf(Red5.getConnectionLocal().getAttribute("time", 
>>> 0).toString()));
>>> break;
>>> case FLVData.TYPE_AUDIO:
>>> log.info("found audio type");
>>> //         Red5.getConnectionLocal().setAttribute("time", 
>>> ((AudioData)packet).getTimestamp());
>>> break;
>>> default:
>>> break;
>>> }
>>>
>>> Which when run it does trace out that it's of type audio or  
>>> video.. but I'll try just a straight re-broadcast.
>>>
>>> Thanks,
>>> Jake
>>>
>>> On Jun 8, 2009, at 5:12 PM, Andy Shaules wrote:
>>>
>>>> what if in
>>>>  public void broadcastPacket(IStreamPacket streamPacket),
>>>> streamPacket is already an RTMPMessage? can you push it out as is?
>>>>
>>>>
>>>> ----- Original Message -----
>>>> From: Jake Hilton
>>>> To: red5 at osflash.org
>>>> Sent: Monday, June 08, 2009 3:09 PM
>>>> Subject: Re: [Red5] Relay stream from FMS through Red5
>>>>
>>>> So rather than have it play a static file on the box.. I'm having  
>>>> red5 subscribe to and play a live feed I'm streaming to fms. I'm  
>>>> seeing the subscriber (red5) attach fine and start to play the  
>>>> stream. I also see red5 connect to a separate fms (fms 2.0)  
>>>> instance to publish .. and while it does say it's publishing  
>>>> there is no data and no error messages.
>>>>
>>>> Anyway we can ensure the packets that I"m forwarding on have the  
>>>> right data in them?
>>>>
>>>> Maybe the method "onStreamBytesRead" in the rtmpClient would  
>>>> work.. but that never get's called.
>>>>
>>>> Any other ideas of what I might try?.. seems like this has been  
>>>> done before but I can't connect the two pieces.
>>>>
>>>> Thanks for all your help.
>>>> Jake
>>>>
>>>>
>>>> On Jun 8, 2009, at 2:51 PM, Andy Shaules wrote:
>>>>
>>>>> try another codec set  and try by publishing from the fp plugin.
>>>>> ----- Original Message -----
>>>>> From: Jake Hilton
>>>>> To: red5 at osflash.org
>>>>> Sent: Monday, June 08, 2009 1:12 PM
>>>>> Subject: Re: [Red5] Relay stream from FMS through Red5
>>>>>
>>>>> So I'm almost at my wits end... Is there anyway I can verify the  
>>>>> packets coming in are formatted correctly for that type I'm  
>>>>> casting them as? I am publishing the stream under the proper  
>>>>> name.. but it seems to be missing the correct content.
>>>>>
>>>>> So close yet so far away.
>>>>>
>>>>> Jake
>>>>>
>>>>> On Mon, Jun 8, 2009 at 11:59 AM, Mondain <mondain at gmail.com>  
>>>>> wrote:
>>>>> It shouldn't matter, I've run vp6,vp6e,vp6s flvs through red5.
>>>>>
>>>>> Paul
>>>>>
>>>>>
>>>>> On Mon, Jun 8, 2009 at 9:41 AM, Jake Hilton  
>>>>> <red5 at jakehilton.com> wrote:
>>>>> Not sure if it matters.. but the video being played and packets  
>>>>> replayed is of type vp6 with mp3 audio.
>>>>>
>>>>> Video: vp6f, yuv420p, 640x360, 29.97 fps(r)
>>>>>  Audio: mp3, 22050 Hz, stereo, 64 kb/s
>>>>>
>>>>> Thanks,
>>>>> Jake
>>>>>
>>>>>
>>>>> On Mon, Jun 8, 2009 at 10:34 AM, Jake Hilton  
>>>>> <red5 at jakehilton.com> wrote:
>>>>> I feel like I'm pretty close.. so I have the following:
>>>>>
>>>>> public void startServerStream()
>>>>>     {
>>>>>         streamProxy = new StreamingProxy();
>>>>>         streamProxy.init();
>>>>>         streamProxy.setApp("huddle");
>>>>>         streamProxy.setHost("localhost");
>>>>>         streamProxy.setPort(1935);
>>>>>         streamProxy.start("test_out");
>>>>>
>>>>>         STREAMS.put("test_out", streamProxy);
>>>>>
>>>>>     }
>>>>>
>>>>>     public void dispatchEvent(IEvent arg0)
>>>>>     {
>>>>> //        log.info("dispatch event");
>>>>> //        log.info(arg0.toString());
>>>>>
>>>>>         // TODO Cast these IEvents to type IPacket and  
>>>>> rebroadcast using streamingProxy
>>>>>         broadcastPacket((IStreamPacket)arg0);
>>>>>     }
>>>>>
>>>>>     public void broadcastPacket(IStreamPacket streamPacket)
>>>>>     {
>>>>>         String s="test_out";
>>>>>
>>>>>         try
>>>>>         {
>>>>>             log.info("re-broadcasting packet");
>>>>>             RTMPMessage msg= new RTMPMessage();
>>>>>             msg.setBody((IRTMPEvent)streamPacket);
>>>>>
>>>>>             STREAMS.get(s).pushMessage(null,(IMessage)msg);
>>>>>         }
>>>>>         catch (IOException e){
>>>>>             log.info("re-broadcasting packet failed");
>>>>>             STREAMS.get(s).stop();
>>>>>         }
>>>>>     }
>>>>>
>>>>>
>>>>> I see a bunch of events saying it's re-broadcasting the packet..  
>>>>> but yet when I load a player to connect and play "test_out" the  
>>>>> player loads and connects and says it's playing it.. but I don't  
>>>>> see/hear anything.. am I missing a piece of the puzzle somewhere?
>>>>>
>>>>> Thanks,
>>>>> Jake
>>>>>
>>>>>
>>>>> On Mon, Jun 8, 2009 at 9:48 AM, Andy Shaules <bowljoman at hotmail.com 
>>>>> > wrote:
>>>>> ahh haaa, looks like allthose IEvents's can be cast and re-  
>>>>> broadcast out of the streamProxy.
>>>>> ----- Original Message -----
>>>>> From: Jake Hilton
>>>>> To: red5 at osflash.org
>>>>> Sent: Monday, June 08, 2009 8:44 AM
>>>>> Subject: Re: [Red5] Relay stream from FMS through Red5
>>>>>
>>>>> So I've been messing with two methods:
>>>>>
>>>>> public void dispatchEvent(IEvent arg0) {
>>>>>         // TODO Auto-generated method stub
>>>>>         log.info("dispatch event");
>>>>>         log.info(arg0.toString());
>>>>>     }
>>>>>
>>>>> This outputs a ton like this:
>>>>>
>>>>> 2009-06-08 09:40:01,875 [NioProcessor-3] INFO   
>>>>> c.e.webapps.huddle.Application - dispatch event
>>>>> 2009-06-08 09:40:01,875 [NioProcessor-3] INFO   
>>>>> c.e.webapps.huddle.Application - Video  ts: 0
>>>>> 2009-06-08 09:40:01,876 [NioProcessor-3] INFO   
>>>>> c.e.webapps.huddle.Application - dispatch event
>>>>> 2009-06-08 09:40:01,876 [NioProcessor-3] INFO   
>>>>> c.e.webapps.huddle.Application - Video  ts: 0
>>>>> 2009-06-08 09:40:01,877 [NioProcessor-3] INFO   
>>>>> c.e.webapps.huddle.Application - dispatch event
>>>>> 2009-06-08 09:40:01,877 [NioProcessor-3] INFO   
>>>>> c.e.webapps.huddle.Application - Audio  ts: 0
>>>>> 2009-06-08 09:40:01,877 [NioProcessor-3] INFO   
>>>>> c.e.webapps.huddle.Application - dispatch event
>>>>> 2009-06-08 09:40:01,877 [NioProcessor-3] INFO   
>>>>> c.e.webapps.huddle.Application - Video  ts: 33
>>>>> 2009-06-08 09:40:01,877 [NioProcessor-3] INFO   
>>>>> c.e.webapps.huddle.Application - dispatch event
>>>>> 2009-06-08 09:40:01,877 [NioProcessor-3] INFO   
>>>>> c.e.webapps.huddle.Application - Audio  ts: 26
>>>>>
>>>>> Would that be at all what we could use?
>>>>>
>>>>> Also I've been trying to get this to work but it doesn't seem to  
>>>>> being called:
>>>>>
>>>>> public void onStreamBytesRead(RTMPConnection conn,Channel  
>>>>> channel,Header source,BytesRead streamBytesRead)
>>>>>     {
>>>>>         log.info("on stream bytes read event");
>>>>>     }
>>>>>
>>>>>
>>>>> Thanks again for all your help.
>>>>>
>>>>> Jake
>>>>>
>>>>> On Thu, Jun 4, 2009 at 3:10 PM, Andy Shaules <bowljoman at hotmail.com 
>>>>> > wrote:
>>>>> Im not 100% familiar with RTMP client but somewhere you are  
>>>>> receiving a ton of packets of you are playing the stream, so  
>>>>> take those, and push them with streaming proxy to local host.
>>>>>
>>>>> IStreamListener is only for IBroadcastStream.
>>>>> ----- Original Message -----
>>>>> From: Jake Hilton
>>>>> To: red5 at osflash.org
>>>>> Sent: Thursday, June 04, 2009 1:38 PM
>>>>> Subject: Re: [Red5] Relay stream from FMS through Red5
>>>>>
>>>>> I'm extending the rtmpClient but implementing the  
>>>>> IStreamListener in that class. I guess I assumed the class that  
>>>>> implemented that listener would get the call. Do I need to do an  
>>>>> assignment to specifically listen?
>>>>>
>>>>> On Thu, Jun 4, 2009 at 1:35 PM, Andy Shaules <bowljoman at hotmail.com 
>>>>> > wrote:
>>>>> Yeah, what stream did you add a listener to?
>>>>>
>>>>> IStremListener is after you add one.
>>>>>
>>>>> Is there another method in the rtmp client you can override to  
>>>>> get the packet events?
>>>>> They should be streaming in.
>>>>>
>>>>>
>>>>> ----- Original Message -----
>>>>> From: Jake Hilton
>>>>> To: red5 at osflash.org
>>>>> Sent: Thursday, June 04, 2009 12:27 PM
>>>>> Subject: Re: [Red5] Relay stream from FMS through Red5
>>>>>
>>>>> I think I have it all setup properly.. the stream starts to play  
>>>>> however the packetRecieved method never get's fired off... am I  
>>>>> missing something?
>>>>>
>>>>> public class StreamManager extends RTMPClient implements  
>>>>> INetStreamEventHandler, IPendingServiceCallback,  
>>>>> ClientExceptionHandler, IEventDispatcher, IStreamListener
>>>>> {
>>>>>
>>>>> public void packetReceived(IBroadcastStream arg0, IStreamPacket  
>>>>> packet) {
>>>>>         // TODO Auto-generated method stub
>>>>>
>>>>>         log.info("packet recieved");
>>>>> }
>>>>>
>>>>> }
>>>>>
>>>>>
>>>>>
>>>>> Thanks,
>>>>> Jake
>>>>>
>>>>> On Thu, Jun 4, 2009 at 12:20 PM, Andy Shaules <bowljoman at hotmail.com 
>>>>> > wrote:
>>>>> Use streaming proxy. and push each packet out.
>>>>> Below, STREAMS is a List<String, StreamingProxy>.
>>>>>
>>>>> public
>>>>>
>>>>> void packetReceived( IStreamPacket packet) {
>>>>> String s="published name";
>>>>>
>>>>> try
>>>>>
>>>>> {
>>>>> RTMPMessage msg=
>>>>>
>>>>> new RTMPMessage();
>>>>> msg.setBody((IRTMPEvent)packet);
>>>>>
>>>>>
>>>>> STREAMS.get(s).pushMessage(null,(IMessage)msg);
>>>>> }
>>>>>
>>>>> catch (IOException e){
>>>>>
>>>>> STREAMS.get(s).stop();
>>>>> }
>>>>>
>>>>> }
>>>>> ----- Original Message -----
>>>>> From: Jake Hilton
>>>>> To: red5 at osflash.org
>>>>> Sent: Thursday, June 04, 2009 11:05 AM
>>>>> Subject: Re: [Red5] Relay stream from FMS through Red5
>>>>>
>>>>> The playing is working.. I'm just not sure now how to get what  
>>>>> is playing into rtmpClient into a serverStream... help?  :)
>>>>>
>>>>> Jake
>>>>>
>>>>> On Thu, Jun 4, 2009 at 10:48 AM, Mondain <mondain at gmail.com>  
>>>>> wrote:
>>>>> It should work, so long as all the Red5 <> FMS communications  
>>>>> are working.
>>>>>
>>>>> Paul
>>>>>
>>>>> On Thu, Jun 4, 2009 at 9:30 AM, Jake Hilton  
>>>>> <red5 at jakehilton.com> wrote:
>>>>> Would this work?
>>>>>
>>>>> Red5 plays the stream from FMS.
>>>>> Create a serverside stream and add that stream red5 is playing  
>>>>> as a playlist item.
>>>>> Initiate the serverStream.play command.
>>>>>
>>>>> Clients can then connect and play the serverStream?
>>>>>
>>>>> Jake
>>>>>
>>>>>
>>>>> On Thu, Jun 4, 2009 at 7:34 AM, Jake Hilton  
>>>>> <red5 at jakehilton.com> wrote:
>>>>> Good day all.
>>>>>
>>>>> I'm embarking on trying to use red5 as stream relay from an FMS  
>>>>> server. I was just wondering if I should look into a serverside  
>>>>> stream to accomplish this? I would be playing a stream from an  
>>>>> FMS server but exposing it as a stream to clients of the red5  
>>>>> box... does that make sense?
>>>>>
>>>>> I am just wondering which pieces of red5 I'd have to use to  
>>>>> accomplish this. I've checked the net as well as this lists  
>>>>> history.. but didn't find much to go on.
>>>>>
>>>>> Thanks in advance for any help.
>>>>>
>>>>> Jake
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> Red5 mailing list
>>>>> Red5 at osflash.org
>>>>> http://osflash.org/mailman/listinfo/red5_osflash.org
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> -- 
>>>>> http://gregoire.org/
>>>>> http://osflash.org/red5
>>>>>
>>>>> _______________________________________________
>>>>> Red5 mailing list
>>>>> Red5 at osflash.org
>>>>> http://osflash.org/mailman/listinfo/red5_osflash.org
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> Red5 mailing list
>>>>> Red5 at osflash.org
>>>>> http://osflash.org/mailman/listinfo/red5_osflash.org
>>>>>
>>>>> _______________________________________________
>>>>> Red5 mailing list
>>>>> Red5 at osflash.org
>>>>> http://osflash.org/mailman/listinfo/red5_osflash.org
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> Red5 mailing list
>>>>> Red5 at osflash.org
>>>>> http://osflash.org/mailman/listinfo/red5_osflash.org
>>>>>
>>>>> _______________________________________________
>>>>> Red5 mailing list
>>>>> Red5 at osflash.org
>>>>> http://osflash.org/mailman/listinfo/red5_osflash.org
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> Red5 mailing list
>>>>> Red5 at osflash.org
>>>>> http://osflash.org/mailman/listinfo/red5_osflash.org
>>>>>
>>>>> _______________________________________________
>>>>> Red5 mailing list
>>>>> Red5 at osflash.org
>>>>> http://osflash.org/mailman/listinfo/red5_osflash.org
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> Red5 mailing list
>>>>> Red5 at osflash.org
>>>>> http://osflash.org/mailman/listinfo/red5_osflash.org
>>>>>
>>>>> _______________________________________________
>>>>> Red5 mailing list
>>>>> Red5 at osflash.org
>>>>> http://osflash.org/mailman/listinfo/red5_osflash.org
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> Red5 mailing list
>>>>> Red5 at osflash.org
>>>>> http://osflash.org/mailman/listinfo/red5_osflash.org
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> -- 
>>>>> http://gregoire.org/
>>>>> http://code.google.com/p/red5/
>>>>> http://code.google.com/p/blue5/
>>>>>
>>>>> _______________________________________________
>>>>> Red5 mailing list
>>>>> Red5 at osflash.org
>>>>> http://osflash.org/mailman/listinfo/red5_osflash.org
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> Red5 mailing list
>>>>> Red5 at osflash.org
>>>>> http://osflash.org/mailman/listinfo/red5_osflash.org
>>>>> _______________________________________________
>>>>> Red5 mailing list
>>>>> Red5 at osflash.org
>>>>> http://osflash.org/mailman/listinfo/red5_osflash.org
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> Red5 mailing list
>>>> Red5 at osflash.org
>>>> http://osflash.org/mailman/listinfo/red5_osflash.org
>>>> _______________________________________________
>>>> Red5 mailing list
>>>> Red5 at osflash.org
>>>> http://osflash.org/mailman/listinfo/red5_osflash.org
>>>
>>>
>>>
>>>
>>> _______________________________________________
>>> Red5 mailing list
>>> Red5 at osflash.org
>>> http://osflash.org/mailman/listinfo/red5_osflash.org
>>> _______________________________________________
>>> Red5 mailing list
>>> Red5 at osflash.org
>>> http://osflash.org/mailman/listinfo/red5_osflash.org
>>
>>
>>
>> _______________________________________________
>> Red5 mailing list
>> Red5 at osflash.org
>> http://osflash.org/mailman/listinfo/red5_osflash.org
>> _______________________________________________
>> Red5 mailing list
>> Red5 at osflash.org
>> http://osflash.org/mailman/listinfo/red5_osflash.org
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://osflash.org/pipermail/red5_osflash.org/attachments/20090609/c48b5b10/attachment-0001.html>


More information about the Red5 mailing list