使用 Flash、PHP、Red5 从浏览器录制视频

发布于 2024-12-12 16:11:24 字数 431 浏览 2 评论 0原文

我希望构建一个应用程序,使用它可以录制视频(以及音频)和音频(最好仅录制 mp3 格式的音频)。

从我所做的一些研究中,我发现我需要一个 Flash 或 Flex 中的客户端应用程序、一个 RTMP 服务器(RED5 最好,因为它是免费的)

这是我用来让 cam 工作 flash 的代码。

var camera:Camera = Camera.getCamera();
var video:Video = new Video(); 
video.attachCamera(camera);
addChild(video);

问题是,我不知道如何将流发送到 RED5。

另外,我需要做什么才能根据用户存储视频。我正在创建的网站是用 PHP/MySQL 编写的,需要录制自己的视频和音频。我喜欢 Facebook 集成视频录制的方式。

I wish to build an application using which I can record video (along with audio) and also audio (only audio preferably in mp3 format).

From some research I did, I found I need a client app in flash or flex, a RTMP Server (RED5 preferable as its free)

This is the code which I used to get cam working flash.

var camera:Camera = Camera.getCamera();
var video:Video = new Video(); 
video.attachCamera(camera);
addChild(video);

The problem is, I don't know how to send the stream to RED5.

Also, what do I need to do so that I can store the video according to the user. The website I am creating is in PHP/MySQL and need to have their own videos and audios recorded. I love the way facebook has integrated Video Recording.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

ぽ尐不点ル 2024-12-19 16:11:26

下面是将视频从 Flash 发布到媒体服务器(如 Red5、Wowza 或 AMS)的确切 AS3 代码:

//init vars
public var nc:NetConnection;
public var ns:NetStream;

//net connection to media server
nc = new NetConnection();
nc.connect("rtmp://yourmediaserver/oflaDemo/instance");

//net stream through which the recording  data is sent
ns =  new NetStream(nc)

//attach cam and mic to net stream
ns.attachCamera(Camera.getCamera())
ns.attachAudio(Microphone.getMicrophone())

//send the data to the media server
ns.publish("streamName","record");

对于音频注释 ns.attachAudio 行。

Flash Player 无法对 mp3 声音进行编码(但可以解码)。您将获得使用 NellyMoser ASAO 编码的声音。 Speex 也是一种选择。 请参阅此答案了解更多详细信息。

oflaDemo 是一款 Red5 应用程序,支持 Red5 附带的视频录制。

对于支持 Red5 和 PHP 的(商业)Flash/HTML 视频录制解决方案,您应该查看 https://hdfvr.com

另外,我需要做什么才能根据用户存储视频。

只需执行一个 PHP 脚本(从 Flash 客户端)即可将信息保存在数据库中。您可以使用 POST 或 GET 发送视频数据,使用会话或 cookie 检索用户数据。

Here's the exact AS3 code for publishing video from Flash to a media server like Red5, Wowza or AMS:

//init vars
public var nc:NetConnection;
public var ns:NetStream;

//net connection to media server
nc = new NetConnection();
nc.connect("rtmp://yourmediaserver/oflaDemo/instance");

//net stream through which the recording  data is sent
ns =  new NetStream(nc)

//attach cam and mic to net stream
ns.attachCamera(Camera.getCamera())
ns.attachAudio(Microphone.getMicrophone())

//send the data to the media server
ns.publish("streamName","record");

For just audio comment the ns.attachAudio line .

Flash Player can't encode mp3 sound (it can decode). You'll get sound encoded with NellyMoser ASAO. Speex is also an option. See this answer for more details.

oflaDemo is a Red5 app that supports video recording that's shipped with Red5.

For a (commercial) Flash/HTML video recording solution that supports Red5 and PHP you should check out https://hdfvr.com.

Also, what do I need to do so that I can store the video according to the user.

Just execute a PHP script (from the Flash client) that saves the info in the database. You can use POST or GET to send the video data and sessions or cookies to retrieve the user data.

墨落成白 2024-12-19 16:11:26
var video:Video;
var camera:Camera = Camera.getCamera();
camera.addEventListener(ActivityEvent.ACTIVITY, active);
video = new Video();
video.attachCamera(camera);

function active(event:Event):void
 {
  addChild(video);
  camera.removeEventListener(ActivityEvent.ACTIVITY, active);
 }
var video:Video;
var camera:Camera = Camera.getCamera();
camera.addEventListener(ActivityEvent.ACTIVITY, active);
video = new Video();
video.attachCamera(camera);

function active(event:Event):void
 {
  addChild(video);
  camera.removeEventListener(ActivityEvent.ACTIVITY, active);
 }
苏佲洛 2024-12-19 16:11:25

检查这个:http:// www.actionscript.org/resources/articles/615/2/Getting-started-with-red5-server/Page2.html

它解释了如何连接和使用 RED5 并为您提供了一个示例。

Check this: http://www.actionscript.org/resources/articles/615/2/Getting-started-with-red5-server/Page2.html

It explains how to connect and use RED5 and gives you an example.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文