Ask Your Question

Revision history [back]

RTSP Streaming, Gstreamer or FFmpeg ?

Hello,

I would like to know which library is the best to do RTSP streaming with OpenCV on a Jetson TX2 board.

I already use UDP streaming with this code :

// VideoCapture Pipe
std::string Cap_pipeline("nvarguscamerasrc ! "
"video/x-raw(memory:NVMM), width=1920, height=1080,format=NV12, framerate=30/1 ! "
"nvvidconv ! video/x-raw,format=I420 ! appsink");

// VideoWriter Pipe
std::string Stream_Pipeline("appsrc is-live=true ! autovideoconvert ! "
"nvv4l2h264enc control-rate=1 bitrate=1000000 ! video/x-h264, "
"stream-format=byte-stream ! rtph264pay mtu=1400 ! "
"udpsink host=192.168.1.102 port=5000 sync=false async=false");

cv::VideoCapture Cap(Cap_pipeline,cv::CAP_GSTREAMER);
cv::VideoWriter Stream(Stream_Pipeline, cv::CAP_GSTREAMER,
30, cv::Size(1920, 1080), true);

// check for issues
if(!Cap.isOpened() || !Stream.isOpened()) {
    std::cout << "I/O Pipeline issue" << std::endl;
}

while(true) {
    cv::Mat frame;
    Cap >> frame; //read last frame
    if (frame.empty()) break;

      cv::Mat bgr;
      cv::cvtColor(frame, bgr, cv::COLOR_YUV2BGR_I420);

      //video processing

      Stream.write(bgr);// write the frame to the stream

      char c = (char)cv::waitKey(1);
      if( c == 27 ) break;
}

Cap.release();
Stream.release();

return 0;

And I can read this stream on another PC with GStreamer using udpsrc, as with VLC/FFmpeg using an SDP file.

Now, I would like to do RTSP streaming, so that I do not need to use any SDP file.

I would like to know which library between Gstreamer and FFmpeg has the best performance for live-streaming?

Thanks