Skip to content

Conversation

@finger563
Copy link
Contributor

@finger563 finger563 commented Apr 23, 2023

Description

  • Added rtsp_client component which includes
    • rtp_packet.hpp
    • rtp_jpeg_packet.hpp
    • jpeg_header.hpp
    • jpeg_frame.hpp
    • rtsp_client.hpp
  • Added python tests for rtsp_client which implement
    • a pure opencv display of a rtsp server mjpeg stream
    • a pure python parse of rtsp server mjpeg stream (this was the prototyping for the c++ code)
  • Updated espp submodule to latest
  • Added example code for rtsp_client which doesn't display anything, just shows that the server is receiving data and prints out the last frame as hex array
  • Updated main code to use new rtsp_client component

Motivation and Context

#1 - RTSP (RTP+RTCP) with MJPEG transport can have less lag and higher effective framerate than transmitting full jpeg over TCP, and less loss with more control for streaming than pure UDP. The use of MJPEG with a JFIF enables the removal of the huffman tables and larger jpeg headers from the transmitted data, allowing simplified header transmission, with only the compressed quantization tables and scan data comprising the bulk of the transmitted images

How has this been tested?

Running on the esp32-s3-box connected via wifi to the m5stack esp32 timer-cam (which is running the code from esp-cpp/camera-streamer#2)

Screenshots (if appropriate, e.g. schematic, board, console logs, lab pictures):

image

camera_display_rtsp_compressed.mp4
python_rtsp_client_compressed.mp4

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation Update
  • Hardware (schematic, board, system design) change
  • Software change

Checklist:

  • My change requires a change to the documentation.
  • I have added / updated the documentation related to this change via either README or WIKI

Software

  • I have added tests to cover my changes.
  • I have updated the .github/workflows/build.yml file to add my new test to the automated cloud build github action.
  • All new and existing tests passed.
  • My code follows the code style of this project.

* Added simple RTSP client using native opencv videocapture to open the stream
* Added RtspClient class which handles the RTSP / RTP / RTCP packets and properly handles the incoming RTP MJPEG stream (repackaging the split packets and adding the jpeg headers) to show each frame via opencv.
…r, rtp packet, rtp jpeg packet, and jpeg frame. now it is much faster :)
* Added c++ versions of python classes from working python example
* Updated python example to be refactored into classes
* Added example for running the rtsp client on esp32
* Changed jpeg_header to be object instead of unique ptr in jpeg frame
* Added getters for width/height of image in jpeg header and jpeg frame
* Updated parsing of mjpeg header rtp_jpeg_packet
* Added receive timeout in rtsp_client - defaults to 5 seconds for now
* Removed older camera display code and tasks, updated to use new rtsp_client component
* removed multicast socket for now for hardcoded server ip / port for testing.
* Added rtsp_client to cmakelists for main
* Updated how memory is managed in the jpeg frame to ensure consistency
* Added missing huffman tables to header generation (copied from generated jpeg frames on the camera side)
* Updated ordering of header generation to match frames generated
* Updated how the frame completeness is tracked to make the code simpler to use
* Keep retrying connection if it fails
* Print last frame after connection termination
* Update espp submodule to latest
* Update main display task to use latest api
* Update to enforce size of image queue
@finger563 finger563 added enhancement New feature or request rtsp rtp rtcp labels Apr 23, 2023
@finger563 finger563 linked an issue Apr 23, 2023 that may be closed by this pull request
@finger563 finger563 merged commit 8b5733f into main Apr 23, 2023
@finger563 finger563 deleted the feature/1_rtsp_client branch April 23, 2023 18:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request rtcp rtp rtsp

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Move from TCP image stream to RTSP (RTP / RTCP) (Client Side)

1 participant