Module recording_output

Module recording_output 

Source
Expand description

SCRecordingOutput - Direct video file recording

Available on macOS 15.0+. Provides direct encoding of screen capture to video files with hardware acceleration.

Requires the macos_15_0 feature flag to be enabled.

§When to Use

Use SCRecordingOutput when you need:

  • Direct recording to MP4/MOV files without manual encoding
  • Hardware-accelerated H.264 or HEVC encoding
  • Recording with automatic file management

For custom processing of frames, use SCStream with output handlers instead.

§Example

use screencapturekit::recording_output::{
    SCRecordingOutput, SCRecordingOutputConfiguration, SCRecordingOutputCodec
};
use screencapturekit::prelude::*;
use std::path::Path;

let content = SCShareableContent::get()?;
let display = &content.displays()[0];
let filter = SCContentFilter::create().with_display(display).with_excluding_windows(&[]).build();
let config = SCStreamConfiguration::new()
    .with_width(1920)
    .with_height(1080);

// Configure recording output
let rec_config = SCRecordingOutputConfiguration::new()
    .with_output_url(Path::new("/tmp/recording.mp4"))
    .with_video_codec(SCRecordingOutputCodec::HEVC);

let recording = SCRecordingOutput::new(&rec_config).ok_or("Failed to create recording")?;

// Add to stream and start
let mut stream = SCStream::new(&filter, &config);
stream.add_recording_output(&recording)?;
stream.start_capture()?;

// ... record for desired duration ...

stream.stop_capture()?;
stream.remove_recording_output(&recording)?;

Structs§

RecordingCallbacks
Builder for closure-based recording delegate
SCRecordingOutput
Recording output for direct video file encoding
SCRecordingOutputConfiguration
Configuration for recording output

Enums§

SCRecordingOutputCodec
Video codec for recording
SCRecordingOutputFileType
Output file type for recording

Traits§

SCRecordingOutputDelegate
Delegate for recording output events