Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

30fps recording cap

Brendan Allan760ddf2a64ec
diff --git a/apps/desktop/src-tauri/src/upload.rs b/apps/desktop/src-tauri/src/upload.rs
index 072267015..5fefb36be 100644
--- a/apps/desktop/src-tauri/src/upload.rs
+++ b/apps/desktop/src-tauri/src/upload.rs
@@ -265,7 +265,6 @@ pub async fn upload_video(
let form = form.part("file", file_part);
- dbg!(&screenshot_path);
let screenshot_upload = match screenshot_path {
Some(screenshot_path) if screenshot_path.exists() => {
Some(prepare_screenshot_upload(app, &s3_config, screenshot_path).await?)
diff --git a/crates/media/src/sources/screen_capture.rs b/crates/media/src/sources/screen_capture.rs
index e06f77afb..1e7b84277 100644
--- a/crates/media/src/sources/screen_capture.rs
+++ b/crates/media/src/sources/screen_capture.rs
@@ -123,15 +123,17 @@ impl<TCaptureFormat> ScreenCaptureSource<TCaptureFormat> {
output_type: Option<FrameType>,
show_camera: bool,
force_show_cursor: bool,
+ max_fps: u32,
) -> Result<Self, String> {
cap_fail::fail!("media::screen_capture::init");
+ let fps = target.recording_fps().min(max_fps);
let mut this = Self {
target: target.clone(),
output_resolution: None,
output_type,
- fps: target.recording_fps(),
- video_info: VideoInfo::from_raw(RawVideoFormat::Bgra, 0, 0, MAX_FPS),
+ fps,
+ video_info: VideoInfo::from_raw(RawVideoFormat::Bgra, 0, 0, fps),
options: Arc::new(Options::default()),
show_camera,
force_show_cursor,
@@ -141,8 +143,7 @@ impl<TCaptureFormat> ScreenCaptureSource<TCaptureFormat> {
this.options = Arc::new(this.create_options()?);
let [frame_width, frame_height] = get_output_frame_size(&this.options);
- this.video_info =
- VideoInfo::from_raw(RawVideoFormat::Bgra, frame_width, frame_height, MAX_FPS);
+ this.video_info = VideoInfo::from_raw(RawVideoFormat::Bgra, frame_width, frame_height, fps);
Ok(this)
}
diff --git a/crates/recording/src/capture_pipeline.rs b/crates/recording/src/capture_pipeline.rs
index 7629686df..182736d95 100644
--- a/crates/recording/src/capture_pipeline.rs
+++ b/crates/recording/src/capture_pipeline.rs
@@ -117,6 +117,7 @@ pub fn create_screen_capture(
capture_target: &ScreenCaptureTarget,
show_camera: bool,
force_show_cursor: bool,
+ max_fps: u32,
) -> Result<ScreenCaptureSource<impl MakeCapturePipeline>, RecordingError> {
#[cfg(target_os = "macos")]
{
@@ -125,6 +126,7 @@ pub fn create_screen_capture(
None,
show_camera,
force_show_cursor,
+ max_fps,
)
.map_err(|e| RecordingError::Media(MediaError::TaskLaunch(e)))
}
diff --git a/crates/recording/src/instant_recording.rs b/crates/recording/src/instant_recording.rs
index ff9f4d8eb..a0370aaba 100644
--- a/crates/recording/src/instant_recording.rs
+++ b/crates/recording/src/instant_recording.rs
@@ -167,7 +167,7 @@ pub async fn spawn_instant_recording_actor(
let content_dir = ensure_dir(&recording_dir.join("content"))?;
- let screen_source = create_screen_capture(&options.capture_target, true, true)?;
+ let screen_source = create_screen_capture(&options.capture_target, true, true, 30)?;
debug!("screen capture: {screen_source:#?}");
diff --git a/crates/recording/src/studio_recording.rs b/crates/recording/src/studio_recording.rs
index 24b23fbeb..b9a9bacbc 100644
--- a/crates/recording/src/studio_recording.rs
+++ b/crates/recording/src/studio_recording.rs
@@ -148,7 +148,7 @@ pub async fn spawn_studio_recording_actor(
let segments_dir = ensure_dir(&content_dir.join("segments"))?;
let cursors_dir = ensure_dir(&content_dir.join("cursors"))?;
- let screen_source = create_screen_capture(&options.capture_target, false, false)?;
+ let screen_source = create_screen_capture(&options.capture_target, false, false, 120)?;
debug!("screen capture: {screen_source:#?}");