CapSoftware / scap

High-performance, cross-platform screen capture library in Rust.
https://crates.io/crates/scap
Other
175 stars 29 forks source link

(macOS) Encode captured frames to video using either native encoders or FFmpeg #4

Closed clearlysid closed 10 months ago

clearlysid commented 10 months ago

We are now able to capture frames and get pixel data from them using ScreenCaptureKit. Now the next step is to be able to encode them into an .mp4 file. Ideally this should be a fragmented MP4 file because recording can potentially be stopped/killed at any given point in time.

clearlysid commented 10 months ago

Did some homework for here and on #8. Turns out FFmpeg APIs have a way of utilizing the hardware encoders on macOS via the VideoToolbox framework. More details here: https://trac.ffmpeg.org/wiki/HWAccelIntro#VideoToolbox

This really allows us FFmpeg APIs cross-platform and just switch out the encoder for the right one 🥳

clearlysid commented 10 months ago

Closing in favour of #8. Will continue discussion there itself.