Home / FPV Video processing with Raspberry Pi
19 Oct 2026
Analog FPV into a Raspberry Pi with a USB capture dongle
Lab 01 / USB analog
Purpose
Read an analog FPV picture on a grounded Raspberry Pi and draw a box around each person OpenCV can see.
The aircraft still sends analog video from its camera and VTX. Your goggle receiver (VRX) has a composite AV socket. A cheap USB dongle (EasyCAP and the UVC clones) turns that yellow plug into /dev/video0. This script opens that device. The Pi is not on the aircraft and it does not touch the sticks.
The extra device
The new piece on the bench is a USB analog capture dongle. The yellow composite plug goes in. USB goes into the Pi. The Pi should see a camera, with no extra driver. The photograph is an EasyCAP DC60+, the usual shape of that dongle.

One you can order that states Raspberry Pi support, and is sold for a weak analog picture from an aircraft, is the FEBON264 composite capture card. It does the same job: composite in, USB camera out. Any other dongle that says UVC, or "no driver", is the same socket. If the receiver only has a 3.5 mm jack, you also need a short lead that ends in that yellow pin.
Photograph by Hoikka1, CC BY-SA 3.0, via Wikimedia Commons.
Words
- FPV (First Person View). The live picture from the camera on the aircraft.
- VTX (Video Transmitter). The radio on the aircraft that sends that picture.
- VRX (Video Receiver). The box on the bench that gets the picture back. Your goggles have one inside.
- AV (Audio/Video). On this lead it is the yellow composite plug. The picture is on that pin. Most FPV leads do not bother with sound.
- USB (Universal Serial Bus). The square-ish plug into the Pi.
- UVC (USB Video Class). The dongle speaks the same language as a webcam, so the Pi treats it as a camera.
- V4L2 (Video for Linux 2). The Pi's camera door. The dongle shows up as
/dev/video0or another number. - OpenCV (Open Source Computer Vision Library). The Python library that reads frames and draws on them.
- HOG (Histogram of Oriented Gradients). A way of describing a shape by the direction of its edges. OpenCV ships a person model built this way.
- SVM (Support Vector Machine). The classifier that looks at those edges and answers "person" or "not."
- VNC (Virtual Network Computing). A remote desktop, so the detection window can be watched from another computer.
- SSH (Secure Shell). A text login to the Pi. The picture window still needs a display or VNC.
- MP4. A saved video file.
--fileis only a rehearsal. The live lab reads the dongle.
What you need
- Raspberry Pi on the bench, display or a VNC/SSH session with a window
- Analog VRX, antenna fitted, on the same channel as the VTX
- USB video capture dongle on a Pi USB port
- AV lead from the VRX video-out to the dongle
- Python 3 and OpenCV
sudo apt install python3-opencv v4l-utils
# or, inside a virtualenv:
python3 -m pip install -r requirements.txt
v4l2-ctl --list-devices
Run
From this folder, with the codes/ tree intact (the script imports ../common):
python3 detect_persons.py --device 0
python3 detect_persons.py --file sample.mp4
Press q or Esc to stop. Once a second the terminal prints frames per second and how many boxes were drawn.
What the code does
open_capture() opens a V4L2 device, or an MP4 when you pass --file. PersonDetector in ../common/person_detector.py scans each frame. show_stream() shows the window.
If the window is black, the dongle index is probably wrong, or the VRX is on another channel. v4l2-ctl --list-devices prints the index to pass as --device.
Command
python3 detect_persons.py --device 0
detect_persons.py
#!/usr/bin/env python3
"""Person boxes on analog FPV. The Pi stays on the bench.
Path: camera -> VTX -> your VRX -> yellow AV plug -> USB capture dongle
-> this script. Props stay off until the window shows a live picture.
"""
import argparse
import sys
from pathlib import Path
import cv2
sys.path.insert(0, str(Path(__file__).resolve().parents[1]))
from common.person_detector import PersonDetector, show_stream
def open_capture(args):
if args.file:
return cv2.VideoCapture(args.file)
capture = cv2.VideoCapture(args.device, cv2.CAP_V4L2)
capture.set(cv2.CAP_PROP_FRAME_WIDTH, args.width)
capture.set(cv2.CAP_PROP_FRAME_HEIGHT, args.height)
capture.set(cv2.CAP_PROP_FPS, args.fps)
return capture
def main():
parser = argparse.ArgumentParser(description="Detect people on a USB analog FPV capture.")
parser.add_argument("--device", default=0, type=int, help="V4L2 index from v4l2-ctl --list-devices")
parser.add_argument("--width", default=720, type=int)
parser.add_argument("--height", default=480, type=int)
parser.add_argument("--fps", default=25, type=int)
parser.add_argument("--file", default="", help="MP4 to rehearse with no receiver")
parser.add_argument("--max-width", default=480, type=int, help="Detector width. Lower is faster on a Pi.")
args = parser.parse_args()
show_stream(open_capture(args), PersonDetector(max_width=args.max_width))
if __name__ == "__main__":
main()
common/person_detector.py
#!/usr/bin/env python3
"""Mark people in one video frame.
The detector is the HOG + SVM person model that ships inside OpenCV.
No weight file to download. On a Raspberry Pi the search is slow, so each
frame is narrowed before the scan and the boxes are drawn back on the
full picture.
This file does not open a radio, a camera, or a network port. Each lab
opens its own picture source and calls PersonDetector.
"""
import time
import cv2
def _as_float(value):
if hasattr(value, "ravel"):
flat = value.ravel()
if len(flat):
return float(flat[0])
return float(value)
class PersonDetector:
"""Find people in a BGR frame and draw a box around each one."""
def __init__(self, max_width=480, hit_threshold=0.0):
self.hog = cv2.HOGDescriptor()
self.hog.setSVMDetector(cv2.HOGDescriptor_getDefaultPeopleDetector())
self.max_width = int(max_width)
self.hit_threshold = float(hit_threshold)
def detect(self, frame):
"""Return (x, y, w, h, score) boxes in the original frame."""
height, width = frame.shape[:2]
scale = 1.0
work = frame
if width > self.max_width and self.max_width > 0:
scale = self.max_width / float(width)
work = cv2.resize(frame, (self.max_width, max(1, int(height * scale))))
rects, weights = self.hog.detectMultiScale(
work,
winStride=(8, 8),
padding=(8, 8),
scale=1.05,
hitThreshold=self.hit_threshold,
)
boxes = []
inv = 1.0 / scale
for rect, weight in zip(rects, weights):
x, y, w, h = rect
boxes.append((int(x * inv), int(y * inv), int(w * inv), int(h * inv), _as_float(weight)))
return boxes
def draw(self, frame, boxes):
for x, y, w, h, score in boxes:
cv2.rectangle(frame, (x, y), (x + w, y + h), (80, 180, 70), 2)
cv2.putText(
frame,
"person {:.2f}".format(score),
(x, max(18, y - 6)),
cv2.FONT_HERSHEY_SIMPLEX,
0.5,
(80, 180, 70),
1,
cv2.LINE_AA,
)
cv2.putText(
frame,
"persons {}".format(len(boxes)),
(12, 28),
cv2.FONT_HERSHEY_SIMPLEX,
0.7,
(230, 220, 180),
2,
cv2.LINE_AA,
)
return frame
def show_stream(capture, detector, window_name="FPV persons"):
"""Read until the picture ends or the operator presses q or Esc.
capture must provide isOpened(), read() -> (ok, frame), and release().
A cv2.VideoCapture does. The UDP lab's ffmpeg pipe does too.
"""
if capture is None or not capture.isOpened():
raise SystemExit("No picture. Check the source, then run again.")
last = time.time()
frames = 0
try:
while True:
ok, frame = capture.read()
if not ok or frame is None:
time.sleep(0.05)
continue
boxes = detector.detect(frame)
detector.draw(frame, boxes)
frames += 1
now = time.time()
if now - last >= 1.0:
print("frames/s {:.1f} persons {}".format(frames / (now - last), len(boxes)))
frames = 0
last = now
cv2.imshow(window_name, frame)
key = cv2.waitKey(1) & 0xFF
if key in (ord("q"), 27):
break
finally:
capture.release()
cv2.destroyAllWindows()
Copy both files, keep person_detector.py in a common folder next to the lab folder, and run the command above from the lab folder. Props off while you prove the picture. The Pi stays on the ground.