High-level RTSP multimedia streaming library, in Rust
Go to file
Scott Lamb de6658961b shrink several large datastructures
*   Box the remaining Depacketizer variants. I already boxed the largest
    ones, which are also the most common. Might as well box the others
    and not have so much dead space in the common case...
*   Don't keep around a full codec::Parameters on all codecs. This
    shrinks several depacketizers. I also avoid some awkward
    destructuring.
*   Box VideoFrame::new_parameters, which is populated rarely.

```
sizes changes on 64-bit platforms:
type                               before  after
client::Stream                        512    312
codec::Depacketizer                   224     16
codec::aac::Depacketizer              232    208
codec::g723::Depacketizer             200    104
codec::h264::Depacketizer             560    552
codec::onvif::Depacketizer            216    128
codec::simple_audio::Depacketizer     208    112
codec::CodecItem                      240    160
codec::VideoFrame                     232    152
codec::AudioFrame                     104    104
codec::MessageFrame                   104    104
client::rtp::SenderReport              72     72
```
2021-07-08 14:54:42 -07:00
.github/workflows initial commit 2021-06-03 16:49:53 -07:00
benches overhaul error type 2021-07-08 11:28:07 -07:00
examples/client overhaul error type 2021-07-08 11:28:07 -07:00
fuzz H.264 fixes, testing, packetizer 2021-06-25 16:39:48 -07:00
src shrink several large datastructures 2021-07-08 14:54:42 -07:00
.gitignore initial commit 2021-06-03 16:49:53 -07:00
Cargo.lock overhaul error type 2021-07-08 11:28:07 -07:00
Cargo.toml overhaul error type 2021-07-08 11:28:07 -07:00
CHANGELOG.md shrink several large datastructures 2021-07-08 14:54:42 -07:00
LICENSE-APACHE.txt initial commit 2021-06-03 16:49:53 -07:00
LICENSE-MIT.txt initial commit 2021-06-03 16:49:53 -07:00
README.md overhaul error type 2021-07-08 11:28:07 -07:00

retina

crates.io version Documentation CI

High-level RTSP multimedia streaming library, in Rust. Good support for ONVIF RTSP/1.0 IP surveillance cameras, as needed by Moonfire NVR. Works around brokenness in cheap closed-source cameras.

Progress:

  • client support
    • digest authentication.
    • RTP over TCP via RTSP interleaved channels.
    • RTP over UDP.
    • RTSP/1.0.
    • RTSP/2.0.
    • SRTP.
    • ONVIF backchannel support (for sending audio).
    • ONVIF replay mode.
    • receiving RTCP Sender Reports (currently only uses the timestamp)
    • sending RTCP Receiver Reports
  • server support
  • I/O modes
    • async with tokio
    • async-std. (Most of the crate's code is independent of the async library, so I don't expect this would be too hard to add.)
    • synchronous with std only
  • codec depacketization
    • video: H.264 (RFC 6184)
      • SVC
      • periodic infra refresh
      • multiple slices per picture
      • multiple SPS/PPS
      • interleaved mode
    • audio
      • AAC
        • interleaving
      • RFC 3551 codecs: G.711, G.723, L8/L16
    • application: ONVIF metadata
  • uniform, documented API. (Currently haphazard in terms of naming, what fields are exposed directly vs use an accessors, etc.)
  • quality errors
    • detailed error description text.
    • programmatically inspectable error type.
  • good functional testing coverage. (Currently lightly / unevenly tested.) Most depacketizers have no tests.)
  • fuzz testing. (In progress.)
  • benchmark

Currently very unstable: expect breaking API changes at every release as I work through items above.

Help welcome!

Getting started

Try the mp4 example. It streams from an RTSP server to a .mp4 file until you hit ctrl-C.

$ cargo run --example client mp4 --url rtsp://ip.address.goes.here/ --username admin --password test out.mp4
...
^C

Acknowledgements

This builds on the whole Rust ecosystem. A couple folks have been especially helpful:

Why "retina"?

It's a working name. Other ideas welcome. I started by looking at dictionary words with the letters R, T, S, and P in order and picking out ones related to video:

$ egrep '^r.*t.*s.*p' /usr/share/dict/words'
retinoscope close but too long, thus retina
retrospect good name for an NVR, but I already picked Moonfire
rotascope misspelling of "rotascope" (animation tool) or archaic name for "gyroscope"?

License

Your choice of MIT or Apache; see LICENSE-MIT.txt or LICENSE-APACHE, respectively.