High-level RTSP multimedia streaming library, in Rust
Go to file
Scott Lamb 9bc2c8eca5 fix typo in RTCP padding parsing
This was accidentally looking at the bottom bit of the V=2 field, so
it effectively never subtracted padding from the payload.

This bug didn't have any effect...yet. We currently only support
parsing the sender report. RFC 3550 says that SRs are sent
in "compound packets" that start with the SR and have at least one
other entry (a CNAME). Only the last packet within the compound packet
can have padding, so it's never come up in SR parsing. Fix this bug now
before we start parsing more things and run into trouble.
2022-04-27 22:23:55 -07:00
.github/workflows CI: fix clippy flags 2022-04-12 14:24:35 -07:00
benches clarify tokio runtime expectations 2022-04-12 13:22:44 -07:00
examples/client mp4 example: mid-stream video param changes 2022-04-11 21:47:46 -07:00
fuzz clarify tokio runtime expectations 2022-04-12 13:22:44 -07:00
src fix typo in RTCP padding parsing 2022-04-27 22:23:55 -07:00
.gitignore initial commit 2021-06-03 16:49:53 -07:00
Cargo.lock prepare v0.3.9 2022-04-12 14:19:24 -07:00
Cargo.toml prepare v0.3.9 2022-04-12 14:19:24 -07:00
CHANGELOG.md prepare v0.3.9 2022-04-12 14:19:24 -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 fix out-of-date cmd name in README 2022-04-04 16:05:25 -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.

Status: In production use in Moonfire NVR. Many missing features. Some breaking changes needed to clean up APIs (see #47.)

Progress:

  • client support
    • basic authentication.
    • digest authentication.
    • RTP over TCP via RTSP interleaved channels.
    • RTP over UDP (experimental).
      • re-order buffer. (Out-of-order packets are dropped now.)
    • 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
    • synchronous with std only
  • codec depacketization
    • video: H.264 (RFC 6184)
      • SVC
      • periodic infra refresh
      • multiple slices per picture
      • multiple SPS/PPS
      • interleaved mode
      • AAC output format
      • Annex B output format (#44)
    • audio
      • AAC
        • interleaving
      • RFC 3551 codecs: G.711, G.723, L8/L16
    • application: ONVIF metadata
  • clean, stable API. (See #47.)
  • 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

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

Example client

$ cargo run --example client <CMD>

Where CMD:

  • info - Gets info about available streams and exits.
  • mp4 - Writes RTSP streams to mp4 file; exit with Ctrl+C.
  • onvif - Gets realtime onvif metadata if available; exit with Ctrl+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.