RTSP Example#
This example demonstrates several rtsp component workflows, ranging from the
legacy MJPEG API to the newer multi-track server API. The example can run as a
server, client, or combined self-check depending on the selected menuconfig
mode.
For more complete example use, see the camera-streamer and camera-display repositories.
How to use example#
Hardware Required#
Any supported ESP32 board with Wi-Fi can run this example. The bundled test content uses an embedded JPEG image and synthetic audio data, so no camera, microphone, or display hardware is required.
Configure the project#
idf.py menuconfig
The RTSP Example Configuration menu includes:
Example ModeLegacy MJPEG (server + client)- runs the original MJPEG server and client on the same deviceMJPEG Server only- serves the embedded JPEG on/mjpeg/1MJPEG Client only- connects to a remote MJPEG RTSP serverMulti-track server (MJPEG + audio)- serves MJPEG video on track 0 and genericL16/16000mono audio on track 1 at/stream
Run API tests at startup- exercises packetizers, depacketizers, and basic client/server construction before networking startsWi-Fi credentials and retry count
RTSP Server PortRemote RTSP server addresswhen client-only mode is selected
Build and Flash#
Build the project and flash it to the board, then run monitor tool to view serial output:
idf.py -p PORT flash monitor
(Replace PORT with the name of the serial port to use.)
(To exit the serial monitor, type Ctrl-].)
See the Getting Started Guide for full steps to configure and use ESP-IDF to build projects.
Example Output#
The serial log reports the selected mode, the local IP address after Wi-Fi connects, and the RTSP URI for server modes. Typical output includes:
All API tests passed!when startup API tests are enabledRTSP URI: rtsp://<ip>:8554/mjpeg/1in legacy and server-only modesRTSP URI: rtsp://<ip>:8554/streamin multi-track modeGot JPEG frame: <width>x<height>in client-only modeStreaming MJPEG video (track 0) + audio (track 1)...in multi-track mode
For host-side end-to-end testing, build the host library in lib/ with
./build.sh and use the scripts in the repository-root python/ directory.