2021-06-04 03:26:45 +04:00
|
|
|
# retina
|
|
|
|
|
2021-06-10 00:50:30 +04:00
|
|
|
[![crates.io version](https://img.shields.io/crates/v/retina.svg)](https://crates.io/crates/retina)
|
|
|
|
[![Documentation](https://docs.rs/retina/badge.svg)](https://docs.rs/retina)
|
2021-06-04 03:26:45 +04:00
|
|
|
[![CI](https://github.com/scottlamb/retina/workflows/CI/badge.svg)](https://github.com/scottlamb/retina/actions?query=workflow%3ACI)
|
|
|
|
|
2021-06-04 09:35:33 +04:00
|
|
|
High-level RTSP multimedia streaming library, in Rust. Good support for
|
2021-06-10 00:50:30 +04:00
|
|
|
ONVIF RTSP/1.0 IP surveillance cameras, as needed by
|
|
|
|
[Moonfire NVR](https://github.com/scottlamb/moonfire-nvr). Works around
|
|
|
|
brokenness in cheap closed-source cameras.
|
2021-06-04 03:26:45 +04:00
|
|
|
|
2022-01-26 11:42:59 +04:00
|
|
|
Status: In production use in Moonfire NVR. Many missing features. Some breaking
|
|
|
|
changes needed to clean up APIs (see [#47](https://github.com/scottlamb/retina/issues/47).)
|
|
|
|
|
2021-06-04 03:26:45 +04:00
|
|
|
Progress:
|
|
|
|
|
|
|
|
* [x] client support
|
2021-12-28 16:43:29 +04:00
|
|
|
* [x] basic authentication.
|
2021-06-10 00:50:30 +04:00
|
|
|
* [x] digest authentication.
|
|
|
|
* [x] RTP over TCP via RTSP interleaved channels.
|
2021-08-28 03:30:55 +04:00
|
|
|
* [x] RTP over UDP (experimental).
|
|
|
|
* * [ ] re-order buffer. (Out-of-order packets are dropped now.)
|
2021-06-10 00:50:30 +04:00
|
|
|
* [x] RTSP/1.0.
|
|
|
|
* [ ] RTSP/2.0.
|
|
|
|
* [ ] SRTP.
|
|
|
|
* [ ] ONVIF backchannel support (for sending audio).
|
|
|
|
* [ ] ONVIF replay mode.
|
|
|
|
* [x] receiving RTCP Sender Reports (currently only uses the timestamp)
|
|
|
|
* [ ] sending RTCP Receiver Reports
|
2021-06-04 03:26:45 +04:00
|
|
|
* [ ] server support
|
2021-06-10 00:50:30 +04:00
|
|
|
* I/O modes
|
|
|
|
* [x] async with tokio
|
2022-01-26 04:11:31 +04:00
|
|
|
* [ ] async-std
|
2021-06-10 02:24:10 +04:00
|
|
|
* [ ] synchronous with std only
|
2021-06-04 03:26:45 +04:00
|
|
|
* codec depacketization
|
2021-06-10 00:50:30 +04:00
|
|
|
* [x] video: H.264
|
|
|
|
([RFC 6184](https://datatracker.ietf.org/doc/html/rfc6184))
|
|
|
|
* [ ] SVC
|
|
|
|
* [ ] periodic infra refresh
|
2021-06-29 01:13:18 +04:00
|
|
|
* [x] multiple slices per picture
|
2021-06-10 00:50:30 +04:00
|
|
|
* [ ] multiple SPS/PPS
|
|
|
|
* [ ] interleaved mode
|
2022-01-26 11:42:59 +04:00
|
|
|
* [x] AAC output format
|
|
|
|
* [ ] Annex B output format ([#44](https://github.com/scottlamb/retina/issues/44))
|
2021-06-10 00:50:30 +04:00
|
|
|
* audio
|
|
|
|
* [x] AAC
|
|
|
|
* [ ] interleaving
|
|
|
|
* [x] [RFC 3551](https://datatracker.ietf.org/doc/html/rfc3551)
|
|
|
|
codecs: G.711, G.723, L8/L16
|
|
|
|
* [x] application: ONVIF metadata
|
2022-01-26 11:42:59 +04:00
|
|
|
* [ ] clean, stable API. (See [#47](https://github.com/scottlamb/retina/issues/47).)
|
2021-07-08 21:52:39 +04:00
|
|
|
* quality errors
|
|
|
|
* * [x] detailed error description text.
|
|
|
|
* * [ ] programmatically inspectable error type.
|
2022-01-26 11:42:59 +04:00
|
|
|
* [ ] good functional testing coverage. (Currently lightly / unevenly tested.
|
2021-06-29 01:13:18 +04:00
|
|
|
Most depacketizers have no tests.)
|
2021-06-10 00:50:30 +04:00
|
|
|
* [ ] fuzz testing. (In progress.)
|
2021-06-10 10:39:27 +04:00
|
|
|
* [x] benchmark
|
2021-06-10 00:50:30 +04:00
|
|
|
|
2021-06-04 03:26:45 +04:00
|
|
|
Help welcome!
|
|
|
|
|
2021-06-10 00:50:30 +04:00
|
|
|
## Getting started
|
|
|
|
|
|
|
|
Try the `mp4` example. It streams from an RTSP server to a `.mp4` file until
|
|
|
|
you hit ctrl-C.
|
|
|
|
|
2021-12-28 16:41:30 +04:00
|
|
|
```shell
|
2021-06-10 00:50:30 +04:00
|
|
|
$ cargo run --example client mp4 --url rtsp://ip.address.goes.here/ --username admin --password test out.mp4
|
|
|
|
...
|
|
|
|
^C
|
|
|
|
```
|
|
|
|
|
2021-12-28 16:41:30 +04:00
|
|
|
## Example client
|
|
|
|
|
|
|
|
```shell
|
|
|
|
$ cargo run --example client <CMD>
|
|
|
|
```
|
|
|
|
|
|
|
|
Where CMD:
|
|
|
|
|
|
|
|
* **info** - Get info about available streams and exit
|
|
|
|
* **mp4** - Write RTSP streams to mp4 file, exit with Ctrl+C
|
|
|
|
* **metadata** - Get realtime onvif metadata if available, exit with Ctrl+C
|
|
|
|
|
2021-06-10 00:50:30 +04:00
|
|
|
## Acknowledgements
|
|
|
|
|
|
|
|
This builds on the whole Rust ecosystem. A couple folks have been especially
|
|
|
|
helpful:
|
|
|
|
|
|
|
|
* Sebastian Dröge, author of
|
|
|
|
[`rtsp-types`](https://crates.io/crates/rtsp-types)
|
|
|
|
* David Holroyd, author of
|
|
|
|
[`h264-reader`](https://crates.io/crates/h264-reader)
|
|
|
|
|
2021-06-04 03:26:45 +04:00
|
|
|
## 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'` | |
|
|
|
|
| ---------------------------------------------- | ---------------------------------------------------------------------------- |
|
|
|
|
| <b>r</b>e<b>t</b>ino<b>s</b>co<b>p</b>e | close but too long, thus `retina` |
|
|
|
|
| <b>r</b>e<b>t</b>ro<b>sp</b>ect | good name for an NVR, but I already picked Moonfire |
|
|
|
|
| <b>r</b>o<b>t</b>a<b>s</b>co<b>p</b>e | misspelling of "rotascope" (animation tool) or archaic name for "gyroscope"? |
|
|
|
|
|
|
|
|
## License
|
|
|
|
|
|
|
|
Your choice of MIT or Apache; see [LICENSE-MIT.txt](LICENSE-MIT.txt) or
|
|
|
|
[LICENSE-APACHE](LICENSE-APACHE.txt), respectively.
|