Skip to main content

Crate revelo_export

Crate revelo_export 

Source
Expand description

Output formatters for the revelo media-metadata library.

Each formatter takes a revelo_core::StreamCollection (the parsed representation of a media file) plus the file path string, and returns a String in the target format. The two primary formats — XML and JSON — target byte-for-byte compatibility with MediaInfoLib’s output so that automated diffing against the reference implementation is possible.

§Formatters

FunctionOutput
to_xmlMediaInfo-compatible XML (schema version 2.0)
to_jsonMediaInfo-compatible JSON
to_textHuman-readable text report (MediaInfo default style)
to_csvCSV with per-kind sections; pipe-friendly
to_summaryCompact aggregate statistics across all streams
to_ebu_coreEBU MXF Core Metadata XML (ebuCore 2015)
to_mpeg7MPEG-7 MediaInformation XML
to_pbcorePBCore 2.x pbcoreDescriptionDocument XML
to_nisoNISO Z39.87 (MIX) technical-metadata XML (pragmatic, not schema-validated)
to_fimsFIMS 1.0 media XML (pragmatic, not schema-validated)
to_graphGraphviz DOT stream-field graph
to_revtmdRevTMD custom XML

§Quick example

use revelo_core::StreamCollection;
use revelo_export::{to_xml, to_json, to_text, to_csv, to_summary};

// Obtain a StreamCollection from revelo-core (parsing happens there).
let streams: StreamCollection = todo!("parse your file here");
let path = "/media/video.mp4";

let xml  = to_xml(&streams, path);
let json = to_json(&streams, path);
let text = to_text(&streams, path);
let csv  = to_csv(&streams, path);
let summary = to_summary(&streams, path);

§Format notes

  • XML / JSON: field ordering and Duration rendering (stored as integer milliseconds, emitted as decimal seconds with 3 fraction digits) match the MediaInfoLib oracle. The <creatingLibrary> / creatingLibrary header that upstream emits is intentionally omitted — it identifies the producing tool, not the file.
  • Text: uses MediaInfo’s friendly field labels (“Bit rate”, “Frame rate mode”) and humanised values (“5.26 MiB”, “1 min 0 s”, “734 kb/s”).
  • CSV: one section per stream kind; the first data row is field names, subsequent rows are stream positions; values containing commas or quotes are RFC 4180 escaped.
  • Summary: aggregates codec lists, resolution ranges, channel counts, and sample rates across all streams of each kind.

Re-exports§

pub use csv::to_csv;
pub use ebu_core::to_ebu_core;
pub use fims::to_fims;
pub use graph::to_graph;
pub use json::to_json;
pub use mpeg7::to_mpeg7;
pub use niso::to_niso;
pub use pbcore::to_pbcore;
pub use revtmd::to_revtmd;
pub use summary::to_summary;
pub use text::to_text;
pub use xml::to_xml;

Modules§

csv
CSV output — machine-readable format for pipeline integration.
ebu_core
fims
graph
json
JSON output — matches mediainfo --Output=JSON byte structure.
mpeg7
niso
pbcore
revtmd
summary
Summary output — aggregate statistics across all streams.
text
Human-readable Text output — the default mediainfo format.
xml
XML formatter matching MediaInfoLib’s --Output=XML schema and formatting exactly.