msgbartop
Various ramblings-on, mostly about Red5
msgbarbottom

16 May 12 Ivy and Maven

I’ve added some xml to hopefully support Maven and Ivy projects that use Red5 as a dependency just a little better. The group id is “org.red5″ and the artifact id is “red5-server” or “red5-client”. For Ivy, add this pattern to your ivysettings.xml:

<artifact pattern="http://red5.googlecode.com/svn/repository/[organisation]/[artifact]/[revision]/[artifact]-[revision].[ext]" />

For your ivy.xml here are the dependency entries:

<dependency org="org.red5" name="red5-server" rev="1.0-RC2" />
<dependency org="org.red5" name="red5-client" rev="1.0-RC2" />

For Maven use this repository:

<repository>
  <id>Red5</id>   <url>http://red5.googlecode.com/svn/repository</url>
</repository>

and these dependency entries:

<dependency>
  <groupId>org.red5</groupId>
  <artifactId>red5-server</artifactId>
  <version>1.0-RC2</version>
</dependency>

<dependency>
  <groupId>org.red5</groupId>
  <artifactId>red5-client</artifactId>
  <version>1.0-RC2</version>
</dependency>

Tags: , ,

17 Jan 12 Android Market

I have created pro version of my broadcaster app for Android and Blackberry (playbook). The pro version allows for FMS or Red5 authentication as well as selection of all available cameras / microphones. The next two things I’ll be adding are i10n/i18n and h.264; the latter may not be possible in mobile air but I’ll give it a go.

Pro: https://market.android.com/details?id=air.org.gregoire.mobile.BroadcasterPro

Free: https://market.android.com/details?id=air.Broadcaster

The free version probably won’t be seeing any updates since I hate working on it in Flash CS5.

Lastly, If there’s enough interest I’ll do a version for iOS.

Update 1/18/12

I got h264 publish working in Android last night! woot! What a pain that was.. I need to verify that all is well with the stream data and my modifications to the application then I’ll put the update in the market.

Update #2 1/18/12

The latest pro build is up on the market 1.0.3, it allows you to stream h.263 or h.264 from your Android device. Enjoy!

 

Tags: , , , , , , , ,

19 Jul 11 Dynamic streaming with Red5

I will dub this feature beta only because I’m not sure that my handling or signaling is “exactly” right yet. The latest revision is now 4245 and those of you with the skills may use this version to stream like the pros do with FMS and Wowza.. dynamically! Be aware that Q0S is not implemented yet so hold your bugs saying it doesn’t work for now.  The following transitions are currently supported:

  • NetStreamPlayTransitions.RESET – Clears any previous play calls and plays the specified stream immediately.
  • NetStreamPlayTransitions.APPEND – Adds the stream to a playlist and begins playback with the first stream.
  • NetStreamPlayTransitions.APPEND_AND_WAIT – Builds a playlist without starting to play it from the first stream.
  • NetStreamPlayTransitions.SWITCH – Switches from playing one stream to another stream, typically with streams of the same content.
  • NetStreamPlayTransitions.SWAP – Replaces a content stream with a different content stream and maintains the rest of the playlist.
  • NetStreamPlayTransitions.STOP – Stops playing the streams in a playlist.

With any new feature there will be bugs, so bare with us and we’ll get them fixed up as soon as possible. Post any issues (with test code if you have some) to the issue tracker.

