1
0
Fork 0
mirror of https://github.com/alfg/mp4-rust.git synced 2024-05-30 05:28:05 +00:00

update mp4info and mp4dump examples.

This commit is contained in:
Alf 2020-09-01 20:49:55 -07:00
parent b4b4dbd49f
commit 042629a88c
2 changed files with 25 additions and 10 deletions

View file

@ -85,6 +85,9 @@ fn get_boxes(file: File) -> Result<Vec<Box>> {
if let Some(ref avc1) = &stbl.stsd.avc1 {
boxes.push(build_box(avc1));
}
if let Some(ref hev1) = &stbl.stsd.hev1 {
boxes.push(build_box(hev1));
}
if let Some(ref mp4a) = &stbl.stsd.mp4a {
boxes.push(build_box(mp4a));
}

View file

@ -61,16 +61,28 @@ fn info<P: AsRef<Path>>(filename: &P) -> Result<()> {
}
fn video_info(track: &Mp4Track) -> Result<String> {
Ok(format!(
"{} ({}) ({:?}), {}x{}, {} kb/s, {:.2} fps",
track.media_type()?,
track.video_profile()?,
track.box_type()?,
track.width(),
track.height(),
track.bitrate() / 1000,
track.frame_rate_f64()
))
if track.trak.mdia.minf.stbl.stsd.avc1.is_some() {
Ok(format!(
"{} ({}) ({:?}), {}x{}, {} kb/s, {:.2} fps",
track.media_type()?,
track.video_profile()?,
track.box_type()?,
track.width(),
track.height(),
track.bitrate() / 1000,
track.frame_rate_f64()
))
} else {
Ok(format!(
"{} ({:?}), {}x{}, {} kb/s, {:.2} fps",
track.media_type()?,
track.box_type()?,
track.width(),
track.height(),
track.bitrate() / 1000,
track.frame_rate_f64()
))
}
}
fn audio_info(track: &Mp4Track) -> Result<String> {