diff --git a/Cargo.lock b/Cargo.lock index 43ef71d2c436..9050249d3c88 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5272,7 +5272,7 @@ dependencies = [ [[package]] name = "re_mp4" version = "0.1.0" -source = "git+https://github.com/rerun-io/re_mp4?rev=3236c76f9228cf6ab0b2bfb1b8f9ffcde975ea05#3236c76f9228cf6ab0b2bfb1b8f9ffcde975ea05" +source = "git+https://github.com/rerun-io/re_mp4?rev=4705e85f62ddb47c32d9c091d8f0662068211bc8#4705e85f62ddb47c32d9c091d8f0662068211bc8" dependencies = [ "byteorder", "bytes", diff --git a/Cargo.toml b/Cargo.toml index e5e758669a36..b989ecac7125 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -550,7 +550,7 @@ missing_errors_doc = "allow" # commit on `rerun-io/mp4` `master` branch: https://github.com/rerun-io/re_mp4/tree/master # https://github.com/rerun-io/mp4/commit/3236c76f9228cf6ab0b2bfb1b8f9ffcde975ea05 -re_mp4 = { git = "https://github.com/rerun-io/re_mp4", rev = "3236c76f9228cf6ab0b2bfb1b8f9ffcde975ea05" } +re_mp4 = { git = "https://github.com/rerun-io/re_mp4", rev = "4705e85f62ddb47c32d9c091d8f0662068211bc8" } # commit on `rerun-io/re_arrow2` `main` branch # https://github.com/rerun-io/re_arrow2/commit/e4717d6debc6d4474ec10db8f629f823f57bad07 diff --git a/crates/store/re_video/src/mp4.rs b/crates/store/re_video/src/mp4.rs index 9d62678f547c..3cb069616d4b 100644 --- a/crates/store/re_video/src/mp4.rs +++ b/crates/store/re_video/src/mp4.rs @@ -3,7 +3,7 @@ use super::{Config, Sample, Segment, Time, Timescale, VideoData, VideoLoadError}; pub fn load_mp4(bytes: &[u8]) -> Result { - let mp4 = re_mp4::read(bytes)?; + let mp4 = re_mp4::Mp4::read_bytes(bytes)?; let mp4_tracks = mp4.tracks().iter().map(|(k, t)| (*k, t.kind)).collect(); @@ -86,7 +86,10 @@ pub fn load_mp4(bytes: &[u8]) -> Result { fn unknown_codec_fourcc(mp4: &re_mp4::Mp4, track: &re_mp4::Track) -> re_mp4::FourCC { let stsd = &track.trak(mp4).mdia.minf.stbl.stsd; - stsd.unknown.first().copied().unwrap_or_default() + match &stsd.contents { + re_mp4::StsdBoxContent::Unknown(four_cc) => *four_cc, + _ => Default::default(), + } } /// Returns whether a buffer is MP4 video data. diff --git a/docs/content/reference/video.md b/docs/content/reference/video.md index b003cb7a9edc..3ff90b4441a3 100644 --- a/docs/content/reference/video.md +++ b/docs/content/reference/video.md @@ -40,13 +40,15 @@ Video playback is done using the browser's own video decoder, so the supported c Overall, we recommend using Chrome or another Chromium-based browser, as it seems to have the best video support as of writing. -When choosing a codec, we recommend [AV1](https://developer.mozilla.org/en-US/docs/Web/Media/Formats/Video_codecs#av1), as that seems to have the best overall playback support. Since AV1 is patent-free, it is also likely the first codec we will support in the native viewer. +When choosing a codec, we recommend [AV1](https://developer.mozilla.org/en-US/docs/Web/Media/Formats/Video_codecs#av1), +as it seems to have the best overall playback support while also having very high compression quality. +Since AV1 is patent-free, it is also likely the first codec we will support in the native viewer. For decoding video in the Web Viewer, we use the [WebCodecs API](https://developer.mozilla.org/en-US/docs/Web/API/WebCodecs_API). This API enables us to take advantage of the browser's hardware accelerated video decoding capabilities. It is implemented by all modern browsers, but with varying levels of support for different codecs, and varying levels of quality. -With that in mind, here are the browsers which we have tested and verified to work: +With that in mind, here are the browsers which we have tested and verified to generally work: | | Linux | macOS | Windows | | ---------- | ------ | ----- | ------- | @@ -64,12 +66,16 @@ which codecs are supported by which browser, see [Video codecs on MDN](https://d At the moment, we test the following codecs: -| | Linux | macOS | Windows | -| ----- | ----- | ------- | ------- | -| AV1 | ✅ | 🚧[^4] | ✅ | -| H.264 | ✅ | ✅ | ✅ | +| | Linux Firefox | Linux Chrome | macOS Firefox | macOS Chrome | macOS Safari | Windows Firefox | Windows Chrome | +| ---------- | ------------- | ------------ | ------------- | ------------ | ------------ | --------------- | -------------- | +| AV1 | ✅ | ✅ | ✅ | ✅ | 🚧[^4] | ✅ | ✅ | +| H.264/avc | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | +| H.265/hevc | ❌ | ❌ | ❌ | ✅ | 🚧[^6] | ❌ | 🚧[^7] | [^4]: Safari/WebKit does not support AV1 decoding except on [Apple Silicon devices with hardware support](https://webkit.org/blog/14445/webkit-features-in-safari-17-0/). +[^5]: Firefox does not support H.265 decoding on any platform. +[^6]: Safari/WebKit has been observed suttering when playing `hvc1` but working fine with `hevc1`. Despite support being advertised Safari 16.5 has been observed not support H.265 decoding. +[^7]: Only supported if hardware encoding is available. Therefore always affected by Windows stuttering issues, see [^3]. ## Links * [Web video codec guide, by Mozilla](https://developer.mozilla.org/en-US/docs/Web/Media/Formats/Video_codecs)