PyObjC CoreMedia Framework

12.1 · active · verified Mon Apr 13

PyObjC-framework-CoreMedia provides Python wrappers for Apple's CoreMedia framework on macOS. It is part of the larger PyObjC project, which creates a bidirectional bridge between Python and Objective-C. The library is actively maintained with frequent releases, often coinciding with new macOS SDKs and Python versions. It is currently at version 12.1 and requires Python 3.10 or newer.

Warnings

Install

Imports

Quickstart

This example demonstrates importing the CoreMedia framework and creating a basic CMTime object, which is a fundamental structure for representing time in CoreMedia. It then prints some of its properties and converts it to seconds.

import CoreMedia

# Create a CMTime object representing 10 seconds at a 600 timescale
# CMTimeMake(value, timescale) -> CMTime
time_value = CoreMedia.CMTimeMake(10 * 600, 600)

print(f"CMTime object: {time_value}")
print(f"Value: {time_value.value}")
print(f"Timescale: {time_value.timescale}")
print(f"Seconds: {CoreMedia.CMTimeGetSeconds(time_value)}")

view raw JSON →