views:

3344

answers:

2

One of the features of the Flash app I'm working on is to be able to stream a webcam to others. We're just using the built-in webcam support in Flash and sending it through FMS.

We've had some people ask for higher quality video, but we're already using the highest quality setting we can in Flash (setting quality to 100%).

My understanding is that in the newer flash players they added support for MPEG-4 encoding for the videos. I created a simple test Flex app to try and compare the video quality of the MP4 vs FLV encodings. However, I can't seem to get MP4 to work at all.

According to the Flex documentation the only thing I need to do to use MP4 instead of FLV is prepend "mp4:" to the name of the stream when calling publish:

Specify the stream name as a string with the prefix mp4: with or without the filename extension. The prefix indicates to the server that the file contains H.264-encoded video and AAC-encoded audio within the MPEG-4 Part 14 container format.

When I try this nothing happens. I don't get any events raised on the client side, no exceptions thrown, and my logging on the server side doesn't show any streams starting.

Here's the relevant code:

// These are all defined and created within the class.
private var nc:NetConnection;
private var sharing:Boolean;
private var pubStream:NetStream;
private var format:String;
private var streamName:String;
private var camera:Camera;

// called when the user clicks the start button
private function startSharing():void {
  if (!nc.connected) {
    return;
  }

  if (sharing) { return; }

  if(pubStream == null) {
    pubStream = new NetStream(nc);
    pubStream.attachCamera(camera);
  }
  startPublish();

  sharing = true;
}

private function startPublish():void {
  var name:String;

  if (this.format == "mp4") {
    name = "mp4:" + streamName;
  } else {
    name = streamName;
  }

  //pubStream.publish(name, "live");
  pubStream.publish(name, "record");
}
+1  A: 

Would be helpful to know the version of FMS you are running? It seems like you need at least FMS 3.0.2.

Theo.T
It seems I only have 3.0.1 installed. I'll try upgrading and see if that helps.
Herms
Upgrading to FMS 3.5 seems to have fixed it. Thanks!
Herms
Great it helped ; ) have fun !
Theo.T
+1  A: 

Are you sure this applies to live streams and not only for recording? this 1 2 links suggest that while the player can decode sorenson, vp6 and h264, it can only encode in sorenson.

I'm in a similar situation, so I would like to have this clarified.

edit: what actually makes me doubt is that the documentation says flv and mp4, which arent codecs but containers, live streaming doesnt use containers, the encoded frames travel directly inside rtmp packets

Pablote
Yes, I would love to know if the FP has an h.264 encoder in it; which as far as I am aware, it does not.
Mondain