{"id":6189,"library":"pyobjc-framework-videotoolbox","title":"PyObjC VideoToolbox Framework","description":"This library provides Python wrappers for the macOS VideoToolbox framework, enabling access to its functionalities for video compression, decompression, and processing. It is part of the larger PyObjC project, which bridges Python and Objective-C, and typically sees releases aligned with macOS SDK updates.","status":"active","version":"12.1","language":"en","source_language":"en","source_url":"https://github.com/ronaldoussoren/pyobjc","tags":["macos","framework","video","objective-c","pyobjc"],"install":[{"cmd":"pip install pyobjc-framework-videotoolbox","lang":"bash","label":"Install latest version"}],"dependencies":[{"reason":"Provides the core bridge between Python and Objective-C, essential for all pyobjc-framework-* packages.","package":"pyobjc-core"}],"imports":[{"symbol":"VideoToolbox","correct":"from VideoToolbox import VTCopyVideoEncoderList"}],"quickstart":{"code":"import objc\nfrom VideoToolbox import VTCopyVideoEncoderList\n\n# Get a list of available video encoders\n# VTCopyVideoEncoderList takes a CFDictionaryRef as an argument, or None for default\nencoder_list = VTCopyVideoEncoderList(None)\n\nif encoder_list:\n    print(f\"Found {len(encoder_list)} video encoders:\")\n    for encoder in encoder_list:\n        # encoder is an NSDictionary (bridged to Python dict)\n        print(f\"  - {encoder.get('kVTVideoEncoderComponentDisplayName', 'Unknown Encoder')}\")\n        print(f\"    Type: {encoder.get('kVTVideoEncoderComponentType', 'Unknown')}\")\nelse:\n    print(\"No video encoders found.\")","lang":"python","description":"This quickstart demonstrates how to import and use a basic function from the VideoToolbox framework to list available video encoders on the system."},"warnings":[{"fix":"Upgrade to Python 3.10 or newer. If you must use Python 3.9, pin pyobjc-framework-videotoolbox to `<12.0`.","message":"PyObjC 12.0 and later dropped support for Python 3.9.","severity":"breaking","affected_versions":">=12.0"},{"fix":"Upgrade to Python 3.9 or newer. If you must use Python 3.8, pin pyobjc-framework-videotoolbox to `<11.0`.","message":"PyObjC 11.0 and later dropped support for Python 3.8.","severity":"breaking","affected_versions":">=11.0"},{"fix":"Review Python subclasses that implement `init` methods to ensure they correctly handle object ownership and ARC semantics, as incorrect handling can lead to memory leaks or premature deallocation.","message":"PyObjC 11.1 changed how `init` methods in Python subclasses interact with Objective-C's Automatic Reference Counting (ARC). PyObjC now correctly models that methods in the 'init' family steal a reference to self and return a new reference.","severity":"breaking","affected_versions":">=11.1"},{"fix":"If implementing custom `__new__` in an `objc.lookUpClass` or `objc.subclass` derived class, ensure `__init__` is explicitly called if needed. If using PyObjC's default `__new__`, be aware that `__init__` might be bypassed, requiring initialization logic to be handled elsewhere (e.g., in `__new__` or a class method).","message":"Interaction between `__new__` and `__init__` in Python subclasses changed in PyObjC 10.3 and 10.3.1. While 10.3 removed support for calling `__init__` in some cases, 10.3.1 re-enabled it for classes with user-implemented `__new__`. However, if relying on PyObjC's default `__new__`, `__init__` might not be called.","severity":"gotcha","affected_versions":">=10.3"},{"fix":"Exercise caution when using PyObjC with free-threading in Python 3.13 or newer. Thoroughly test thread-safe operations, as the feature is experimental and may have unexpected interactions or stability issues.","message":"PyObjC's experimental support for free-threading (PEP 703) introduced in Python 3.13 is still evolving. Earlier PyObjC versions (e.g., 10.3) explicitly stated no support.","severity":"gotcha","affected_versions":">=10.3 (experimental in >=11.0)"},{"fix":"Before using `os.fspath` with an `NSURL` instance, ensure it represents a local filesystem path. For other types of URLs, explicitly convert to a string representation if needed (e.g., `url.absoluteString()`) or access `url.path` for local paths.","message":"As of PyObjC 10.1, `os.fspath(someURL)` will raise a `TypeError` for Cocoa `NSURL` (or `CFURLRef`) instances that do not refer to local filesystem paths.","severity":"gotcha","affected_versions":">=10.1"}],"env_vars":null,"last_verified":"2026-04-14T00:00:00.000Z","next_check":"2026-07-13T00:00:00.000Z"}