edith
Clone
https://git.tahinli.com/Tahinli/edith.git
0 watching0 forksRust18.3 MiB0563cbfTahinli2 months ago824 commits
| 1 | //! `mp4` is a Rust library to read and write ISO-MP4 files. |
| 2 | //! |
| 3 | //! This package contains MPEG-4 specifications defined in parts: |
| 4 | //! * ISO/IEC 14496-12 - ISO Base Media File Format (QuickTime, MPEG-4, etc) |
| 5 | //! * ISO/IEC 14496-14 - MP4 file format |
| 6 | //! * ISO/IEC 14496-17 - Streaming text format |
| 7 | //! |
| 8 | //! See: [mp4box] for supported MP4 atoms. |
| 9 | //! |
| 10 | //! ### Example |
| 11 | //! |
| 12 | //! ``` |
| 13 | //! use std::fs::File; |
| 14 | //! use std::io::{BufReader}; |
| 15 | //! use mp4::{Result}; |
| 16 | //! |
| 17 | //! fn main() -> Result<()> { |
| 18 | //! let f = File::open("tests/samples/minimal.mp4").unwrap(); |
| 19 | //! let size = f.metadata()?.len(); |
| 20 | //! let reader = BufReader::new(f); |
| 21 | //! |
| 22 | //! let mp4 = mp4::Mp4Reader::read_header(reader, size)?; |
| 23 | //! |
| 24 | //! // Print boxes. |
| 25 | //! println!("major brand: {}", mp4.ftyp.major_brand); |
| 26 | //! println!("timescale: {}", mp4.moov.mvhd.timescale); |
| 27 | //! |
| 28 | //! // Use available methods. |
| 29 | //! println!("size: {}", mp4.size()); |
| 30 | //! |
| 31 | //! let mut compatible_brands = String::new(); |
| 32 | //! for brand in mp4.compatible_brands().iter() { |
| 33 | //! compatible_brands.push_str(&brand.to_string()); |
| 34 | //! compatible_brands.push_str(","); |
| 35 | //! } |
| 36 | //! println!("compatible brands: {}", compatible_brands); |
| 37 | //! println!("duration: {:?}", mp4.duration()); |
| 38 | //! |
| 39 | //! // Track info. |
| 40 | //! for track in mp4.tracks().values() { |
| 41 | //! println!( |
| 42 | //! "track: #{}({}) {} : {}", |
| 43 | //! track.track_id(), |
| 44 | //! track.language(), |
| 45 | //! track.track_type()?, |
| 46 | //! track.box_type()?, |
| 47 | //! ); |
| 48 | //! } |
| 49 | //! Ok(()) |
| 50 | //! } |
| 51 | //! ``` |
| 52 | //! |
| 53 | //! See [examples] for more examples. |
| 54 | //! |
| 55 | //! # Installation |
| 56 | //! |
| 57 | //! Add the following to your `Cargo.toml` file: |
| 58 | //! |
| 59 | //! ```toml |
| 60 | //! [dependencies] |
| 61 | //! mp4 = "0.7.0" |
| 62 | //! ``` |
| 63 | //! |
| 64 | //! [mp4box]: https://github.com/alfg/mp4-rust/blob/master/src/mp4box/mod.rs |
| 65 | //! [examples]: https://github.com/alfg/mp4-rust/tree/master/examples |
| 66 | |
| 67 | |
| 68 | use File; |
| 69 | use BufReader; |
| 70 | |
| 71 | |
| 72 | pub use Error; |
| 73 | |
| 74 | pub type Result<T> = Result; |
| 75 | |
| 76 | |
| 77 | pub use *; |
| 78 | |
| 79 | |
| 80 | pub use *; |
| 81 | |
| 82 | |
| 83 | pub use ; |
| 84 | |
| 85 | |
| 86 | pub use Mp4Reader; |
| 87 | |
| 88 | |
| 89 | pub use ; |
| 90 | |
| 91 | |
| 92 | |
| 93 | |
| 94 | |
| 95 | |
| 96 |