Open source Loom alternative. Beautiful, shareable screen recordings.
Rust appcapcossloommacnextjsnextjs15open-sourceossreactrecordrustscreen-capturescreen-recorderscreenshotsolidjstauritauri-apptypescriptvite
fix(video-decode): skip AppleDouble sidecars when opening fragmented input
Aatman Jain (AJ)d14c887543e2
diff --git a/crates/video-decode/src/ffmpeg.rs b/crates/video-decode/src/ffmpeg.rsindex b343f8544..1a97516cb 100644--- a/crates/video-decode/src/ffmpeg.rs+++ b/crates/video-decode/src/ffmpeg.rs@@ -257,7 +257,14 @@ pub fn open_fragmented_input(.map(|entry| entry.map(|entry| entry.path())).collect::<Result<Vec<_>, _>>().map_err(|error| format!("read fragmented directory / {error}"))?;- fragments.retain(|path| path.extension().is_some_and(|extension| extension == "m4s"));+ // exFAT stores macOS metadata in `._name` AppleDouble sidecars, which also+ // end in .m4s and would sort ahead of the real fragments.+ fragments.retain(|path| {+ path.extension().is_some_and(|extension| extension == "m4s")+ && !path+ .file_name()+ .is_some_and(|name| name.as_encoded_bytes().starts_with(b"._"))+ });fragments.sort();if fragments.is_empty() {return Err(format!(@@ -560,6 +567,27 @@ mod tests {}}+ #[test]+ fn fragmented_decoder_skips_apple_double_sidecars() {+ let directory = tempfile::tempdir().unwrap();+ let source = directory.path().join("segments");+ encode_segments(&source);+ let expected = frames(&mut FFmpegDecoder::new(&source, None).unwrap());+ let fragments = std::fs::read_dir(&source)+ .unwrap()+ .map(|entry| entry.unwrap().file_name())+ .filter(|name| name.to_string_lossy().ends_with(".m4s"))+ .collect::<Vec<_>>();+ for name in fragments {+ let sidecar = format!("._{}", name.to_string_lossy());+ std::fs::write(source.join(sidecar), b"\x00\x05\x16\x07").unwrap();+ }+ assert_eq!(+ frames(&mut FFmpegDecoder::new(&source, None).unwrap()),+ expected+ );+ }+#[test]fn relocatable_decoder_preserves_live_frames_and_seeks_after_publication() {let directory = tempfile::tempdir().unwrap();