moonfire-ffmpeg

Crates.iomoonfire-ffmpeg
lib.rsmoonfire-ffmpeg
version0.0.2
sourcesrc
created_at2021-05-11 16:25:39.026503
updated_at2022-03-08 19:13:14.575568
descriptionsafe wrapper around select parts of ffmpeg
homepage
repositoryhttps://github.com/scottlamb/moonfire-ffmpeg
max_upload_size
id396127
size159,379
Scott Lamb (scottlamb)

documentation

README

moonfire-ffmpeg

A Rust wrapper around select parts of ffmpeg needed for Moonfire NVR:

  • basic streaming: connecting to a RTSP stream. (Though eventually I want Moonfire NVR to do this in pure Rust; see scottlamb/moonfire-nvr#37.)
  • video analytics: decoding H.264 (likely also H.265 eventually; and eventually with hardware acceleration), converting its colorspace to RGB, and downscaling it to feed to moonfire-tflite.

There's a much more full-featured ffmpeg crate. A few reasons I use my own instead though:

  • the ffmpeg crate isn't actively maintained. (There are some forks though. Maybe ffmpeg4 is what you're looking for.)
  • building moonfire-ffmpeg doesn't need bindgen, which can be a pain to install on some platforms. (See its requirements.) Instead, moonfire-ffmpeg uses a very thin C wrapper around ffmpeg to avoid baking in (possibly version-specific) details of the ffmpeg ABI such as struct layouts.
  • moonfire-ffmpeg checks ABI compatibility between the ffmpeg it was compiled with and the ffmpeg it's actually running with, which is important for making it fool-proof with shared libraries. I think the ffmpeg crate is more intended to be used with a static library.
  • moonfire-ffmpeg exposes a few very specific pieces of the ffmpeg API that I needed and the ffmpeg crate doesn't, such as reading non-understood parameters to avcodec_open2.
  • moonfire-ffmpeg is licensed under MIT and Apache-2.0, vs the ffmpeg crate's WTFPL. I consider this an advantage for moonfire-ffmpeg because WTFPL scares away some people and companies.
Commit count: 19

cargo fmt