OpenTimelineIO FCP X XML Lite Adapter
Project description
otio-fcpx-xml-lite-adapter
An OpenTimelineIO adapter for converting between OTIO timelines and a simplified interpretation of Final Cut Pro X XML (.fcpxml), focusing on marker and basic structure round-tripping.
Overview
This adapter provides basic read and write capabilities for FCPXML files (tested primarily with v1.9 and v1.13 structures), allowing interchange with OTIO. It is designed to be "lite", meaning it handles core timeline structures, clips, and markers but may not support all advanced FCPXML features.
Its development has focused on specific use cases, such as:
- Transferring marker data (e.g., beat markers from JSON) onto placeholder clips within an FCPXML structure.
- Round-tripping timelines with basic audio/video clips and markers.
Features
- Reader:
- Parses FCPXML v1.9+ (tested with v1.13).
- Reads
<sequence>,<spine>,<gap>,<asset-clip>,<video>(as placeholders), and<marker>elements. - Handles basic resources (
<format>,<asset>,<effect>). - Interprets lanes for track mapping.
- Creates OTIO
Timeline,Track,Clip,Gap,Marker,ExternalReference, andGeneratorReferenceobjects.
- Writer:
- Generates FCPXML v1.9 structure.
- Writes OTIO
Timeline,Track(Video/Audio),Clip,Gap,Marker. - Maps OTIO tracks to FCPXML lanes.
- Handles
ExternalReference(creating<asset-clip>) andGeneratorReference(creating<video>or<title>placeholders using<effect>resources). - Supports placing markers on clips.
- Includes logic for time quantization.
- Creates necessary
<resources>(format, asset, effect).
- Utilities: Includes functions for parsing and formatting FCPXML time strings (
N/Ds). - Diagnostics: Uses Python's
loggingmodule.
Limitations
- Lite Scope: This adapter intentionally does not aim to support the full FCPXML specification. Features like complex effects, transitions, audio adjustments beyond basic roles, multicam clips, detailed metadata mapping, etc., are likely not supported or may be handled in a simplified manner.
- Simplifying Assumptions: The reader and writer might make assumptions about the structure (e.g., expecting a main container gap in the spine for writing).
- Metadata: Minimal metadata transfer beyond basic names and resource links.
Installation
You can install the adapter from PyPI (if published):
pip install otio-fcpx-xml-lite-adapter
Or, for development, clone the repository and install in editable mode:
git clone https://github.com/allenday/otio-fcpx-xml-lite-adapter.git
cd otio-fcpx-xml-lite-adapter
pip install -e .
Usage
Use the adapter like any other standard OTIO adapter via the opentimelineio.adapters module. The adapter name is otio_fcpx_xml_lite_adapter.
import opentimelineio as otio
# --- Reading ---
try:
# Specify the adapter name if it's not automatically detected
timeline = otio.adapters.read_from_file(
"input_sequence.fcpxml",
adapter_name="otio_fcpx_xml_lite_adapter"
)
print(f"Successfully read timeline: {timeline.name}")
# ... process the timeline ...
except otio.exceptions.OTIOError as e:
print(f"Error reading FCPXML: {e}")
# --- Writing ---
# Assume 'my_timeline' is an existing otio.schema.Timeline object
output_path = "output_sequence.fcpxml"
try:
otio.adapters.write_to_file(
my_timeline,
output_path,
adapter_name="otio_fcpx_xml_lite_adapter"
)
print(f"Successfully wrote timeline to: {output_path}")
except otio.exceptions.OTIOError as e:
print(f"Error writing FCPXML: {e}")
# --- Reading/Writing Strings ---
# fcpxml_string = otio.adapters.write_to_string(my_timeline, adapter_name="otio_fcpx_xml_lite_adapter")
# timeline_from_string = otio.adapters.read_from_string(fcpxml_string, adapter_name="otio_fcpx_xml_lite_adapter")
Note: Explicitly specifying adapter_name="otio_fcpx_xml_lite_adapter" might be necessary if the default OTIO plugin loading doesn't pick it up automatically or if other FCPXML adapters are present.
Development
Setup
- Clone the repository.
- Create and activate a virtual environment (recommended).
- Install in editable mode with test dependencies:
pip install -e .[dev]
(Note: Define[dev]extras inpyproject.tomlif needed for test dependencies likepytest)
Running Tests
Tests are written using unittest and can be run with pytest:
pytest
Or run specific files:
pytest tests/test_writer.py
pytest tests/test_roundtrip.py
Contributing
Contributions are welcome! Please feel free to open issues or submit pull requests.
License
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file otio_fcpx_xml_lite_adapter-0.1.0.tar.gz.
File metadata
- Download URL: otio_fcpx_xml_lite_adapter-0.1.0.tar.gz
- Upload date:
- Size: 49.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b5043ce13c9b4698f55886b9d77544ab98c18238d66c1ae1bd124c4154f78abb
|
|
| MD5 |
2cc4327f1ad91284a83194f89908a0b2
|
|
| BLAKE2b-256 |
443f33c7a2420f59eaa5a5093dc6790e39665b31892190b2a0f2372a9fab3085
|
File details
Details for the file otio_fcpx_xml_lite_adapter-0.1.0-py3-none-any.whl.
File metadata
- Download URL: otio_fcpx_xml_lite_adapter-0.1.0-py3-none-any.whl
- Upload date:
- Size: 25.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4edf63e009f49d414c283300e8147b22516e2ef108593b33be937a87df3e5aa0
|
|
| MD5 |
8791c4ac37a5e197b733e133a81fbad6
|
|
| BLAKE2b-256 |
da44f7db2498dc94305f79938231d3c4531449f02ab5e5a6899f4b4ecd0c39be
|