Rtspvideoplugin May 2026
Client (Plugin) Server (Camera) |--- OPTIONS ---------------->| |<--- 200 OK -----------------| |--- DESCRIBE --------------->| |<--- SDP (Session Description)| |--- SETUP (client_port)----->| |<--- 200 OK (server_port)----| |--- PLAY ------------------->| |<--- 200 OK -----------------| |<--- RTP/UDP Stream ---------| 3.1 Minimal RTSP Client Core // RTSPClient.h #include <string> #include <functional> #include <thread> #include <cstring> #include <sys/socket.h> #include <arpa/inet.h> #include <unistd.h> class RTSPVideoPlugin public: using FrameCallback = std::function<void(uint8_t* data, int width, int height, int stride)>;
void Start() player = CreateRTSPPlayer(); OpenStream(player, "rtsp://192.168.1.100/stream"); videoTexture = new Texture2D(1920, 1080, TextureFormat.RGB24, false); GetComponent<Renderer>().material.mainTexture = videoTexture; rtspvideoplugin
bool connect(const std::string& url, FrameCallback callback) m_callback = callback; m_url = url; // 1. Parse URL (rtsp://ip:port/path) // 2. Open TCP socket to server:554 // 3. Send OPTIONS, DESCRIBE, SETUP, PLAY (see full code in repo) // 4. Start receive thread m_running = true; m_thread = std::thread(&RTSPVideoPlugin::receiveLoop, this); return true; Send OPTIONS, DESCRIBE, SETUP, PLAY (see full code
import cv2 import numpy as np from threading import Thread class RTSPVideoPlugin: def init (self, rtsp_url): self.url = rtsp_url self.cap = None self.running = False self.frame = None m_thread = std::thread(&RTSPVideoPlugin::receiveLoop
struct obs_source_info rtsp_source = .id = "rtsp_video_source", .type = OBS_SOURCE_TYPE_INPUT, .output_flags = OBS_SOURCE_VIDEO, .get_name = rtsp_name, .create = rtsp_create, .destroy = rtsp_destroy, .video_render = rtsp_video_render, .get_properties = rtsp_properties, .update = rtsp_update ; static void rtsp_video_render(void* data, gs_effect_t* effect) struct rtsp_data rtsp = (struct rtsp_data )data; if (rtsp->texture) obs_source_draw(rtsp->texture, 0, 0, 0, 0, false);
; 4.1 Unity Plugin (C++ -> C#) Expose C functions:
void processH264Packet(uint8_t* data, int len) // Simplified: assemble NAL units // For FU-A: combine FU indicator + FU header + payload // Send to decoder (e.g., FFmpeg, OpenH264)
