Open source Loom alternative. Beautiful, shareable screen recordings.
Rust appcapcossloommacnextjsnextjs15open-sourceossreactrecordrustscreen-capturescreen-recorderscreenshotsolidjstauritauri-apptypescriptvite
wip: Audio sync improvements + UI changes
Richie McIlroy93bd55eb2cb2
diff --git a/apps/desktop/package.json b/apps/desktop/package.jsonindex e9f08d6fb..fff5cfb06 100644--- a/apps/desktop/package.json+++ b/apps/desktop/package.json@@ -12,6 +12,8 @@"@cap/ui": "workspace:*","@cap/utils": "workspace:*","@tauri-apps/api": "^1.5.0",+ "@tensorflow-models/body-pix": "^2.2.1",+ "@tensorflow/tfjs": "^4.17.0","autoprefixer": "^10.4.16","cookies-next": "^4.1.0","date-fns": "^3.2.0",diff --git a/apps/desktop/src-tauri/Cargo.lock b/apps/desktop/src-tauri/Cargo.lockindex 2e1fd8336..3ec7d95ae 100644--- a/apps/desktop/src-tauri/Cargo.lock+++ b/apps/desktop/src-tauri/Cargo.lock@@ -499,6 +499,7 @@ dependencies = ["dotenv_codegen","ffmpeg-sidecar","futures",+ "regex","reqwest","serde","serde_json",diff --git a/apps/desktop/src-tauri/Cargo.toml b/apps/desktop/src-tauri/Cargo.tomlindex 8d8b0a1b9..d358dd16d 100644--- a/apps/desktop/src-tauri/Cargo.toml+++ b/apps/desktop/src-tauri/Cargo.toml@@ -33,6 +33,7 @@ chrono = "0.4.33"dotenv_codegen = "0.15.0"byteorder = "1.4.3"bytemuck = "1.14.3"+regex = "1"[features]# this feature is used for production builds or when `devPath` points to the filesystemdiff --git a/apps/desktop/src-tauri/src/audio.rs b/apps/desktop/src-tauri/src/audio.rsindex 667327909..8f4c9acab 100644--- a/apps/desktop/src-tauri/src/audio.rs+++ b/apps/desktop/src-tauri/src/audio.rs@@ -4,9 +4,9 @@ use std::process::{Stdio};use byteorder::{ByteOrder, LittleEndian};use std::sync::{Arc};-use tokio::sync::Mutex;use tokio::io::{AsyncWriteExt};use tokio::process::{Command, ChildStdin};+use tokio::sync::{mpsc, Mutex};use crate::recording::RecordingOptions;use crate::utils::{ffmpeg_path_as_str, monitor_and_log_recording_start};@@ -17,6 +17,7 @@ pub struct AudioRecorder {ffmpeg_stdin: Option<Arc<Mutex<ChildStdin>>>,device_name: Option<String>,stream: Option<cpal::Stream>,+ audio_channel_sender: Option<mpsc::Sender<Vec<u8>>>,}impl AudioRecorder {@@ -28,6 +29,7 @@ impl AudioRecorder {ffmpeg_stdin: None,device_name: None,stream: None,+ audio_channel_sender: None,}}@@ -37,6 +39,8 @@ impl AudioRecorder {let host = cpal::default_host();let devices = host.devices().expect("Failed to get devices");let (tx, mut rx) = tokio::sync::mpsc::channel::<Vec<u8>>(32);+ let tx_clone = tx.clone();+ self.audio_channel_sender = Some(tx);let mut input_devices = devices.filter_map(|device| {let supported_input_configs = device.supported_input_configs();@@ -103,13 +107,18 @@ impl AudioRecorder {"-f", sample_format,"-ar", &sample_rate_str,"-ac", &channels_str,- "-i", "-",+ "-i", "pipe:0","-c:a", "aac","-b:a", "128k","-af", &audio_filters_str,"-f", "segment","-segment_time", "3","-segment_list", &segment_list_filename,+ "-reset_timestamps", "1",+ "-use_wallclock_as_timestamps", "1",+ "-fflags", "nobuffer",+ "-flags", "low_delay",+ "-strict", "experimental",&output_chunk_pattern,].into_iter().map(|s| s.to_string()).collect();@@ -143,7 +152,7 @@ impl AudioRecorder {&config.into(),move |data: &[i8], _: &_| {let bytes = data.iter().map(|&sample| sample as u8).collect::<Vec<u8>>();- if tx.try_send(bytes).is_err() {+ if tx_clone.try_send(bytes).is_err() {eprintln!("Channel send error. Dropping data.");}},@@ -155,7 +164,7 @@ impl AudioRecorder {move |data: &[i16], _: &_| {let mut bytes = vec![0; data.len() * 2];LittleEndian::write_i16_into(data, &mut bytes);- if tx.try_send(bytes).is_err() {+ if tx_clone.try_send(bytes).is_err() {eprintln!("Channel send error. Dropping data.");}},@@ -167,7 +176,7 @@ impl AudioRecorder {move |data: &[i32], _: &_| {let mut bytes = vec![0; data.len() * 4];LittleEndian::write_i32_into(data, &mut bytes);- if tx.try_send(bytes).is_err() {+ if tx_clone.try_send(bytes).is_err() {eprintln!("Channel send error. Dropping data.");}},@@ -178,7 +187,7 @@ impl AudioRecorder {&config.into(),move |data: &[f32], _: &_| {let bytes = bytemuck::cast_slice::<f32, u8>(data).to_vec();- if tx.try_send(bytes).is_err() {+ if tx_clone.try_send(bytes).is_err() {eprintln!("Channel send error. Dropping data.");}},@@ -212,6 +221,10 @@ impl AudioRecorder {}pub async fn stop_audio_recording(&mut self) -> Result<(), String> {+ if let Some(sender) = self.audio_channel_sender.take() {+ drop(sender);+ }+if let Some(ref mut stream) = self.stream {stream.pause().map_err(|_| "Failed to pause stream")?;println!("Audio recording paused.");@@ -219,25 +232,21 @@ impl AudioRecorder {return Err("Recording was not started".to_string());}- if let Some(stdin_arc) = &self.ffmpeg_stdin {- drop(stdin_arc); // Explicitly drop the stdin Arc<Mutex<ChildStdin>> to close stdin.- println!("Stdin closed for FFmpeg process.");- }-- println!("Killing FFmpeg process...");- if let Some(ref mut child) = self.ffmpeg_process {- match child.kill().await {- Ok(_) => println!("FFmpeg process was killed successfully."),- Err(e) => return Err(format!("Failed to kill FFmpeg process: {}", e)),+ println!("Sending quit command to FFmpeg...");+ if let Some(stdin_arc) = self.ffmpeg_stdin.take() {+ let mut stdin_guard = stdin_arc.lock().await;+ if let Err(e) = stdin_guard.write_all(b"q\n").await {+ eprintln!("Failed to send quit command to FFmpeg: {}", e);+ return Err("Failed to send quit command to FFmpeg".to_string());}- // Await the process to ensure it has been terminated.- match child.wait().await {- Ok(status) => println!("FFmpeg process terminated with status: {}", status),- Err(e) => println!("Error waiting for FFmpeg process to terminate: {}", e),- }- } else {- return Err("FFmpeg process was not started".to_string());+ stdin_guard.flush().await.expect("Failed to flush FFmpeg stdin");++ println!("Quit command sent to FFmpeg. Waiting for FFmpeg to process...");++ tokio::time::sleep(std::time::Duration::from_millis(500)).await;++ println!("Finalizing FFmpeg process...");}println!("Audio recording stopped.");diff --git a/apps/desktop/src-tauri/src/recording.rs b/apps/desktop/src-tauri/src/recording.rsindex 187f75209..b7dbc03b8 100644--- a/apps/desktop/src-tauri/src/recording.rs+++ b/apps/desktop/src-tauri/src/recording.rs@@ -12,6 +12,7 @@ use tokio::io::{AsyncWriteExt};use serde::{Serialize, Deserialize};use tauri::State;use tokio::process::{Command, ChildStderr, ChildStdin};+use tokio::join;use crate::utils::{ffmpeg_path_as_str, monitor_and_log_recording_start};use crate::upload::upload_file;@@ -69,8 +70,6 @@ pub async fn start_dual_recording(let audio_chunks_dir = data_dir.join("chunks/audio");clean_and_create_dir(&screen_chunks_dir)?;clean_and_create_dir(&audio_chunks_dir)?;-- state_guard.audio_process = Some(AudioRecorder::new());let audio_name = if options.audio_name.is_empty() {None@@ -118,24 +117,20 @@ pub async fn start_dual_recording(println!("Screen args: {:?}", ffmpeg_screen_args);- if let Some(ref mut audio_process) = state_guard.audio_process {- let audio_file_path = audio_chunks_dir.to_str().unwrap();- audio_process.start_audio_recording(options.clone(), audio_file_path, audio_name.as_deref()).await.map_err(|e| e.to_string())?;- }-- println!("Starting screen recording process...");-- let (screen_child, screen_stderr, screen_stdin) = start_screen_recording_process(&ffmpeg_binary_path_str, &ffmpeg_screen_args)- .await- .map_err(|e| e.to_string())?;-- println!("Screen recording process started.");+ // Prepare screen and audio recording concurrently+ let ffmpeg_binary_path_str = ffmpeg_path_as_str()?;+ let screen_recording_preparation = prepare_screen_recording(&ffmpeg_binary_path_str, &options, &screen_chunks_dir);+ let audio_recording_preparation = prepare_audio_recording(&options, &audio_chunks_dir);- let video_id_clone = options.video_id.clone();- let screen_started_future = monitor_and_log_recording_start(screen_stderr, &video_id_clone, "video");+ // Start both recordings concurrently+ let (screen_recording_result, audio_recording_result) = join!(+ screen_recording_preparation,+ audio_recording_preparation+ );- let _ = screen_started_future.await.map_err(|e| e.to_string())?;-+ // Handle the results of both operations+ let (screen_child, screen_stdin) = screen_recording_result.map_err(|e| e.to_string())?;+ let audio_process = audio_recording_result.map_err(|e| e.to_string())?;let options_clone = state_guard.recording_options.clone();@@ -155,6 +150,7 @@ pub async fn start_dual_recording(println!("Set screen child");state_guard.screen_process_stdin = Some(screen_stdin);println!("Set screen stdin");+ state_guard.audio_process = Some(audio_process);state_guard.upload_handles = Mutex::new(vec![]);state_guard.recording_options = Some(options.clone());state_guard.shutdown_flag = shutdown_flag.clone();@@ -187,11 +183,6 @@ pub async fn stop_all_recordings(state: State<'_, Arc<Mutex<RecordingState>>>) -let mut guard = state.lock().await;- if let Some(mut audio_process) = guard.audio_process.take() {- println!("Stopping audio recording...");- audio_process.stop_audio_recording().await.expect("Failed to stop audio recording");- }-println!("Stopping screen recording...");if let Some(stdin) = guard.screen_process_stdin.take() {@@ -201,6 +192,11 @@ pub async fn stop_all_recordings(state: State<'_, Arc<Mutex<RecordingState>>>) -}}+ if let Some(mut audio_process) = guard.audio_process.take() {+ println!("Stopping audio recording...");+ audio_process.stop_audio_recording().await.expect("Failed to stop audio recording");+ }+guard.shutdown_flag.store(true, Ordering::SeqCst);while !guard.video_uploading_finished.load(Ordering::SeqCst)@@ -257,15 +253,18 @@ async fn construct_recording_args("macos" => {Ok(vec!["-f".to_string(), "avfoundation".to_string(),- "-framerate".to_string(), fps.to_string(),+ "-framerate".to_string(), "240".to_string(),"-capture_cursor".to_string(), "1".to_string(),"-thread_queue_size".to_string(), "512".to_string(),"-i".to_string(), format!("{}", input_index),+ "-probesize".to_string(), "32".to_string(),+ "-analyzeduration".to_string(), "0".to_string(),"-c:v".to_string(), codec,"-preset".to_string(), preset,+ "-tune".to_string(), "zerolatency".to_string(),"-pix_fmt".to_string(), pix_fmt,"-g".to_string(), gop,- "-r".to_string(), fps.to_string(),+ "-r".to_string(), "60".to_string(),"-an".to_string(),"-f".to_string(), "segment".to_string(),"-segment_time".to_string(), segment_time,@@ -273,6 +272,10 @@ async fn construct_recording_args("-segment_list".to_string(), segment_list_filename,"-segment_list_type".to_string(), segment_list_type,"-reset_timestamps".to_string(), "1".to_string(),+ "-use_wallclock_as_timestamps".to_string(), "1".to_string(),+ "-fflags".to_string(), "nobuffer".to_string(),+ "-flags".to_string(), "low_delay".to_string(),+ "-strict".to_string(), "experimental".to_string(),output_filename_pattern,])},@@ -456,6 +459,36 @@ async fn upload_jpeg_files(Ok(())}+async fn prepare_screen_recording(+ ffmpeg_binary_path_str: &str,+ options: &RecordingOptions,+ screen_chunks_dir: &Path,+) -> Result<(tokio::process::Child, ChildStdin), String> {+ let ffmpeg_screen_args = construct_recording_args(options, screen_chunks_dir, "screen", &options.screen_index).await.map_err(|e| e.to_string())?;+ let (screen_child, mut screen_stderr, screen_stdin) = start_screen_recording_process(ffmpeg_binary_path_str, &ffmpeg_screen_args).await.map_err(|e| e.to_string())?;++ let video_id = options.video_id.clone();+ tokio::spawn(async move {+ if let Err(e) = monitor_and_log_recording_start(screen_stderr, &video_id, "video").await {+ eprintln!("Error monitoring screen recording start: {}", e);+ }+ });++ Ok((screen_child, screen_stdin))+}++async fn prepare_audio_recording(+ options: &RecordingOptions,+ audio_chunks_dir: &Path,+) -> Result<AudioRecorder, String> {+ // Assuming `AudioRecorder::start_audio_recording` is an async function.+ // Prepare your AudioRecorder and start recording+ let mut audio_recorder = AudioRecorder::new();+ let audio_file_path = audio_chunks_dir.to_str().unwrap(); // Handle errors as needed+ audio_recorder.start_audio_recording(options.clone(), audio_file_path, None).await?;+ Ok(audio_recorder)+}+async fn start_screen_recording_process(ffmpeg_binary_path_str: &str, ffmpeg_screen_args: &[String]) -> Result<(tokio::process::Child, ChildStderr, ChildStdin), io::Error> {let mut child = Command::new(ffmpeg_binary_path_str).args(ffmpeg_screen_args)diff --git a/apps/desktop/src-tauri/src/utils.rs b/apps/desktop/src-tauri/src/utils.rsindex 7c54d5b80..f33cb3031 100644--- a/apps/desktop/src-tauri/src/utils.rs+++ b/apps/desktop/src-tauri/src/utils.rs@@ -43,8 +43,8 @@ pub async fn monitor_and_log_recording_start(stderr: ChildStderr, video_id: &strlet mut lines = reader.lines();while let Some(line) = lines.next_line().await? {- if line.contains("00:00") {- let timestamp = Utc::now().timestamp() as f64;+ if line.contains("001") && line.contains("for writing") {+ let timestamp = Utc::now().timestamp_millis() as f64;println!("{} recording started at timestamp: {}", log_type, timestamp);if send_metadata_api(video_id, timestamp, log_type).await.is_err() {eprintln!("Failed to send metadata to API.");diff --git a/apps/desktop/src/components/icons/Focus.tsx b/apps/desktop/src/components/icons/Focus.tsxnew file mode 100644index 000000000..333a49065--- /dev/null+++ b/apps/desktop/src/components/icons/Focus.tsx@@ -0,0 +1,18 @@+export const Focus = ({ className }: { className: string }) => {+ return (+ <svg+ xmlns="http://www.w3.org/2000/svg"+ className={className}+ fill="none"+ stroke="currentColor"+ strokeLinecap="round"+ strokeLinejoin="round"+ strokeWidth="2"+ viewBox="0 0 24 24"+ >+ <path d="M3 7V5a2 2 0 012-2h2M17 3h2a2 2 0 012 2v2M21 17v2a2 2 0 01-2 2h-2M7 21H5a2 2 0 01-2-2v-2"></path>+ <circle cx="12" cy="12" r="1"></circle>+ <path d="M5 12s2.5-5 7-5 7 5 7 5-2.5 5-7 5-7-5-7-5"></path>+ </svg>+ );+};diff --git a/apps/desktop/src/components/windows/Camera.tsx b/apps/desktop/src/components/windows/Camera.tsxindex 46bbe35da..439e22b25 100644--- a/apps/desktop/src/components/windows/Camera.tsx+++ b/apps/desktop/src/components/windows/Camera.tsx@@ -1,11 +1,14 @@-// @refresh reset-import React, { useEffect, useRef, useState } from "react";import { useMediaDevices } from "@/utils/recording/MediaDeviceContext";import { CloseX } from "@/components/icons/CloseX";+import { Focus } from "@/components/icons/Focus";+import * as bodyPix from "@tensorflow-models/body-pix";+import "@tensorflow/tfjs-backend-webgl";export const Camera = () => {const videoRef = useRef<HTMLVideoElement>(null);+ const canvasRef = useRef<HTMLCanvasElement>(null);+ const [isBackgroundBlur, setIsBackgroundBlur] = useState(false);const { selectedVideoDevice } = useMediaDevices();const [isLoading, setIsLoading] = useState(true);const tauriWindowImport = import("@tauri-apps/api/window");@@ -40,6 +43,93 @@ export const Camera = () => {};}, [selectedVideoDevice]);+ useEffect(() => {+ let animationFrameId;++ const loadBodyPixAndApply = async () => {+ if (!videoRef.current || !canvasRef.current) return;++ const net = await bodyPix.load({+ architecture: "MobileNetV1",+ outputStride: 16,+ multiplier: 0.75,+ quantBytes: 2,+ });++ const video = videoRef.current;+ const canvas = canvasRef.current;+ canvas.width = video.videoWidth;+ canvas.height = video.videoHeight;+ const ctx = canvas.getContext("2d");++ // Create an off-screen canvas for blurring the background+ const offscreenCanvas = document.createElement("canvas");+ offscreenCanvas.width = canvas.width;+ offscreenCanvas.height = canvas.height;+ const offscreenCtx = offscreenCanvas.getContext("2d");++ const draw = async () => {+ if (+ !videoRef.current ||+ !canvasRef.current ||+ video.paused ||+ video.ended+ )+ return;++ if (isBackgroundBlur) {+ const segmentation = await net.segmentPerson(video, {+ internalResolution: "medium",+ segmentationThreshold: 0.7,+ flipHorizontal: false,+ maxDetections: 1,+ scoreThreshold: 0.2,+ nmsRadius: 20,+ });++ // Draw the video frame to the off-screen canvas+ offscreenCtx.drawImage(video, 0, 0);+ offscreenCtx.filter = "blur(8px)";+ ctx.filter = "none";++ // Apply the blurred image from the off-screen canvas to the main canvas+ ctx.drawImage(offscreenCanvas, 0, 0);++ // Now draw the clear part (foreground) by using the mask from segmentation+ const foregroundColor = { r: 0, g: 0, b: 0, a: 0 }; // Change these values as per your requirement+ const foreground = bodyPix.toMask(segmentation, foregroundColor);+ ctx.putImageData(foreground, 0, 0);+ } else {+ // If background blur is not enabled, simply draw the video frame+ ctx.clearRect(0, 0, canvas.width, canvas.height);+ ctx.drawImage(video, 0, 0, canvas.width, canvas.height);+ }++ animationFrameId = requestAnimationFrame(draw);+ };++ if (video.readyState >= 2) {+ draw();+ } else {+ video.onloadedmetadata = () => {+ draw();+ };+ }+ };++ loadBodyPixAndApply();++ return () => {+ if (animationFrameId) {+ cancelAnimationFrame(animationFrameId);+ }+ };+ }, [isBackgroundBlur, selectedVideoDevice]);++ const toggleBackgroundBlur = () => {+ setIsBackgroundBlur(!isBackgroundBlur);+ };+const setWindowSize = async (type: "sm" | "lg") => {tauriWindowImport.then(({ currentMonitor, appWindow, LogicalSize, LogicalPosition }) => {@@ -109,7 +199,7 @@ export const Camera = () => {</svg></div>)}- <div className="opacity-0 group-hover:opacity-100 absolute bottom-3 left-1/2 transform -translate-x-1/2 bg-gray-800 rounded-xl z-20 grid grid-cols-3 overflow-hidden">+ <div className="opacity-0 group-hover:opacity-100 absolute bottom-3 left-1/2 transform -translate-x-1/2 bg-gray-800 rounded-xl z-20 grid grid-cols-4 overflow-hidden"><div className="h-full flex items-center justify-center p-2 hover:bg-gray-900"><buttononClick={() => {@@ -135,13 +225,28 @@ export const Camera = () => {className="w-4 h-4 bg-gray-200 rounded-full"></button></div>+ <div className="h-full flex items-center justify-center p-2 hover:bg-gray-900">+ <button+ onClick={() => {+ toggleBackgroundBlur();+ }}+ >+ <Focus className="w-5 h-5 stroke-gray-200" />+ </button>+ </div></div>+ <canvas+ ref={canvasRef}+ className="absolute top-0 left-0 w-full h-full object-cover pointer-events-none"+ style={{ display: isBackgroundBlur ? "block" : "none" }}+ ></canvas><videoref={videoRef}autoPlayplaysInlinemutedclassName="absolute top-0 left-0 w-full h-full object-cover pointer-events-none"+ style={{ visibility: isBackgroundBlur ? "hidden" : "visible" }}/></div>);diff --git a/apps/web/app/share/[videoId]/_components/VideoPlayer.tsx b/apps/web/app/share/[videoId]/_components/VideoPlayer.tsxindex 9e367a229..95f3daf65 100644--- a/apps/web/app/share/[videoId]/_components/VideoPlayer.tsx+++ b/apps/web/app/share/[videoId]/_components/VideoPlayer.tsx@@ -10,7 +10,7 @@ import Hls from "hls.js";interface VideoPlayerProps {videoSrc: string;audioSrc?: string;- videoStartTime: number | null; // These are Unix timestamps+ videoStartTime: number | null;audioStartTime: number | null;}@@ -34,15 +34,6 @@ export const VideoPlayer = memo(hlsInstance.current = hls;hls.loadSource(src);hls.attachMedia(media);- media.onloadedmetadata = () => {- if (media === videoRef.current && videoStartTime) {- const videoCurrentTime = Date.now() / 1000 - videoStartTime;- videoRef.current.currentTime = Math.max(0, videoCurrentTime);- } else if (media === audioRef.current && audioStartTime) {- const audioCurrentTime = Date.now() / 1000 - audioStartTime;- audioRef.current.currentTime = Math.max(0, audioCurrentTime);- }- };} else if (media.canPlayType("application/vnd.apple.mpegurl")) {media.src = src;}@@ -66,7 +57,65 @@ export const VideoPlayer = memo(};}, [audioSrc]);- // No need for a separate useEffect for synchronization since it's handled within initializeHls+ useEffect(() => {+ if (+ !videoRef.current ||+ !audioSrc ||+ !audioRef.current ||+ videoStartTime === null ||+ audioStartTime === null+ )+ return;++ const timeDifferenceInSeconds =+ (audioStartTime - videoStartTime) / 1000;++ console.log("timeDifferenceInSeconds", timeDifferenceInSeconds);++ if (timeDifferenceInSeconds > 0) {+ videoRef.current.currentTime = timeDifferenceInSeconds;+ audioRef.current.currentTime = 0;+ } else {+ audioRef.current.currentTime = -timeDifferenceInSeconds;+ videoRef.current.currentTime = 0;+ }+ }, [videoStartTime, audioStartTime, audioSrc]);++ useEffect(() => {+ if (!audioSrc || !videoRef.current || !audioRef.current) return;+ const video = videoRef.current;+ const audio = audioRef.current;++ const playListener = async () => {+ if (audio.paused) {+ await audio.play();+ }+ };++ const pauseListener = () => {+ if (!audio.paused) {+ audio.pause();+ }+ };++ const seekListener = () => {+ if (audioStartTime !== null && videoStartTime !== null) {+ const startOffsetSeconds = (audioStartTime - videoStartTime) / 1000;+ console.log("startOffsetSeconds", startOffsetSeconds);+ audio.currentTime = video.currentTime + startOffsetSeconds;+ }+ };++ video.addEventListener("play", playListener);+ video.addEventListener("pause", pauseListener);+ video.addEventListener("seeked", seekListener);++ return () => {+ video.removeEventListener("play", playListener);+ video.removeEventListener("pause", pauseListener);+ video.removeEventListener("seeked", seekListener);+ };+ }, [audioSrc, videoStartTime, audioStartTime]);return (<>diff --git a/apps/web/utils/video/ffmpeg/helpers.ts b/apps/web/utils/video/ffmpeg/helpers.tsindex ac69737b9..33f53104d 100644--- a/apps/web/utils/video/ffmpeg/helpers.ts+++ b/apps/web/utils/video/ffmpeg/helpers.ts@@ -79,7 +79,7 @@ export async function generateM3U8Playlist(const baseM3U8Content = `#EXTM3U#EXT-X-INDEPENDENT-SEGMENTS#EXT-X-PLAYLIST-TYPE:VOD-#EXT-X-TARGETDURATION:4+#EXT-X-TARGETDURATION:7#EXT-X-VERSION:4#EXT-X-MEDIA-SEQUENCE:0`;diff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex e7303b1ff..a8e22f7ef 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -35,15 +35,15 @@ importers:'@cap/utils':specifier: workspace:*version: link:../../packages/utils- '@ffmpeg/ffmpeg':- specifier: ^0.12.10- version: 0.12.10- '@ffmpeg/util':- specifier: ^0.12.1- version: 0.12.1'@tauri-apps/api':specifier: ^1.5.0version: 1.5.3+ '@tensorflow-models/body-pix':+ specifier: ^2.2.1+ version: 2.2.1(@tensorflow/[email protected])(@tensorflow/[email protected])(@tensorflow/[email protected])+ '@tensorflow/tfjs':+ specifier: ^4.17.0+ version: 4.17.0([email protected])autoprefixer:specifier: ^10.4.16version: 10.4.17([email protected])@@ -56,9 +56,6 @@ importers:dotenv:specifier: ^16.3.1version: 16.3.1- hls.js:- specifier: ^1.5.3- version: 1.5.3million:specifier: ^2.6.4version: 2.6.4@@ -3875,6 +3872,108 @@ packages:'@tauri-apps/cli-win32-x64-msvc': 1.5.9dev: true+ /@tensorflow-models/[email protected](@tensorflow/[email protected])(@tensorflow/[email protected])(@tensorflow/[email protected]):+ resolution: {integrity: sha512-JeZHcpVMR0mW2znmF0FpZ0f7zpSY7c6+A7FBOmcIyZupTkXmG3MwGGqFPsVjRBwfqaKa4qYCJd7Svqo6rMzJYw==}+ peerDependencies:+ '@tensorflow/tfjs-backend-webgl': ^4.10.0+ '@tensorflow/tfjs-converter': ^4.10.0+ '@tensorflow/tfjs-core': ^4.10.0+ dependencies:+ '@tensorflow/tfjs-backend-webgl': 4.17.0(@tensorflow/[email protected])+ '@tensorflow/tfjs-converter': 4.17.0(@tensorflow/[email protected])+ '@tensorflow/tfjs-core': 4.17.0+ dev: false++ /@tensorflow/[email protected](@tensorflow/[email protected]):+ resolution: {integrity: sha512-2VSCHnX9qhYTjw9HiVwTBSnRVlntKXeBlK7aSVsmZfHGwWE2faErTtO7bWmqNqw0U7gyznJbVAjlow/p+0RNGw==}+ engines: {yarn: '>= 1.3.2'}+ peerDependencies:+ '@tensorflow/tfjs-core': 4.17.0+ dependencies:+ '@tensorflow/tfjs-core': 4.17.0+ '@types/seedrandom': 2.4.34+ seedrandom: 3.0.5+ dev: false++ /@tensorflow/[email protected](@tensorflow/[email protected]):+ resolution: {integrity: sha512-CC5GsGECCd7eYAUaKq0XJ48FjEZdgXZWPxgUYx4djvfUx5fQPp35hCSP9w/k463jllBMbjl2tKRg8u7Ia/LYzg==}+ engines: {yarn: '>= 1.3.2'}+ peerDependencies:+ '@tensorflow/tfjs-core': 4.17.0+ dependencies:+ '@tensorflow/tfjs-backend-cpu': 4.17.0(@tensorflow/[email protected])+ '@tensorflow/tfjs-core': 4.17.0+ '@types/offscreencanvas': 2019.3.0+ '@types/seedrandom': 2.4.34+ seedrandom: 3.0.5+ dev: false++ /@tensorflow/[email protected](@tensorflow/[email protected]):+ resolution: {integrity: sha512-qFxIjPfomCuTrYxsFjtKbi3QfdmTTCWo+RvqD64oCMS0sjp7sUDNhJyKDoLx6LZhXlwXpHIVDJctLMRMwet0Zw==}+ peerDependencies:+ '@tensorflow/tfjs-core': 4.17.0+ dependencies:+ '@tensorflow/tfjs-core': 4.17.0+ dev: false++ /@tensorflow/[email protected]:+ resolution: {integrity: sha512-v9Q5430EnRpyhWNd9LVgXadciKvxLiq+sTrLKRowh26BHyAsams4tZIgX3lFKjB7b90p+FYifVMcqLTTHgjGpQ==}+ engines: {yarn: '>= 1.3.2'}+ dependencies:+ '@types/long': 4.0.2+ '@types/offscreencanvas': 2019.7.3+ '@types/seedrandom': 2.4.34+ '@webgpu/types': 0.1.38+ long: 4.0.0+ node-fetch: 2.6.13+ seedrandom: 3.0.5+ transitivePeerDependencies:+ - encoding+ dev: false++ resolution: {integrity: sha512-aPKrDFip+gXicWOFALeNT7KKQjRXFkHd/hNe/zs4mCFcIN00hy1PkZ6xkYsgrsdLDQMBSGeS4B4ZM0k5Cs88QA==}+ peerDependencies:+ '@tensorflow/tfjs-core': 4.17.0+ seedrandom: ^3.0.5+ dependencies:+ '@tensorflow/tfjs-core': 4.17.0+ '@types/node-fetch': 2.6.11+ node-fetch: 2.6.13+ seedrandom: 3.0.5+ string_decoder: 1.3.0+ transitivePeerDependencies:+ - encoding+ dev: false++ /@tensorflow/[email protected](@tensorflow/[email protected]):+ resolution: {integrity: sha512-DEE0zRKvf3LJ0EcvG5XouJYOgFGWYAneZ0K1d23969z7LfSyqVmBdLC6BTwdLKuJk3ouUJIKXU1TcpFmjDuh7g==}+ peerDependencies:+ '@tensorflow/tfjs-core': 4.17.0+ dependencies:+ '@tensorflow/tfjs-core': 4.17.0+ dev: false++ /@tensorflow/[email protected]([email protected]):+ resolution: {integrity: sha512-yXRBhpM3frlNA/YaPp6HNk9EfIi8han5RYeQA3R8OCa0Od+AfoG1PUmlxV8fE2wCorlGVyHsgpiJ6M9YZPB56w==}+ hasBin: true+ dependencies:+ '@tensorflow/tfjs-backend-cpu': 4.17.0(@tensorflow/[email protected])+ '@tensorflow/tfjs-backend-webgl': 4.17.0(@tensorflow/[email protected])+ '@tensorflow/tfjs-converter': 4.17.0(@tensorflow/[email protected])+ '@tensorflow/tfjs-core': 4.17.0+ '@tensorflow/tfjs-data': 4.17.0(@tensorflow/[email protected])([email protected])+ '@tensorflow/tfjs-layers': 4.17.0(@tensorflow/[email protected])+ argparse: 1.0.10+ chalk: 4.1.2+ core-js: 3.29.1+ regenerator-runtime: 0.13.11+ yargs: 16.2.0+ transitivePeerDependencies:+ - encoding+ - seedrandom+ dev: false+/@tootallnate/[email protected]:resolution: {integrity: sha512-C5Mc6rdnsaJDjO3UpGW/CQTHtCKaYlScZTly4JIu97Jxo/odCiH0ITnDXSJPTOrEKk/ycSZ0AOgTmkDtkOsvIA==}dev: true@@ -3987,6 +4086,10 @@ packages:resolution: {integrity: sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==}dev: true+ /@types/[email protected]:+ resolution: {integrity: sha512-MqTGEo5bj5t157U6fA/BiDynNkn0YknVdh48CMPkTSpFTVmvao5UQmm7uEF6xBEo7qIMAlY/JSleYaE6VOdpaA==}+ dev: false+/@types/[email protected]:resolution: {integrity: sha512-K0VQKziLUWkVKiRVrx4a40iPaxTUefQmjtkQofBkYRcoaaL/8rhwDWww9qWbrgicNOgnpIsMxyNIUM4+n6dUIA==}dev: true@@ -3995,6 +4098,13 @@ packages:resolution: {integrity: sha512-hov8bUuiLiyFPGyFPE1lwWhmzYbirOXQNNo40+y3zow8aFVTeyn3VWL0VFFfdNddA8S4Vf0Tc062rzyNr7Paag==}dev: false+ /@types/[email protected]:+ resolution: {integrity: sha512-24xFj9R5+rfQJLRyM56qh+wnVSYhyXC2tkoBndtY0U+vubqNsYXGjufB2nn8Q6gt0LrARwL6UBtMCSVCwl4B1g==}+ dependencies:+ '@types/node': 20.11.5+ form-data: 4.0.0+ dev: false+/@types/[email protected]:resolution: {integrity: sha512-eEn8RkzZFcT0gb8qyi0CcfSOQnLE+NbGLIIaxGGmjn/N35v/C3M8ohxcpSlNlCv+H8vPpMGmrGDdCkzr8xu2tQ==}dev: false@@ -4008,6 +4118,14 @@ packages:resolution: {integrity: sha512-37i+OaWTh9qeK4LSHPsyRC7NahnGotNuZvjLSgcPzblpHB3rrCJxAOgI5gCdKm7coonsaX1Of0ILiTcnZjbfxA==}dev: false+ /@types/[email protected]:+ resolution: {integrity: sha512-esIJx9bQg+QYF0ra8GnvfianIY8qWB0GBx54PK5Eps6m+xTj86KLavHv6qDhzKcu5UUOgNfJ2pWaIIV7TRUd9Q==}+ dev: false++ /@types/[email protected]:+ resolution: {integrity: sha512-ieXiYmgSRXUDeOntE1InxjWyvEelZGP63M+cGuquuRLuIKKT1osnkXjxev9B7d1nXSug5vpunx+gNlbVxMlC9A==}+ dev: false+/@types/[email protected]:resolution: {integrity: sha512-ga8y9v9uyeiLdpKddhxYQkxNDrfvuPrlFb0N1qnZZByvcElJaXthF1UhvCh9TLWJBEHeNtdnbysW7Y6Uq8CVng==}@@ -4026,6 +4144,10 @@ packages:/@types/[email protected]:resolution: {integrity: sha512-WZLiwShhwLRmeV6zH+GkbOFT6Z6VklCItrDioxUnv+u4Ll+8vKeFySoFyK/0ctcRpOmwAicELfmys1sDc/Rw+A==}+ /@types/[email protected]:+ resolution: {integrity: sha512-ytDiArvrn/3Xk6/vtylys5tlY6eo7Ane0hvcx++TKo6RxQXuVfW0AF/oeWqAj9dN29SyhtawuXstgmPlwNcv/A==}+ dev: false+/@types/[email protected]:resolution: {integrity: sha512-dn1l8LaMea/IjDoHNd9J52uBbInB796CDffS6VdIxvqYCPSG0V0DzHp76GpaWnlhg88uYyPbXCDIowa86ybd5A==}dev: true@@ -4253,6 +4375,10 @@ packages:transitivePeerDependencies:- supports-color+ /@webgpu/[email protected]:+ resolution: {integrity: sha512-7LrhVKz2PRh+DD7+S+PVaFd5HxaWQvoMqBbsV9fNJO1pjUs1P8bM2vQVNfk+3URTqbuTI7gkXi0rfsN0IadoBA==}+ dev: false+resolution: {integrity: sha512-6/mh1E2u2YgEsCHdY0Yx5oW+61gZU+1vXaoiHHrpKeuRNNgFvS+/jrwHiQhB5apAf5oB7UB7E19ol2R2LKH8hQ==}engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0}@@ -4513,6 +4639,10 @@ packages:has-symbols: 1.0.3dev: true+ resolution: {integrity: sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==}+ dev: false+resolution: {integrity: sha512-/cpVNRLSfhOtcGflT13P2794gVSgmPgTR+erw5ifnMLZb0UnSlkK4tquLmkd3BhA+nLo5tX8Cu0upUsGKvKbmg==}engines: {node: ^10 || ^12 || >=14}@@ -4826,6 +4956,14 @@ packages:resolution: {integrity: sha512-IV3Ou0jSMzZrd3pZ48nLkT9DA7Ag1pnPzaiQhpW7c3RbcqqzvzzVu+L8gfqMp/8IM2MQtSiqaCxrrcfu8I8rMA==}dev: false+ resolution: {integrity: sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==}+ dependencies:+ string-width: 4.2.3+ strip-ansi: 6.0.1+ wrap-ansi: 7.0.0+ dev: false+resolution: {integrity: sha512-JQHZ2QMW6l3aH/j6xCqQThY/9OH4D/9ls34cgkUBiEeocRTU04tHfKPBsUK1PqZCUQM7GiA0IIXJSuXHI64Kbg==}engines: {node: '>=0.8'}@@ -4871,6 +5009,13 @@ packages:resolution: {integrity: sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==}+ resolution: {integrity: sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==}+ engines: {node: '>= 0.8'}+ dependencies:+ delayed-stream: 1.0.0+ dev: false+resolution: {integrity: sha512-VtDvQpIJBvBatnONUsPzXYFVKQQAhuf3XTNOAsdBxCNO/QCtUUd8LSgjn0GVarBkCad6aJCZfXgrjYbl/KRr7w==}dev: false@@ -4952,6 +5097,11 @@ packages:requiresBuild: truedev: true+ resolution: {integrity: sha512-+jwgnhg6cQxKYIIjGtAHq2nwUOolo9eoFZ4sHfUH09BLXBgxnH4gA0zEd+t+BO2cNB8idaBtZFcFTRjQJRJmAw==}+ requiresBuild: true+ dev: false+resolution: {integrity: sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g==}engines: {node: '>= 0.10'}@@ -5094,6 +5244,11 @@ packages:slash: 3.0.0dev: true+ resolution: {integrity: sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==}+ engines: {node: '>=0.4.0'}+ dev: false+resolution: {integrity: sha512-HVQE3AAb/pxF8fQAoiqpvg9i3evqug3hoiwakOyZAwJm+6vZehbkYXZ0l4JxS+I3QxM97v5aaRNhj8v5oBhekw==}engines: {node: '>=0.10'}@@ -6319,6 +6474,15 @@ packages:cross-spawn: 7.0.3signal-exit: 4.1.0+ resolution: {integrity: sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==}+ engines: {node: '>= 6'}+ dependencies:+ asynckit: 0.4.0+ combined-stream: 1.0.8+ mime-types: 2.1.35+ dev: false+resolution: {integrity: sha512-ZsDfxO51wGAXREY55a7la9LScWpwv9RxIrYABrlvOFBlH/ShPnrtsXeuUIfXKKOVicNxQ+o8JTbJvjS4M89yew==}@@ -6389,6 +6553,11 @@ packages:resolution: {integrity: sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==}engines: {node: '>=6.9.0'}+ resolution: {integrity: sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==}+ engines: {node: 6.* || 8.* || >= 10.*}+ dev: false+resolution: {integrity: sha512-0gSo4ml/0j98Y3lngkFEot/zhiCeWsbYIlZ+uZOVgzLyLaUw7wxUL+nCTP0XJvJg1AXulJRI3UJi8GsbDuxdGA==}dependencies:@@ -7344,6 +7513,10 @@ packages:chalk: 4.1.2is-unicode-supported: 0.1.0+ resolution: {integrity: sha512-XsP+KhQif4bjX1kbuSiySJFNAehNxgLb6hPRGJ9QsUr8ajHkuXGdrHmFUTUUXhDwVX2R5bY4JNZEwbUiMhV+MA==}+ dev: false+resolution: {integrity: sha512-lcHwpNoggQTObv5apGNCTdJrO69eHOZMi4BNC+rTLER8iHAqGrUVeLh/irVIM7zTw2bOXA8T6uNPeujwOLg/2Q==}dev: false@@ -7480,6 +7653,18 @@ packages:- supports-colordev: false+ resolution: {integrity: sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==}+ engines: {node: '>= 0.6'}+ dev: false++ resolution: {integrity: sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==}+ engines: {node: '>= 0.6'}+ dependencies:+ mime-db: 1.52.0+ dev: false+resolution: {integrity: sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==}engines: {node: '>=6'}@@ -7700,6 +7885,18 @@ packages:lower-case: 1.1.4dev: true+ resolution: {integrity: sha512-StxNAxh15zr77QvvkmveSQ8uCQ4+v5FkvNTj0OESmiHu+VRi/gXArXtkWMElOsOUNLtUEvI4yS+rdtOHZTwlQA==}+ engines: {node: 4.x || >=6.0.0}+ peerDependencies:+ encoding: ^0.1.0+ peerDependenciesMeta:+ encoding:+ optional: true+ dependencies:+ whatwg-url: 5.0.0+ dev: false+resolution: {integrity: sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==}engines: {node: 4.x || >=6.0.0}@@ -8562,6 +8759,10 @@ packages:which-builtin-type: 1.1.3dev: true+ resolution: {integrity: sha512-kY1AZVr2Ra+t+piVaJ4gxaFaReZVH40AKNo7UCX6W+dEwBo/2oZJzqfuN1qLq1oL45o56cPaTXELwrTh8Fpggg==}+ dev: false+resolution: {integrity: sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw==}@@ -8593,6 +8794,11 @@ packages:rc: 1.2.8dev: true+ resolution: {integrity: sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==}+ engines: {node: '>=0.10.0'}+ dev: false+resolution: {integrity: sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==}engines: {node: '>=0.10.0'}@@ -8721,6 +8927,10 @@ packages:dependencies:loose-envify: 1.4.0+ resolution: {integrity: sha512-8OwmbklUNzwezjGInmZ+2clQmExQPvomqjL7LFqOYqtmuxRgQYqOD3mHaU+MvZn5FLUeVxVfQjwLZW/n/JFuqg==}+ dev: false+resolution: {integrity: sha512-DEL/RW/f4qLw/NrVg97xKaEBC8IpzIG2fvxnzCp3Z4yk4jQ3MXom+Imav9wApjxX2dfS3eW7x0DXafJr85i39A==}dependencies:@@ -9804,6 +10014,11 @@ packages:engines: {node: '>=4.0'}dev: false+ resolution: {integrity: sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==}+ engines: {node: '>=10'}+ dev: false+resolution: {integrity: sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==}@@ -9822,6 +10037,24 @@ packages:decamelize: 1.2.0dev: false+ resolution: {integrity: sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w==}+ engines: {node: '>=10'}+ dev: false++ resolution: {integrity: sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==}+ engines: {node: '>=10'}+ dependencies:+ cliui: 7.0.4+ escalade: 3.1.1+ get-caller-file: 2.0.5+ require-directory: 2.1.1+ string-width: 4.2.3+ y18n: 5.0.8+ yargs-parser: 20.2.9+ dev: false+resolution: {integrity: sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==}engines: {node: '>=6'}