分类
嵌入式开发 开发计划

[OpenIPC TX端] + [OpenWrt RX端]

完整架构图

[OpenIPC TX端]                      [OpenWrt RX端]                 [手机]
SSC337芯片 → majestic           WFB-ng 接收 → RTP流 → USB Tethering → App解码显示
  ↓          ↓                      ↓                            ↓
RTL8812EU ← wfb-ng发送 ← WFB数据 ← RTL8812EU   ← USB网络 → RTSP/UDP播放

1. TX端配置(OpenIPC)

硬件准备

  • OpenIPC摄像头(SSC337芯片)
  • RTL8812EU USB网卡
  • OpenIPC FPV固件(带wfb-ng支持)

Majestic配置(/etc/majestic.yaml

video0:
  enabled: true
  size: 1280x720  # 或 1920x1080
  fps: 60
  bitrate: 4096
  codec: h264
  rcMode: cbr
  gopSize: 0.2
  lowDelay: true

outgoing:
  # 输出到本地wfb-ng端口
  - udp://127.0.0.1:5602

rtsp:
  enabled: false  # 不需要RTSP,直接用UDP

isp:
  lowDelay: true

WFB配置(/etc/wfb.conf

channel=161  # 5.8GHz频道
telemetry=false

参考来源:Digital FPV using OpenIPC and WFB-NG – XDA Forums

2. RX端配置(OpenWrt)

安装必需软件包

opkg update
opkg install kmod-usb-net-cdc-ether  # USB tethering
opkg install kmod-usb-net-rndis
opkg install wifibroadcast-svpcom  # 从本仓库安装

配置WFB接收端(/etc/wifibroadcast.cfg

[common]
wifi_channel = 161
wifi_region = 'BO'

[gs_video]
peer = 'udp://192.168.42.129:5600'  # 手机USB tethering后的IP

启动WFB接收

systemctl enable wifibroadcast@gs
systemctl start wifibroadcast@gs

3. USB Tethering设置

Android设备

  1. 打开”USB网络共享”
  2. 连接到OpenWrt路由器
  3. OpenWrt会分配IP(通常是192.168.42.x段)
  4. 手机IP:192.168.42.129,OpenWrt网关IP:192.168.42.1

iOS设备(需要注意)

⚠️ iOS 14+ USB Tethering有兼容性问题

根据Apple讨论区,iOS 14破坏了Linux/OpenWrt的USB tethering功能。

解决方案:
1. 使用iOS 13或更低版本的iPhone
2. 或者使用Wi-Fi tethering代替USB tethering
3. 等待OpenWrt更新ipheth驱动(已有patch)

参考:iOS14 iPhone USB tethering broken for Linux/OpenWRT

4. 手机App解码方案

方案A:RTSP转流(推荐)

在OpenWrt上安装RTSP服务器,将WFB接收到的RTP流转换为RTSP:

opkg install rtsp-simple-server

配置(/etc/rtsp-simple-server.conf):

paths:
  wfb_stream:
    source: udp://0.0.0.0:5600
    sourceOnDemand: yes

Android App

使用支持RTSP的播放器:
– VLC for Android
– MX Player
– 自定义App(使用ExoPlayerGStreamer

iOS App

iOS的AVFoundation不支持RTSP,需要:
– 自定义App使用GStreamer
– 或使用第三方播放器

方案B:直接UDP播放(更低延迟)

在OpenWrt上配置UDP转发,手机直接接收RTP流。

Android App

  • 使用RootEncoder库开发自定义App
  • 支持UDP流的H264解码

iOS App

5. 推荐的App方案

最低延迟方案(直接UDP)

Android:

// 使用RootEncoder库的UDP接收
Source source = new UdpSource("192.168.42.1", 5600);
MediaCodecVideoDecoder decoder = new MediaCodecVideoDecoder(source);

iOS:
使用GStreamer直接接收UDP流:

// GStreamer pipeline
gst-launch-1.0 udpsrc port=5600 ! application/x-rtp ! rtph264depay ! avdec_h264 ! glimagesink

易用方案(RTSP)

安装RTSP服务器后,使用现成的播放器:
– Android:VLC, MX Player
– iOS:需要自定义App(使用GStreamer)

6. 关键注意事项

  1. 延迟优化
    • 使用Majestic的lowDelay: true
    • 减小GOP(gopSize: 0.2
    • 使用高帧率(60fps)
    • 选择合适的MCS值(MCS#1或2)
  2. WiFi频道
    • TX和RX必须使用相同频道(推荐165或161)
    • 避开RC遥控器使用的频道
  3. 加密密钥
    • TX和RX必须使用相同的密钥对
    • 复制/etc/drone.key/etc/gs.key
  4. USB供电
    • RTL8812EU需要5V 5A供电
    • 添加470uF电容过滤电压尖峰
    • 必须有主动散热
  5. iOS兼容性
    • 考虑使用Wi-Fi tethering替代USB tethering
    • 或者使用Android设备作为显示终端

建议阅读:
Digital FPV using OpenIPC and WFB-NG
Majestic Endpoints – OpenIPC
GStreamer for RTSP on iOS and Android
iOS14 USB Tethering Issue