Share Coding

Tutorials, Problems, Stuffs …

H.264 Live Video Streaming on Actionscript 3.0 with Red5 Server

**A suggestion for you**: do not try to use flash streaming as a stable long term video publishing channel.

1. Import


2. Variable and setting

var cam:Camera;
var camBandWidth:Number = 0;
var camQualityPersentage:Number = 90;
var camFPS:Number = 15;
var camKeyFrameInterval:Number = 35;
var camWidth:Number = 240;
var camHeight:Number = 220;

var h264Settings:H264VideoStreamSettings;

3. Coding

cam = Camera.getCamera("0");
cam.setQuality(camBandWidth, camQualityPersentage);

vid.smoothing = true;

in_ns = new NetStream(nc);
in_ns.addEventListener(NetStatusEvent.NET_STATUS, netStatus);
in_ns.addEventListener(AsyncErrorEvent.ASYNC_ERROR, onAsyncError);
in_ns.inBufferSeek = false;

h264Settings = new H264VideoStreamSettings();
h264Settings.setProfileLevel(H264Profile.BASELINE, H264Level.LEVEL_1_2);
in_ns.videoStreamSettings = h264Settings; 

in_ns.publish(streamName, "live");

4. Environment

  • You must update Flash player to version 11.0 on IE.
  • Update Flash to CS5.5 in your Adobe Bridge CS5.1.
  • Download and install to allow Flash CS5.5 to compile with Flash Player 11.
  • Compile with Flash Player 11.0 setting on both Publisher and Client.

5. Testing

You will also need to upgrade the flash debugger to Flash Player 11 no matter with Browser / Flash CS5.5 / html.

Go to This Website and download:

  • Windows Flash Player 11.X Projector content debugger
  • Windows Flash Player 11.X Projector

Placed them respectively to : (Source)

  • C:\Program Files\Adobe\Adobe Flash CS5.5\Players\Debug\ (rename it to FlashPlayerDebugger.exe)
  • C:\Program Files\Adobe\Adobe Flash CS5.5\Players\ (rename it to FlashPlayer.exe)
  • C:\Program Files\Adobe\Adobe Flash CS5.5\Players\Release\ (rename it to FlashPlayer.exe)

After that, you can debug in Flash CS5.5 by pressing Ctrl + Shift + Enter. ( Flash Player 11 will be called )
But if you use Ctrl + Enter, Flash Player 10 will be called.

6. Experience

It seems that all of the setting at H.264 is not working except “setProfileLevel”. Adobe said the following at document: Cam setting will overwrite this.

If I set cam and H.264 quality, H.264 quality will show 80, but the bits per second is around 11xkb. ( Non H.264 is around 7xkb with 90 quality )
This means quality setting not working.

If I comment the cam setting, the bandwidth setting will be default 16kb, and cam quality 0 (unlimited), H.264 quality -1 ( may be means undefined ).

Now, my current solution is using 100k bandwidth, if the bandwidth is full loading, flash will deduct the quality to suit the limit, delay 0.5-1.5 second,
no buffer and Drop Frame function ( Edit Red5 code and replace the red5.jar ) enable.

To have a stable version red5 v0.7(No support H.264), we have give up to use H.264 with Red5 v0.8 or or v1.0.

7. Comment

It would be helpful if some commands to help on improve the quality.


2 responses to “H.264 Live Video Streaming on Actionscript 3.0 with Red5 Server

  1. Pingback: Peer To Peer Live Video Streaming on Actionscript 3.0 With OpenRTMFP/Cumulus Server « Share Coding

  2. darmowe forum 2014/06/13 at 6:19 pm

    “It’s hard to find knowledgeable people on this topic however you sound like you know what you’re talking about! Thanks”

Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: