Efficient pipeline for streaming BGR frames to the local network via UDP
Ravi Joshi via gstreamer-devel <[email protected]> Wed, 21 Aug 2024 17:38:38 +0000 (UTC)
| Newsgroups | gmane.comp.video.gstreamer.devel |
|---|---|
| Message-ID | <[email protected]> |
Hello,
First of all, thank you very much for allowing me to post here. I am receiving h264 frames of a stream (720x360@30fps) from a camera connected to my PC via USB. I am converting these frames to BGR frames supported in OpenCV. After the conversion, these frames are sent to the local network via UDP using GStreamer in C++. A code snippet is shown below:
---------------------------------------class VideoServer {public: VideoServer() { std::string pipeline = "appsrc ! video/x-raw,format=BGR ! queue ! videoconvert ! x264enc bitrate=5000 ! " "mpegtsmux alignment=7 ! rndbuffersize max=1316 min=1316 ! udpsink port=5005";
writer = std::make_unique<cv::VideoWriter>(pipeline, cv::CAP_GSTREAMER, 0, fps_, cv::Size(width_, height_)); } void VideoDataCallack(const uint8_t *data, size_t size, int64_t timestamp) override { std::cout << "At timestamp: " << timestamp << " video data of size " << size << " received." << std::endl; // convert h264_frame to opencv_frame writer->write(opencv_frame); }
private: std::unique_ptr<cv::VideoWriter> writer;};---------------------------------------
My goal is to steam these frames with minimal latency. Therefore, can someone point me to an efficient pipeline suitable for the above code snippet?
Thank you for your time and kind support.