Lastly, without the help of Dan Rossi and Abhinav Kapoor’s post (http://www.adobe.com/devnet/flashmediaserver/articles/dynstream_actionscript.html) this would have been a much longer endeavor. Mucho gracias to Infrared5 for allowing me to work on this and other Red5 features. All the testing so far was accomplished with Flowplayer v3.2.6.

12 Jul 11 Red5 fixes galore

In the last couple of days I’ve fixed several issues in Red5 to get it ready for 1.0. Luckily some of these fixes resulted directly from projects being worked on at Infrared5.

The first issue looked into was with shared object usage with RTMPT. This issue seemed to by caused by the way that we manipulate the classloader hierarchy. A word of warning: working with classloaders can be a very scary task and not one that any novice Java developer should want to take on. Briefly, each Red5 application has its own classloader which is separate from any other Red5 application; this is mainly for sandboxing and is the way in which all JEE application servers operate. The internal instances (if enabled) of RTMPT and RTMPS are started in the Tomcat loader thread after all of the applications have been initialized and thus they cannot access the Red5 applications individual classloaders; meaning they can’t share SO’s etc. For that reason I never recommend using the internal instances and instead suggest that implementers use the RTMPT servlet within their Red5 application; this is a simple addition to their web.xml. In the end, after working on this bug and an RTMPT binding issue at the same time I found that the classloader issue was fixed by making sure the internal instances were binding to an IP, instead of allowing Tomcat to handle it as it saw fit. It would appear that Tomcat has some sort of sharing in-place that allowing web application classloaders to talk with each other. The “fix” has been added to trunk around revision 4241 and will be in the 1.0 release configurations.

The last two things that I resolved today were found by using FMLE 3.2 as a test publisher. I must state that we as a team cannot support FMLE due to its EULA, but it is a very handy and capable application for streaming to your media server if you want something other than Sorenson and NellyMoser.  I didn’t find any specific issues for “onFI” or AAC live streaming on the tracker, but these are the two items I fixed using FMLE. The initial work for AAC was done early-on by Tiago and modified by Vladimir Hmelyoff, so a big thank you to them. Fixing live streaming with h.264 and AAC was as easy as making the ClientBroadcastStream check for audio codec information and setting it if it was absent; I love ez fixes!  To fix “onFI” I had to dig around on Google to find out what this call was, for those who don’t know it is used for active timecoding in a stream. The publisher will send the local system time and date as strings in a mixed-array, keyed as “st” and “sd” respectively. All that needed to be done by Red5 at this time was to handle the callback and pass it on to the subscribers.

One last note about FLME, when you stream live it will send parameters with your stream name and we used to simply ignore them. These parameters are now stored on your broadcast stream and may be accessed on the server side by calling getParameters().

Lastly, I don’t know when 1.0 will be available but you may all certainly use the current RC2 version in SVN.

31 Mar 10 Stop complaining about Flash

If people aren’t complaining about Flash and HTML5 they are falling back to NoSQL vs RDBMS. There is a time and a place for everything, just remember that tidbit. So to get on with it, I would like to state that I am mostly a Windows user and I love Windows 7.. It f#@king rocks! I also use Google Chrome as my primary browser on both OSX and Windows. I recently loaded the latest dev build of Chrome that contains a streamlined Flash Player and I can say that it is awesome.
To test, I started up a Red5 instance with some mp4 and vp6 videos to see what the CPU usage would be and here is the result: Red5 = 0% to 7% and Chrome = 3% to 6% (average 3%)
The playback was smooth as silk and the audio was perfect. Next up for comparison, I tried IE and FF:
IE 8 with FP10.1 = 5% to 11% (average 5%)
Firefox 3.6 with FP 10.1 = 14% to 66% (average 40%)

Tags: , , , , , , ,

12 Nov 09 Native RTMPS in Red5

Red5 now supports “native” RTMPS in addition to RTMPT over SSL. To use this feature you will need to use the current trunk version until 0.9 RC3 or Final are released. A big shout-out goes to Kevin Green for providing the original patch. Using this communication channel, your data will be secured throughout the process from connection to shutdown using TLS/SSL and should provide the secure features you need until RTMPE is ready.

Red5NativeRTMPS

Red5NativeRTMPS


To use this mode in your NetConnection, you must set the proxy type to best like so:

nc = new NetConnection();
nc.client = this;
nc.proxyType = "best";

For this example I used a free opensource ssl cert provided by godaddy.

Step by step process:

1. Create your key

keytool -keysize 2048 -genkey -alias red5 -keyalg RSA -keystore keystore
Enter keystore password:
Re-enter new password:
What is your first and last name?
  [Unknown]:  ssl.red5.org
What is the name of your organizational unit?
  [Unknown]:  Dev
What is the name of your organization?
  [Unknown]:  Red5
What is the name of your City or Locality?
  [Unknown]:  Henderson
What is the name of your State or Province?
  [Unknown]:  Nevada
What is the two-letter country code for this unit?
  [Unknown]:  US
Is CN=ssl.red5.org, OU=Dev, O=Red5, L=Henderson, ST=Nevada, C=US correct?
  [no]:  yes

Enter key password for <red5>
        (RETURN if same as keystore password):

2. Create a CSR

keytool -certreq -keyalg RSA -alias red5 -file red5.csr -keystore keystore
Enter keystore password:

3. Submit your CSR to your SSL certificate provider. Godaddy process is described below.

4. After your receive your certificate, import the root cert into your keystore file

keytool -import -alias root -keystore keystore -trustcacerts -file valicert_class2_root.crt
Enter keystore password:
Certificate already exists in system-wide CA keystore under alias <valicertclass2ca>
Do you still want to add it to your own keystore? [no]:  yes
Certificate was added to keystore

5. Import the cross certificates

keytool -import -alias cross -keystore keystore -trustcacerts -file gd_cross_intermediate.crt
Enter keystore password:
Certificate was added to keystore

6. Import the intermediate certificates

keytool -import -alias intermed -keystore keystore -trustcacerts -file gd_intermediate.crt
Enter keystore password:
Certificate was added to keystore

7. Import your certificate

keytool -import -alias red5 -keystore keystore -trustcacerts -file ssl.red5.org.crt
Enter keystore password:
Certificate reply was installed in keystore

8. Setup RTMPS in your red5/conf/red5-core.xml. You may notice that some of the rtmp variables are used here, that is only for ease of setup; you could set them to whatever you prefer.

    <bean id="rtmpsMinaIoHandler"
        class="org.red5.server.net.rtmps.RTMPSMinaIoHandler">
        <property name="handler" ref="rtmpHandler" />
        <property name="codecFactory" ref="rtmpCodecFactory" />
        <property name="rtmpConnManager" ref="rtmpMinaConnManager" />
	<property name="keyStorePassword" value="${rtmps.keystorepass}" />
        <property name="keystoreFile" value="conf/keystore" />
    </bean>
    
    <bean id="rtmpsTransport" class="org.red5.server.net.rtmp.RTMPMinaTransport" init-method="start" destroy-method="stop">
        <property name="ioHandler" ref="rtmpsMinaIoHandler" />
        <property name="connectors">
            <list>
                <bean class="java.net.InetSocketAddress">
                    <constructor-arg index="0" type="java.lang.String" value="${rtmps.host}" />  
                    <constructor-arg index="1" type="int" value="${rtmps.port}" />  
                </bean>
            </list>
        </property>
        <property name="receiveBufferSize" value="${rtmp.receive_buffer_size}" />
        <property name="sendBufferSize" value="${rtmp.send_buffer_size}" />
        <property name="eventThreadsCore" value="${rtmp.event_threads_core}" />
        <property name="eventThreadsMax" value="${rtmp.event_threads_max}" />
        <property name="eventThreadsQueue" value="${rtmp.event_threads_queue}" />
        <property name="eventThreadsKeepalive" value="${rtmp.event_threads_keepalive}" />
        <property name="jmxPollInterval" value="1000" />
        <property name="tcpNoDelay" value="${rtmp.tcp_nodelay}" />
    </bean>

Additional security info can be found here
The testing player source can be found here

Tags: , ,

27 Sep 09 NSV live streaming on Red5

Screenshot of playing nsv stream in flash

Screenshot of playing nsv stream in flash

This morning I was successful in playing a live NSV stream with FlashPlayer via Red5. I used NSVCap encoding VP62 and AAC. The code is implemented using the new Red5 plug-in system and will be released with 0.9.0 (soon). Huge thank yous go out to Andy Shaules and Wittawas Nakkasem for their help developing this feature.

07 Aug 09 How to add an IoFilter per Application or Server

A new feature has been added to Red5 to allow any number of Mina IoFilters to be added to a connection at the Server or Application level. The particular filter detailed here is one that simply counts the connections and rejects any that exceed the set maximum number. This post details setting the filter at the Application level, but if you want it at the server level simply add the below bean definitions to your global webapp configuration located here: red5/webapps/red5-default.xml.

To add the filter you must first edit your applications red5-web.xml and add your beans:

<!-- Limits connections on a per-session basis -->
<bean id="connectionFilter" class="org.gregoire.red5.ConnectionShapeFilter">
    <property name="maxConnections" value="2"/>
</bean>			

Next create a “config” bean to inform the server about your filter bean names:

<bean id="config" class="org.red5.server.adapter.Config">
    <!-- List of filter bean names to be loaded -->
    <property name="filterNames">
        <list>
	    <value>connectionFilter</value>
	</list>
    </property>
</bean>  	

One important thing to note is that since classes in the main server are creating the connections, your filter classes must be found by the URLClassloader. The URLClassloader created by the server uses jar files within Red5′s lib directory, so put your filter classes here (red5/lib) inside a jar. Once your classes are in-place, start your server and the filters will take effect.

An example Eclipse / FlexBuilder project can be found here.

Tags: , , ,

15 Jun 09 Quartz schedulers

When you want to schedule a particular task or job within Red5, you have at least two options available which are built into the server. We use Quartz for our scheduler, but you are not required to use it; I just wanted to get that disclaimer out of the way, this is Java so use whatever you like.  The first option is the “server-wide” scheduler which is created when the server starts up and requires no configuration from your application. This scheduler is sufficient for most of the jobs you may want to create, but you will run into problems if you attempt to access an application class from within your job. The second option resolves this issue by providing an application level scheduler, one which can access your classes. The only caveat with this scheduler is that you must provide some configuration details, your applications context name.

Accessing the “server-wide” scheduler is done in your application like so (using scope):

schedulingService = (ISchedulingService) scope.getContext().getBean(ISchedulingService.BEAN_NAME);

Accessing the application scheduler is slightly different (using app context):

schedulingService = (ApplicationSchedulingService) ((BeanFactory) applicationContext).getBean("scheduler");

I prefer to make sure the schedulingService member is setup in my “appStart” method, since this is essentially where the application is “started” within Red5.

The following entry must be made in your applications red5-web.xml file if you want to use an application scheduler:

<bean id="scheduler" class="org.red5.server.scheduling.ApplicationSchedulingService">	 	
    <property name="applicationName" value="myapp" />
</bean>

Make sure you set the correct application name / context (replace “myapp”).
Once you have the scheduling service, you can add your job amongst many other options which I don’t want to cover here.

Tags: , , , , , ,

06 Jun 09 PHP support in Red5

I’ve updated my “parameterdemo” to include a couple PHP pages. The latest trunk (0.8.1-dev) now supports PHP through the use of Quercus. To enable it simply set a context parameter in your web.xml and include the quercus and resin-utils jars in your WEB-INF/lib. See the zip file for a complete example (eclipse + ant).

Once you deploy the war, go to these urls to test (update your port to match your servers setting):

PHP example getting value from Red5 application: 

<a href="http://localhost/parameterdemo/getparam.php">http://localhost/parameterdemo/getparam.php</a>

Same example with debug output: 

<a href="http://localhost/parameterdemo/getparam.php?debug=true">http://localhost/parameterdemo/getparam.php?debug=true</a>

Java servlet example: 

<a href="http://localhost/parameterdemo/myservlet">http://localhost/parameterdemo/myservlet</a>

The web.xml entry must look like so:

	<context-param>
	   <param-name>enable-php</param-name>
	   <param-value>true</param-value>
	</context-param>

Note: You dont have to install Resin to use Quercus, simply download one of the wars on this page: http://quercus.caucho.com/ and grab the libraries from WEB-INF/lib

Tags: , , , , ,


Fatal error: Call to undefined function akismet_counter() in C:\xampp\htdocs\paulgregoireblog\wp-content\themes\googlechrome\footer.php on line 9