top of page

USB Camera Raspberry Pi 4: Streaming Using GStreamer (Step-by-Step Guide)

Streaming video from a USB camera is a common requirement in embedded and vision-based systems such as surveillance, robotics, industrial inspection, and AI development. In this guide, we provide a step-by-step method to stream USB cameras on the Raspberry Pi 4 Model B using GStreamer.

USB camera streaming on Raspberry Pi 4 using GStreamer and V4L2

This setup works for both color and monochrome (grayscale) USB cameras. It covers software installation, device identification, and ready-to-use GStreamer pipelines that can be adapted to different camera resolutions and frame rates.


Why Raspberry Pi 4 Model B?

The Raspberry Pi 4 Model B remains widely used in embedded vision environments due to:

  • USB 3.0 support for high-resolution and high-FPS cameras

  • Sufficient CPU and RAM for real-time streaming

  • Compact form factor and low cost

  • Strong Linux ecosystem support

  • Native compatibility with GStreamer and V4L2 on Raspberry Pi OS

These characteristics make it suitable for rapid prototyping, demonstrations, and lightweight production deployments.


Platform Details Used in This Setup

Below are the platform and hardware details used for this blog:

Hardware: Raspberry Pi 4 Model B

Operating System: Raspberry Pi OS (64-bit)

Kernel Version: Linux 6.1.x (LTS)

Cameras Used: Falcon 821CRS (Color), Falcon 234MGS (Monochrome)

Interface: USB

Framework: GStreamer with V4L2

The same procedure applies to any standard UVC-compliant USB camera.


Installation Overview

Before streaming, install the required tools and libraries.

Installing GStreamer

GStreamer is a multimedia framework used to construct video pipelines.

Run:

sudo apt update 
sudo apt install -y gstreamer1.0-tools 
sudo apt install -y gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly gstreamer1.0-libav 

These plugins provide support for various video formats and conversions.

Installing v4l-utils

v4l-utils is required to enumerate and inspect video devices.

sudo apt-get install v4l-utils 

Streaming a USB Camera

Step 1: Finding the Camera Device Node

List connected video devices:

v4l2-ctl --list-devices 

Expected Output Example:

<Camera_name> (usb-0000:00:14.0-1): 
    /dev/video2 
    /dev/video3 
 HP HD Camera: HP HD Camera (usb-0000:00:14.0-9): 
    /dev/video0 
    /dev/video1 
From this output: 

From this output:

  • Each camera may expose multiple video nodes 

  • Choose the correct /dev/videoX based on your camera 

 Note down the correct video node. This will be used in the GStreamer command.

Step 2: Streaming Using GStreamer 

General GStreamer Command

gst-launch-1.0 v4l2src device=<VIDEO_NODE> ! \ 
video/x-raw,format=<FORMAT>,width=<WIDTH>,height=<HEIGHT>,framerate=<FPS>/1 ! \ 
videoconvert ! fpsdisplaysink text-overlay=true video-sink=autovideosink sync=false 

Parameter Explanation

VIDEO_NODE

The video device path obtained from v4l2-ctl, for example:

/dev/video2 

FORMAT

Pixel format supported by the camera:

  • UYVY – Color cameras

  • GRAY8 – Monochrome (grayscale) cameras

WIDTH and HEIGHT

Resolution of the video stream, for example:

  • 1920 × 1080

  • 1280 × 720

FPS

Frames per second, for example:

  • 30

  • 60

Example Commands

1. Streaming a Color USB Camera

Example configuration:

  • Device: /dev/video2 

  • Resolution: 1920 × 1080 

  • FPS: 30 

  • Format: UYVY 

gst-launch-1.0 v4l2src device=/dev/video2 ! \ 
video/x-raw,format=UYVY,width=1920,height=1080,framerate=30/1 ! \ 
videoconvert ! fpsdisplaysink text-overlay=true video-sink=autovideosink sync=false

This pipeline:

  • Captures video from the USB camera

  • Converts it into a display-compatible format

  • Displays real-time FPS statistics

2. Streaming a Monochrome (Grayscale) Camera

Example configuration:

  • Device: /dev/video2

  • Resolution: 1920 × 1080

  • FPS: 30

  • Format: GRAY8

gst-launch-1.0 v4l2src device=/dev/video2 ! \ 
video/x-raw,format=GRAY8,width=1920,height=1080,framerate=30/1 ! \ 
videoconvert ! fpsdisplaysink text-overlay=true video-sink=autovideosink sync=false

This configuration is suitable for:

  • Machine vision

  • Industrial inspection

  • Controlled lighting environments


Practical Implementation Summary

Streaming USB cameras on Raspberry Pi using GStreamer provides a structured and modular approach to building embedded vision pipelines.

The Raspberry Pi 4 Model B offers a balanced combination of performance, affordability, and ecosystem support, making it well-suited for camera-driven applications.

This setup can be extended to support:

  • Video recording

  • Network streaming (RTSP/UDP)

  • AI inference pipelines

  • OpenCV-based image processing

It serves as a scalable foundation for embedded vision, robotics, and edge AI deployments.


Industrial USB Cameras with Extended VISPA ARC Control

Vadzo Imaging offers a range of USB 3.2 industrial cameras engineered for seamless integration with embedded Linux platforms such as the Raspberry Pi 4 Model B. Designed on UVC-compliant architectures, these cameras support stable V4L2 enumeration and reliable GStreamer-based streaming, enabling straightforward deployment in edge vision systems.

With consistent frame delivery, optimized firmware behavior, and broad OS compatibility, Vadzo USB cameras are well suited for real-time monitoring, machine vision validation, and AI-based processing workflows.

For advanced control and deeper camera configuration beyond standard UVC capabilities, Vadzo also provides the Vadzo VISPA ARC SDK for Linux, a programmable USB camera control framework that enables extended sensor tuning, ROI management, exposure optimization, hardware trigger control, and low-latency performance customization for demanding embedded and industrial vision applications.

Recommended USB Cameras for Raspberry Pi 4:

AR2020 Monochrome 20MP USB 3.0 Camera
From$275.00
Buy Now
AR1335 Color 4K USB Camera
From$185.00
Buy Now

contact form camera image.webp
Reach Vadzo Team for the Customization

Vadzo team shall be able to assist you with the details on this.

Talk to our Camera Expert

bottom of page