{"id":13907650,"url":"https://github.com/alfg/mp4-rust","last_synced_at":"2025-05-15T07:04:35.353Z","repository":{"id":37792937,"uuid":"232485720","full_name":"alfg/mp4-rust","owner":"alfg","description":"MP4 reader + writer library in Rust! 🎥🦀","archived":false,"fork":false,"pushed_at":"2024-06-15T05:18:14.000Z","size":518,"stargazers_count":321,"open_issues_count":34,"forks_count":93,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-05-12T04:51:13.552Z","etag":null,"topics":["isobmff","mp4","qt","reader","rust","video","writer"],"latest_commit_sha":null,"homepage":"https://crates.io/crates/mp4","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/alfg.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-01-08T05:32:00.000Z","updated_at":"2025-05-03T06:39:14.000Z","dependencies_parsed_at":"2024-04-09T01:49:36.271Z","dependency_job_id":"be510808-9d28-46f0-aa23-6961d3e79fb6","html_url":"https://github.com/alfg/mp4-rust","commit_stats":{"total_commits":123,"total_committers":21,"mean_commits":5.857142857142857,"dds":0.4796747967479674,"last_synced_commit":"a3508fe1c92561a498a88fac814598f33ad98845"},"previous_names":[],"tags_count":24,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alfg%2Fmp4-rust","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alfg%2Fmp4-rust/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alfg%2Fmp4-rust/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alfg%2Fmp4-rust/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alfg","download_url":"https://codeload.github.com/alfg/mp4-rust/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254292039,"owners_count":22046426,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["isobmff","mp4","qt","reader","rust","video","writer"],"created_at":"2024-08-06T23:02:04.077Z","updated_at":"2025-05-15T07:04:35.257Z","avatar_url":"https://github.com/alfg.png","language":"Rust","funding_links":[],"categories":["HarmonyOS","Rust"],"sub_categories":["Windows Manager"],"readme":"# mp4\n\u003e MP4 Reader and Writer in Rust 🦀\n\n`mp4` is a Rust library to read and write ISO-MP4 files. This package contains MPEG-4 specifications defined in parts:\n* [ISO/IEC 14496-12](https://en.wikipedia.org/wiki/ISO/IEC_base_media_file_format) - ISO Base Media File Format (QuickTime, MPEG-4, etc)\n* [ISO/IEC 14496-14](https://en.wikipedia.org/wiki/MPEG-4_Part_14) - MP4 file format\n* ISO/IEC 14496-17 - Streaming text format\n\nhttps://crates.io/crates/mp4\n\n[![Crates.io](https://img.shields.io/crates/v/mp4)](https://crates.io/crates/mp4)\n[![Crates.io](https://img.shields.io/crates/d/mp4)](https://crates.io/crates/mp4)\n[![Docs](https://img.shields.io/badge/docs-online-5023dd.svg?style=flat-square)](https://docs.rs/mp4)\n[![Rust](https://github.com/alfg/mp4-rust/workflows/Rust/badge.svg)](https://github.com/alfg/mp4-rust/actions)\n\n#### Example\n```rust\nuse std::fs::File;\nuse std::io::{BufReader};\nuse mp4::{Result};\n\nfn main() -\u003e Result\u003c()\u003e {\n    let f = File::open(\"tests/samples/minimal.mp4\").unwrap();\n    let size = f.metadata()?.len();\n    let reader = BufReader::new(f);\n\n    let mp4 = mp4::Mp4Reader::read_header(reader, size)?;\n\n    // Print boxes.\n    println!(\"major brand: {}\", mp4.ftyp.major_brand);\n    println!(\"timescale: {}\", mp4.moov.mvhd.timescale);\n\n    // Use available methods.\n    println!(\"size: {}\", mp4.size());\n\n    let mut compatible_brands = String::new();\n    for brand in mp4.compatible_brands().iter() {\n        compatible_brands.push_str(\u0026brand.to_string());\n        compatible_brands.push_str(\",\");\n    }\n    println!(\"compatible brands: {}\", compatible_brands);\n    println!(\"duration: {:?}\", mp4.duration());\n\n    // Track info.\n    for track in mp4.tracks().values() {\n        println!(\n            \"track: #{}({}) {} : {}\",\n            track.track_id(),\n            track.language(),\n            track.track_type()?,\n            track.box_type()?,\n        );\n    }\n    Ok(())\n}\n```\n\nSee [examples/](examples/) for more examples.\n\n#### Install\n```\ncargo add mp4\n```\nor add to your `Cargo.toml`:\n```toml\nmp4 = \"0.14.0\"\n```\n\n#### Documentation\n* https://docs.rs/mp4/\n\n## Development\n\n#### Requirements\n* [Rust](https://www.rust-lang.org/)\n\n#### Build\n```\ncargo build\n```\n\n#### Lint and Format\n```\ncargo clippy --fix\ncargo fmt --all\n```\n\n#### Run Examples\n* `mp4info`\n```\ncargo run --example mp4info \u003cmovie.mp4\u003e\n```\n\n* `mp4dump`\n```\ncargo run --example mp4dump \u003cmovie.mp4\u003e\n```\n\n#### Run Tests\n```\ncargo test\n```\n\nWith print statement output.\n```\ncargo test -- --nocapture\n```\n\n#### Run Cargo fmt\nRun fmt to catch formatting errors.\n\n```\nrustup component add rustfmt\ncargo fmt --all -- --check\n```\n\n#### Run Clippy\nRun Clippy tests to catch common lints and mistakes.\n\n```\nrustup component add clippy\ncargo clippy --no-deps -- -D warnings\n```\n\n#### Run Benchmark Tests\n```\ncargo bench\n```\n\nView HTML report at `target/criterion/report/index.html`\n\n#### Generate Docs\n```\ncargo docs\n```\n\nView at `target/doc/mp4/index.html`\n\n## Web Assembly\nSee the [mp4-inspector](https://github.com/alfg/mp4-inspector) project as a reference for using this library in Javascript via Web Assembly.\n\n## Related Projects\n* https://github.com/mozilla/mp4parse-rust\n* https://github.com/pcwalton/rust-media\n* https://github.com/alfg/mp4\n\n## License\nMIT\n\n[docs]: https://docs.rs/mp4\n[docs-badge]: https://img.shields.io/badge/docs-online-5023dd.svg?style=flat-square\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falfg%2Fmp4-rust","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falfg%2Fmp4-rust","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falfg%2Fmp4-rust/lists"}