问题
I would like to develop a very tiny and small RTSP client to get the video stream from network cameras. Does anybody know where can I find a simple explanation of the protocol and some good examples?
Best regards,
回答1:
You connect to the camera via RTSP protocol to query its capabilities, identify streams and prepare/start transmission.
- RFC 2326 - Real Time Streaming Protocol (RTSP)
As a part of initialization and handshaking, you will discover available streams.
- RFC 4566 - SDP Session Description Protocol
Then you will set up RTP session(s) to receive data, over UDP or sharing the same TCP connection.
- RFC 3550 - RTP A Transport Protocol for Real-Time Applications
- RFC 4571 - Framing Real-time Transport Protocol (RTP) and RTP Control Protocol (RTCP) Packets over Connection-Oriented Trans
To decode media streams you will convert the payload into pure data you need for further processing. With IP cameras your primary interest is perhaps MPEG-4 AVC (H.264):
- RFC 3984 - RTP Payload Format for H.264 Video
- RFC 6184 - RTP Payload Format for H.264 Video
This looks like some (introductory) reading.
回答2:
Try GStreammer library. It is modular, wery flexible library, which can be used for streamming (both client and server). Just check the docs and pick right plugins.
GStreammer could be used in two ways: as a commandline tool or as a library in your project, depending on your requirements.
来源:https://stackoverflow.com/questions/13027062/c-rtsp-video-capture-implementation