{"id":15561296,"url":"https://github.com/computer-graphics-tools/core-video-tools","last_synced_at":"2025-12-11T22:54:09.214Z","repository":{"id":63909550,"uuid":"485357200","full_name":"computer-graphics-tools/core-video-tools","owner":"computer-graphics-tools","description":"A set of extensions and utilities to work with CoreVideo types.","archived":false,"fork":false,"pushed_at":"2024-07-03T14:07:32.000Z","size":440,"stargazers_count":26,"open_issues_count":1,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-11-18T09:25:41.417Z","etag":null,"topics":["corevideo","graphics-programming","image-processing","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/computer-graphics-tools.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-04-25T12:13:06.000Z","updated_at":"2025-08-04T14:06:11.000Z","dependencies_parsed_at":"2025-03-06T18:33:29.044Z","dependency_job_id":"f541d0ac-3072-4d91-90a5-e7e561598b33","html_url":"https://github.com/computer-graphics-tools/core-video-tools","commit_stats":null,"previous_names":["computer-graphics-tools/core-video-tools","eugenebokhan/core-video-tools"],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/computer-graphics-tools/core-video-tools","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/computer-graphics-tools%2Fcore-video-tools","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/computer-graphics-tools%2Fcore-video-tools/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/computer-graphics-tools%2Fcore-video-tools/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/computer-graphics-tools%2Fcore-video-tools/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/computer-graphics-tools","download_url":"https://codeload.github.com/computer-graphics-tools/core-video-tools/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/computer-graphics-tools%2Fcore-video-tools/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":27672063,"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","status":"online","status_checked_at":"2025-12-11T02:00:11.302Z","response_time":56,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["corevideo","graphics-programming","image-processing","swift"],"created_at":"2024-10-02T16:07:07.296Z","updated_at":"2025-12-11T22:54:09.199Z","avatar_url":"https://github.com/computer-graphics-tools.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CoreVideoTools\n\n[![Platform Compatibility](https://img.shields.io/badge/Platforms-iOS%20|%20macOS-brightgreen)](https://swift.org/platforms/)\n[![Swift Version](https://img.shields.io/badge/Swift-5.9-orange)](https://swift.org)\n\n\u003cp align=\"left\"\u003e\n    \u003cimg src=\"Sources/CoreVideoTools/CoreVideoTools.docc/Resources/table-of-contents-art/core-video-tools@2x.png\", width=\"120\"\u003e\n\u003c/p\u003e\n\n## Overview\n\nCoreVideoTools offers a more idiomatic Swift interface to `CoreVideo` functionality, making it easier and safer to work with `CVPixelBuffers`, `IOSurfaces`, and related `CoreVideo` concepts in Swift code.\n\nPlease see [the package's documentation](https://swiftpackageindex.com/computer-graphics-tools/core-video-tools/documentation/corevideotools)\nfor more detailed usage instructions.\n\n## CVPixelBuffer\n\nThere are a lot Swift wrappers over vanilla CVPixelBuffer C-style API:\n\n**Swifty API:**\n\n```swift\nlet width = pixelBuffer.width\nlet height = pixelBuffer.height\nlet format = pixelBuffer.cvPixelFormat\nlet bytesPerRow = pixelBuffer.bytesPerRow\n```\n\n**Convenience Init:**\n\n```swift\nlet pixelBuffer = try CVPixelBuffer.create(\n    width: 1920,\n    height: 1080,\n    cvPixelFormat: .type_32BGRA\n)\n```\n\nCheck out more examples in the [Working With CVPixelBuffer](Sources/CoreVideoTools/CoreVideoTools.docc/WorkingWithCVPixelBuffer.md).\n\n## IOSurface\n\n**Convenience Init:**\n\n```swift\nlet surface = try IOSurface.create(\n    width: 1920,\n    height: 1080,\n    cvPixelFormat: .type_32BGRA,\n    bytesPerElement: 4,\n    bytesPerRow: 1920 * 4\n)\n```\n\nFor more detail, please checkout [Working With IOSurface](Sources/CoreVideoTools/CoreVideoTools.docc/WorkingWithIOSurface.md).\n\n## CVPixelFormat\n\nWhile debuging `Core Video` objects, you need to understand what pixel format is used in them.\nTo do this using vanilla API you are forced to find a matching `OSType` value, because `OSType` if basically a number.\nThis project uses [`CVPixelFormat`](Sources/CoreVideoTools/CVPixelFormat.swift) enum istead of vanilla `OSType` public vars which is much more handy, and you can easily get a `description` of a current pixel format.\n\n```swift\nlet cvPixelFormat: CVPixelFormat = cvPixelBuffer.cvPixelFormat\nlet description = cvPixelFormat.description\n```\n\n## CVReturn Result \u0026 CVError\n\nThere are some functions in Core Video that return a code which helps if the operation succeeded.\nThis project aims to simplify this error checking. `CVReturn` [`Result`](Sources/CoreVideoTools/Extensions/CoreVideo/CVReturn/CVReturn+Result.swift) and [`CVError`](Sources/CoreVideoTools/CVError.swift) types are used to wrap vanilla API with thowable functions.\n\n**Vanilla API:**\n\n```swift\nlet returnCode = CVPixelBufferLockBaseAddress(cvPixelBuffer, lockFlags)\nguard returnCode == kCVReturnSuccess else { /* handle the error ... */ }\n```\n\n**Swifty API:**\n\n```swift\ntry cvPixelBuffer.lockBaseAddress(lockFlags: lockFlags)\n```\n\n## License\n\nMetalTools is licensed under [MIT license](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcomputer-graphics-tools%2Fcore-video-tools","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcomputer-graphics-tools%2Fcore-video-tools","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcomputer-graphics-tools%2Fcore-video-tools/lists"}