{"id":13479508,"url":"https://github.com/wulkano/Aperture","last_synced_at":"2025-03-27T09:32:45.212Z","repository":{"id":40639146,"uuid":"65488992","full_name":"wulkano/Aperture","owner":"wulkano","description":"Record the screen on macOS","archived":false,"fork":false,"pushed_at":"2022-04-10T16:29:49.000Z","size":127,"stargazers_count":1241,"open_issues_count":10,"forks_count":111,"subscribers_count":32,"default_branch":"main","last_synced_at":"2024-10-29T17:39:52.582Z","etag":null,"topics":["aperture","avfoundation","capture","kap","macos","record","screen-recorder","screencast","swift"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wulkano.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"license","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-08-11T17:37:09.000Z","updated_at":"2024-10-27T10:03:08.000Z","dependencies_parsed_at":"2022-08-20T18:50:42.041Z","dependency_job_id":null,"html_url":"https://github.com/wulkano/Aperture","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wulkano%2FAperture","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wulkano%2FAperture/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wulkano%2FAperture/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wulkano%2FAperture/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wulkano","download_url":"https://codeload.github.com/wulkano/Aperture/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":222230567,"owners_count":16952662,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aperture","avfoundation","capture","kap","macos","record","screen-recorder","screencast","swift"],"created_at":"2024-07-31T16:02:17.891Z","updated_at":"2025-03-27T09:32:45.206Z","avatar_url":"https://github.com/wulkano.png","language":"Swift","readme":"\u003cp align=\"center\"\u003e\n\t\u003cimg src=\"Media/aperture-logo.svg\" width=\"64\" height=\"64\"\u003e\n\t\u003ch3 align=\"center\"\u003eAperture\u003c/h3\u003e\n\t\u003cp align=\"center\"\u003eRecord the screen on macOS\u003c/p\u003e\n\u003c/p\u003e\n\n## Requirements\n\n- macOS 13+\n- Xcode 15+\n- Swift 5.7+\n\n## Install\n\nAdd the following to `Package.swift`:\n\n```swift\n.package(url: \"https://github.com/wulkano/Aperture\", from: \"3.0.0\")\n```\n\n[Or add the package in Xcode.](https://developer.apple.com/documentation/xcode/adding_package_dependencies_to_your_app)\n\n## Docs\n\n[API Documentation.](https://swiftpackageindex.com/wulkano/Aperture/documentation)\n\n### Base Usage\n\n```swift\nimport Foundation\nimport Aperture\n\nlet recorder = Aperture.Recorder()\n\nlet screens = try await Aperture.Devices.screen()\n\nguard let screen = screens.first else {\n\t// No screens\n\texit(1)\n}\n\ntry await recorder.start(\n\ttarget: .screen,\n\toptions: Aperture.RecordingOptions(\n\t\tdestination: URL(filePath: \"./screen-recording.mp4\"),\n\t\ttargetID: screen.id,\n\t)\n)\n\ntry await Task.sleep(for: .seconds(5))\n\ntry await recorder.stop()\n```\n\n### Base Options\n\n#### `destination`\n\nType: `URL`\n\nThe filepath where the resulting recording should be written to.\n\n#### `targetID`\n\nType: `String`\n\nThe ID of the target to record\n\n### Base Audio Options\n\n#### `losslessAudio`\n\nType: `Bool`\\\nDefault: `false`\n\nWill use the lossless `ALAC` codec if enabled, `AAC` otherwise.\n\n#### `recordSystemAudio`\n\nType: `Bool`\\\nDefault: `false`\n\nRecord the system audio.\n\n#### `microphoneDeviceID`\n\nType: `String?`\n\nA microphone device ID to record.\n\n### Base Video Options\n\n#### `framesPerSecond`\n\nType: `Int`\\\nDefault: `60`\n\nNumber of frames per seconds.\n\n#### `showCursor`\n\nType: `Bool`\\\nDefault: `true`\n\nShow the cursor in the screen recording.\n\n#### `highlightClicks`\n\nType: `Bool`\\\nDefault: `false`\n\nHighlight cursor clicks in the screen recording.\n\nNote: [This](https://developer.apple.com/documentation/screencapturekit/scstreamconfiguration/4360382-showmouseclicks) will only apply on macOS 15+\n\n#### `videoCodec`\n\nType: `Aperture.VideoCodec`\\\nDefault: `.h264`\\\nValues: `.h264`, `.hevc`, `.proRes422`, `.proRes4444`\n\nThe video codec to be used.\n\n### Recording a screen\n\nUse [`Aeprture.Devices.screen`](#screens) to discover the available screens\n\nAnd then start recording with `target: .screen`\n\n```swift\ntry await recorder.start(\n\ttarget: .screen,\n\toptions: Aperture.RecordingOptions(\n\t\tdestination: fileURL,\n\t\ttargetID: screen.id,\n\t\tframesPerSecond: 60,\n\t\tcropRect: CGRect(x: 10, y: 10, width: 100, height: 100),\n\t\tshowCursor: true,\n\t\thighlightClicks: true,\n\t\tvideoCodec: .h264,\n\t\tlosslessAudio: true,\n\t\trecordSystemAudio: true,\n\t\tmicrophoneDeviceID: microphone.id,\n\t)\n)\n```\n\nAccepts all the base [video](#base-video-options) and [audio](#base-audio-options) options along with:\n\n#### `cropRect`\n\nType: `CGRect?`\n\nRecord only an area of the screen.\n\n### Recording a window\n\nUse [`Aeprture.Devices.window`](#windows) to discover the available windows\n\nAnd then start recording with `target: .window`\n\n```swift\ntry await recorder.start(\n\ttarget: .window,\n\toptions: Aperture.RecordingOptions(\n\t\tdestination: fileURL,\n\t\ttargetID: window.id,\n\t\tframesPerSecond: 60,\n\t\tshowCursor: true,\n\t\thighlightClicks: true,\n\t\tvideoCodec: .h264,\n\t\tlosslessAudio: true,\n\t\trecordSystemAudio: true,\n\t\tmicrophoneDeviceID: microphone.id,\n\t)\n)\n```\n\nAccepts all the base [video](#base-video-options) and [audio](#base-audio-options) options\n\n### Recording only audio\n\nUse [`Aeprture.Devices.audio`](#audio-devices) to discover the available audio devices\n\nAnd then start recording with `target: .audioOnly`\n\n```swift\ntry await recorder.start(\n\ttarget: .audioOnly,\n\toptions: Aperture.RecordingOptions(\n\t\tdestination: fileURL,\n\t\tlosslessAudio: true,\n\t\trecordSystemAudio: true,\n\t\tmicrophoneDeviceID: microphone.id,\n\t)\n)\n```\n\nAccepts all the base [audio](#base-audio-options) options.\n\n### Recording an external device\n\nUse [`Aeprture.Devices.iOS`](#external-devices) to discover the available external devices\n\nAnd then start recording with `target: .externalDevice`\n\n```swift\ntry await recorder.start(\n\ttarget: .externalDevice,\n\toptions: Aperture.RecordingOptions(\n\t\tdestination: fileURL,\n\t\ttargetID: device.id,\n\t\tframesPerSecond: 60,\n\t\tvideoCodec: .h264,\n\t\tlosslessAudio: true,\n\t\trecordSystemAudio: true,\n\t\tmicrophoneDeviceID: microphone.id,\n\t)\n)\n```\n\nAccepts the base [video](#base-video-options) options except for cursor related ones, and all the [audio](#base-audio-options) options.\n\n### Discovering Devices\n\n#### Screens\n\n```swift\nlet screens = try await Aperture.Devices.screen()\n```\n#### Windows\n\n```swift\nlet windows = try await Aperture.Devices.window(excludeDesktopWindows: true, onScreenWindowsOnly: true)\n```\n\n##### `excludeDesktopWindows`\n\nType: `Bool`\\\nDefault: `true`\n\n##### `onScreenWindowsOnly`\n\nType: `Bool`\\\nDefault: `true`\n\n#### Audio Devices\n\n```swift\nlet devices = Aperture.Devices.audio()\n```\n\n#### External Devices\n\n```swift\nlet devices = Aperture.Devices.iOS()\n```\n\n## Dev\n\nRun `./example.sh` or `./example-ios.sh`.\n\n## Related\n\n- [aperture-node](https://github.com/wulkano/aperture-node) - Node.js wrapper\n","funding_links":[],"categories":["Swift","swift","Video"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwulkano%2FAperture","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwulkano%2FAperture","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwulkano%2FAperture/lists"}