我正在尝试从我的 ar 无人机流式传输视频,但它无法正常工作。我已经安装了 ffmpeg 2.6 版,正在使用 Ubuntu 14.04、node.js 和 ar-drone npm 模块。我也在使用 1.0 版的 ar 无人机。有人告诉我我需要使用 2.0,因为这是构建模块所使用的,但如果我不需要,我宁愿不购买新的。下面是我正在使用的代码
var arDrone = require('ar-drone');
var http = require('http');
console.log('Connecting png stream ...');
var pngStream = arDrone.createClient().getPngStream();
var lastPng;
pngStream
.on('error', console.log)
.on('data', function(pngBuffer) {
lastPng = pngBuffer;
});
var server = http.createServer(function(req, res) {
if (!lastPng) {
res.writeHead(503);
res.end('Did not receive any png data yet.');
return;
}
res.writeHead(200, {'Content-Type': 'image/png'});
res.end(lastPng);
});
server.listen(8080, function() {
console.log('Serving latest png on port 8080 ...');
});
当我运行它并转到 http://localhost:8080/在我的浏览器中,我收到错误消息“尚未收到任何 png 数据”。这是因为我使用的是 1.0 版的无人机吗?
最佳答案
AR.Drone 1.0 处理视频的方式与 AR.Drone 2.0 版本不同。根据AR.Drone Developer's Guide ,
如果没有大量工作,您将无法使用 node-ar-drone 库访问视频流:
但实际上,几乎可以肯定,最好的选择是简单地购买 AR.Drone 2.0(截至 2015 年 4 月,新版售价约为 300 美元)并使用其他人支持和使用的现有代码。
关于ubuntu - 来自 AR 无人机的流式视频,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29000544/