https://github.com/namachan10777/movparse
https://github.com/namachan10777/movparse
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/namachan10777/movparse
- Owner: namachan10777
- Created: 2022-12-15T12:17:26.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2022-12-21T19:11:01.000Z (over 2 years ago)
- Last Synced: 2025-04-30T20:05:13.118Z (about 2 months ago)
- Language: Rust
- Size: 49.8 KB
- Stars: 5
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# movparse
**_This library is under development_**
[](https://github.com/namachan10777/movparse/actions/workflows/ci.yml)
Derive-macro base async-aware mp4 family (`quicktime`, `mp4` and more) parser.
```rust, no_run
use std::path::PathBuf;
use clap::Parser;
use movparse::{Reader, RootRead, BoxRead, U32Tag, BoxHeader};
use tokio::fs;#[derive(BoxRead, Debug, PartialEq, Eq)]
#[mp4(boxtype = "leaf")]
#[mp4(tag = "ftyp")]
pub struct Ftyp {
#[mp4(header)]
pub header: BoxHeader,
pub major_brand: U32Tag,
pub minor_version: U32Tag,
pub compatible_brands: Vec,
}#[derive(RootRead, Debug, PartialEq, Eq)]
pub struct QuickTime {
pub ftyp: Ftyp,
}#[derive(Parser)]
struct Opts {
file: PathBuf,
}#[tokio::main]
async fn main() -> anyhow::Result<()> {
let opts = Opts::parse();
let file = fs::File::open(opts.file).await?;
let limit = file.metadata().await?.len();
let mut reader = Reader::new(file, limit);
let mp4 = QuickTime::read(&mut reader).await?;
println!("{:#?}", mp4);
Ok(())
}
```