使用 Red5 媒体服务器和 oflaDemo 应用程序提高录制视频的质量
我现在做的是:
cam = Camera.getCamera(); // Get default camera.
mic = Microphone.getMicrophone(); // Get the microphone
cam.setMode(800, 600, 25);
cam.setQuality(0,90);
videoDisplay.attachCamera(cam);
当用户单击按钮进行录制时,我执行以下操作:
private function netStatusHandler(e:NetStatusEvent):void {
var code:String = e.info.code;
Alert.show("code = " + code);
if(code == "NetConnection.Connect.Success"){ //in case of recording...
ns = new NetStream(nc);
ns.attachCamera(cam);
ns.attachAudio(mic);
ns.publish( "file1", "record" );
}
else{
trace(code);
}
}
private function start_rec():void{
nc = new NetConnection();
nc.connect("rtmp://localhost/oflaDemo");
nc.addEventListener(NetStatusEvent.NET_STATUS,netStatusHandler);
}
但是录制的质量很糟糕...我遵循与上面相同的代码来播放视频而不是 ns.publish 我做 ns .play() 和显示的视频并不符合预期,尽管当在 ns.play() 中将现成的 flv 视频用作 red5 中的示例时,它们播放得完美。.我录制的方式有问题吗?用相机?出什么问题了?有什么想法吗?
播放视频的代码是:
var nsClient:Object = {};
nsClient.onMetaData = ns_onMetaData;
nc = new NetConnection();
nc.connect(null);
ns = new NetStream(nc);
ns.client = nsClient;
video = new Video(myVid.width,myVid.height);
video.attachNetStream(ns);
video.smoothing=true;
myVid.addChild(video);
ns.play("http://localhost:5080/oflaDemo/recordings/file1.flv");`
提前致谢!
what i do now is:
cam = Camera.getCamera(); // Get default camera.
mic = Microphone.getMicrophone(); // Get the microphone
cam.setMode(800, 600, 25);
cam.setQuality(0,90);
videoDisplay.attachCamera(cam);
and when the user clicks a button to record i do the following:
private function netStatusHandler(e:NetStatusEvent):void {
var code:String = e.info.code;
Alert.show("code = " + code);
if(code == "NetConnection.Connect.Success"){ //in case of recording...
ns = new NetStream(nc);
ns.attachCamera(cam);
ns.attachAudio(mic);
ns.publish( "file1", "record" );
}
else{
trace(code);
}
}
private function start_rec():void{
nc = new NetConnection();
nc.connect("rtmp://localhost/oflaDemo");
nc.addEventListener(NetStatusEvent.NET_STATUS,netStatusHandler);
}
but the quality of the recording is awful... i follow the same code as above to play the video instead of ns.publish i do ns.play() and the video shown is not as expected although when i ns.play() the ready made flv videos used as samples in red5 they play perfect..there is something wrong with the way i record? with the camera? whats going wrong? any idea??
The code to play the video is:
var nsClient:Object = {};
nsClient.onMetaData = ns_onMetaData;
nc = new NetConnection();
nc.connect(null);
ns = new NetStream(nc);
ns.client = nsClient;
video = new Video(myVid.width,myVid.height);
video.attachNetStream(ns);
video.smoothing=true;
myVid.addChild(video);
ns.play("http://localhost:5080/oflaDemo/recordings/file1.flv");`
Thanks in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在
camera.setQuality(65536,90);
中,您可以设置 100 以获得最佳质量,但这取决于您的选择。希望通过这些改变,你的质量将会得到很大的提高。此外,质量也取决于您的网络摄像头。in
camera.setQuality(65536,90);
U can do 100 for best Quality, However it is your choice. Hopefully with these changes, ur quality will be improved very much. Also the quality depends on your webcam too.问题可能是带宽。尝试安装带宽限制器,然后尝试录制。你将会得到非常糟糕的回报。
如果您有高速连接,那么一切都会好起来的。
如果您使用 RTMP 协议,则意味着一切都应该是实时的。因此,如果带宽较低,帧就会被丢弃。
The problem might be the bandwidth. Try to install a bandwidth limiter and then try the recording. You will have a very bad palyback.
If you have a high speed connection then everything will be fine.
If you are using RTMP protocol then it means that everything should be real time. So if the bandwidth is low frames will be dropped.