使用MP4编码的Flash流媒体网络摄像头视频

使用MP4编码的Flash流媒体网络摄像头视频

本文介绍了使用MP4编码的Flash流媒体网络摄像头视频的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

其中一个Flash应用程序我工作的特点是能够以流一个摄像头给他人。我们只是使用Flash的内置摄像头的支持,并通过FMS发送。

我们已经有一些人要求更高质量的视频,但我们已经在使用最高品质的设置,我们可以在闪存(设定质量为100%)。

我的理解是,在新的闪存播放器,他们增加了支持的视频MPEG-4编码。我创建了一个简单的测试Flex应用程序尝试和比较MP4 VS FLV编码的视频质量。不过,我似乎无法得到MP4在所有工作。

根据该的我需要做的,用的MP4,而不是FLV的唯一事情是prePENDMP4:到流的对骂时发布:

当我尝试这个没有任何反应。我没有得到提高了对客户端的任何活动,没有抛出异常,而我在服务器端的日志不显示任何数据流开始。

下面是相关的code:

  //这些都被定义并在类中创建的。
私人VAR数控:的NetConnection;
私人VAR共享:布尔;
私人VAR pubStream:NetStream的;
私人VAR格式:字符串;
私人VAR streamName中:字符串;
私人VAR摄像头:摄像头;

//当用户点击开始按钮被称为
私有函数startSharing():无效{
  如果(!nc.connected){
    返回;
  }

  如果(分享){返回; }

  如果(pubStream == NULL){
    pubStream =新的NetStream(NC);
    pubStream.attachCamera(照相机);
  }
  startPublish();

  分享= TRUE;
}

私有函数startPublish():无效{
  VAR名:字符串;

  如果(this.format ==MP4){
    NAME =MP4:+ streamName中;
  } 其他 {
    NAME = streamName中;
  }

  //pubStream.publish(name,活);
  pubStream.publish(名称,记);
}
 

解决方案

会知道FMS您正在运行的版本有帮助吗?好像你至少需要FMS 3.0.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:

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");
}
解决方案

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

这篇关于使用MP4编码的Flash流媒体网络摄像头视频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-24 09:22