Webcam video streaming in Flash using MP4 encoding

One of the features of the Flash application I'm working on is the ability to share the webcam with other users. We just use the built-in webcam support in Flash and send it via FMS.

We had some people who ask for high-quality video, but we already use the highest quality settings that we can use in Flash (quality setting up to 100%).

I understand that in the new flash players they added MPEG-4 encoding support for video. I created a simple Flex test application to try and compare MP4 and FLV video quality. However, I cannot 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 the prefix "mp4:" to the stream name when I publish:

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

When I try, nothing happens. I do not receive any events raised on the client side, no exceptions, and my server-side log does not show the start of any threads.

Here is 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");
}
+3
source share
3 answers

FMS, ? , FMS 3.0.2.

+1

, , ? 1 2 , , sorenson, vp6 h264, sorenson.

, , .

edit: , flv mp4, arent , , , rtmp

+1

Flash Player does not encode using H.264, but Flash Media Server can write any codec to an F4V container. Flash Media Live Encoder can encode using H.264.

So you can not send h264 from a web flash player (yet?) ...

+1
source

Source: https://habr.com/ru/post/1703773/


All Articles