1

我正在尝试从我的 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 版的无人机吗?

4

1 回答 1

0

AR.Drone 1.0 处理视频的方式与 AR.Drone 2.0 版本不同。根据AR.Drone 开发者指南

  • 1.0 使用了一种名为“P264”的自定义 Parrot 格式;2.0 使用标准 H264(指南的第 7.2 节)。
  • 1.0 通过 UDP 流式传输视频;2.0 通过 TCP 流式传输(指南的第 2.10 节)。

如果没有大量工作,您将无法使用 node-ar-drone 库访问视频流:

但实际上,几乎可以肯定,最好的选择是简单地购买 AR.Drone 2.0(截至 2015 年 4 月,新版售价约为 300 美元)并使用其他人支持和使用的现有代码。

于 2015-04-27T19:47:10.843 回答