Skip to content

jenslar/mp4iter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rust crate for moving around in MP4 containers. Does not and will not support any kind of media de/encoding.

Usage (not yet on crates.io):

Cargo.toml:

[dependencies]
mp4iter = {git = "https://github.com/jenslar/mp4iter.git"}

src/main.rs:

use mp4iter::Mp4;
use std::path::Path;

fn main() -> std::io::Result<()> {
    let mp4 = Mp4::new(Path::new("VIDEO.MP4"))?;

    for atom_header in mp4.into_iter() {
        println!("{atom_header:?}")
    }

    // Derives duration for MP4 for longest track.
    println!("{:?}", mp4.duration());

    // Extracts track data for GoPro GPMF telemetry (handle name 'GoPro MET')
    let mut track = mp4.track("GoPro MET")?;
    println!("{track:#?}");

    // Iterate over raw sample data. Yields `Result<Cursor<Vec<u8>>, Mp4Error>>`.
    for result in track.data() {
        println!("{result:?});
    }

    Ok(())
}

About

Iterate over MP4-containers

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages