### Create Opacity Animation (Go) Source: https://github.com/andrewarrow/cutlass/wiki/Animation-and-Effects.md Defines a function to create opacity animation parameters using keyframes. It takes start and end opacity values, along with start and end times, to generate a configuration for opacity keyframe animation. Dependencies include the 'fcp' package and 'fmt' for string formatting. ```go func createOpacityAnimation(startOpacity, endOpacity float64, startTime, endTime string) fcp.Param { return fcp.Param{ Name: "opacity", KeyframeAnimation: &fcp.KeyframeAnimation{ Keyframes: []fcp.Keyframe{ { Time: startTime, Value: fmt.Sprintf("%f", startOpacity), Interp: "linear", Curve: "smooth", }, { Time: endTime, Value: fmt.Sprintf("%f", endOpacity), Interp: "easeOut", Curve: "linear", }, }, }, } } ``` -------------------------------- ### Cutlass YouTube and VTT to FCPXML Conversion (Bash) Source: https://github.com/andrewarrow/cutlass/blob/main/README.md Demonstrates a quick start example for Cutlass, showing how to convert YouTube content and VTT subtitle files into segmented FCPXML clips with transition animations. ```bash ./cutlass youtube dQw4w9WgXcQ ./cutlass vtt-clips dQw4w9WgXcQ.en.vtt 00:30_10,01:45_15,02:30_20 # Generates: segmented_video.fcpxml # Result: Perfectly timed clips with transition animations ``` -------------------------------- ### Cutlass Installation and Basic Usage (Bash) Source: https://github.com/andrewarrow/cutlass/blob/main/README.md Provides instructions for installing the Cutlass tool by cloning the repository, building the executable, and demonstrating its basic usage with a help command. ```bash # Clone the future of video generation git clone https://github.com/your-username/cutlass cd cutlass go build # Start creating magic ./cutlass --help ``` -------------------------------- ### Installation and Execution (Bash) Source: https://github.com/andrewarrow/cutlass/blob/main/python/README.md Provides commands to install project dependencies using pip and run the main script. Assumes a requirements.txt file exists. ```bash pip install -r requirements.txt python main.py ``` -------------------------------- ### FCPXML Video Element Position Animation Example Source: https://github.com/andrewarrow/cutlass/blob/main/reference/ANIMATION.md Provides a complete FCPXML example for animating the 'position' of a video element within an asset clip. It illustrates the correct timing relative to the media start time and includes X and Y axis animations with specific keyframes. ```xml ``` -------------------------------- ### Python Dataclass Usage for Elements Source: https://github.com/andrewarrow/cutlass/blob/main/python/CLAUDE.md Shows how to use Python dataclasses from `fcpxml_lib.models.elements` to create Video and AssetClip elements, highlighting the 'start' attribute requirement for images. ```python from fcpxml_lib.models.elements import Video, AssetClip, Asset, Format # โœ… Images use Video elements video_element = Video( ref="r2", duration="240240/24000s", start="0s" # Required for images ) # โœ… Videos use AssetClip elements asset_clip = AssetClip( ref="r2", duration="373400/3000s" # NO start attribute for videos ) ``` -------------------------------- ### FCPXML Video Asset Example Source: https://github.com/andrewarrow/cutlass/blob/main/go/wiki/Architecture-Overview.md Provides an FCPXML example for a video asset. It includes the asset definition with actual duration, format with frameDuration, and the asset-clip wrapper. ```xml ``` -------------------------------- ### Python Implementation Pattern for FCPXML Audio Source: https://github.com/andrewarrow/cutlass/blob/main/python/CLAUDE.md Provides a Python code example demonstrating the correct implementation pattern for handling audio in FCPXML. It shows how to create assets with audio properties and add both video and audio elements to timeline clips. ```python # 1. Create assets with audio properties when include_audio=True asset, format_obj = create_media_asset( video_path, asset_id, format_id, include_audio=True ) # 2. Add both video and audio elements to timeline clip_elements = [ {"type": "video", "ref": asset_id, "duration": duration}, {"type": "audio", "ref": asset_id, "duration": duration, "role": "dialogue"} ] ``` -------------------------------- ### Python: File Organization and Splitting Strategy Source: https://github.com/andrewarrow/cutlass/blob/main/python/CLAUDE.md Illustrates a recommended directory structure for the `fcpxml_lib` package, showing how to split functionality into subpackages and modules. This example highlights the separation of commands, core operations, and data models. ```python # ๐Ÿšจ File getting too long? Split by: # 1. Related functionality into separate modules # 2. Different data models into separate files # 3. Different command implementations into separate modules # โœ… Example split: fcpxml_lib/ โ”œโ”€โ”€ commands/ โ”‚ โ”œโ”€โ”€ pile_commands.py # png-pile, video-pile logic โ”‚ โ”œโ”€โ”€ edge_commands.py # edge, video-at-edge logic โ”‚ โ””โ”€โ”€ timeline_commands.py # basic timeline operations โ”œโ”€โ”€ core/ โ”‚ โ””โ”€โ”€ fcpxml.py # Core FCPXML operations โ””โ”€โ”€ models/ โ””โ”€โ”€ elements.py # Dataclass definitions ``` -------------------------------- ### Color Keyframes XML Example Source: https://github.com/andrewarrow/cutlass/wiki/Animation-and-Effects.md An example of how color parameters are defined using XML, illustrating the structure for keyframes with time, value, interpolation, and curve attributes. This format is used for specifying color animations. ```xml ``` -------------------------------- ### Create Color Animation (Go) Source: https://github.com/andrewarrow/cutlass/wiki/Animation-and-Effects.md Provides a Go function to create color animation parameters. It accepts start and end color strings (RGBA format) and time strings to set up color keyframes. This function is designed to work with the 'fcp' package. ```go func createColorAnimation(startColor, endColor string, startTime, endTime string) fcp.Param { return fcp.Param{ Name: "color", KeyframeAnimation: &fcp.KeyframeAnimation{ Keyframes: []fcp.Keyframe{ { Time: startTime, Value: startColor, // "1 0 0 1" (RGBA) Interp: "linear", Curve: "smooth", }, { Time: endTime, Value: endColor, // "0 1 0 1" (RGBA) Interp: "linear", Curve: "smooth", }, }, }, } } ``` -------------------------------- ### Go: Transactional Resource Creation (Effects Example) Source: https://github.com/andrewarrow/cutlass/blob/main/go/CLAUDE.md Illustrates the correct way to create resources like effects using transaction methods to ensure proper lifecycle management and validation within Final Cut Pro XML generation. ```go โŒ BAD: Direct manipulation bypasses transaction effectID := tx.ReserveIDs(1)[0] effect := Effect{ID: effectID, Name: "Blur", UID: "FFGaussianBlur"} fcpxml.Resources.Effects = append(fcpxml.Resources.Effects, effect) // Result: "Effect ID is invalid" - resource never committed! โœ… GOOD: Use transaction creation methods effectID := tx.ReserveIDs(1)[0] tx.CreateEffect(effectID, "Gaussian Blur", "FFGaussianBlur") // Resource properly managed and committed with tx.Commit() ``` -------------------------------- ### XML for Opacity and Volume Keyframes in FCPXML Source: https://github.com/andrewarrow/cutlass/wiki/Animation-and-Effects.md Shows FCPXML keyframe structures for opacity and volume parameters, which support both 'interp' and 'curve' attributes. Examples include 'linear', 'easeIn', 'easeOut', and 'smooth' interpolations. ```xml ``` -------------------------------- ### Create Image Animation (Go) Source: https://github.com/andrewarrow/cutlass/wiki/Animation-and-Effects.md Demonstrates how to create simple animations for images, including position and scale transformations. This function utilizes keyframe animations for specified parameters. Avoid complex effects that require temporal processing. ```go func createImageAnimation(imageVideo *fcp.Video, duration string) { // โœ… SAFE: Simple position and scale imageVideo.AdjustTransform = &fcp.AdjustTransform{ Params: []fcp.Param{ { Name: "position", KeyframeAnimation: &fcp.KeyframeAnimation{ Keyframes: []fcp.Keyframe{ {Time: "0s", Value: "0 0"}, {Time: duration, Value: "100 50"}, }, }, }, { Name: "scale", KeyframeAnimation: &fcp.KeyframeAnimation{ Keyframes: []fcp.Keyframe{ {Time: "0s", Value: "1 1", Curve: "linear"}, {Time: duration, Value: "1.2 1.2", Curve: "smooth"}, }, }, }, }, } // โŒ AVOID: Complex effects that require temporal processing // imageVideo.FilterVideos = []fcp.FilterVideo{{Ref: "FFMotionBlur"}} } ``` -------------------------------- ### FCPXML Smart Collections XML Examples Source: https://github.com/andrewarrow/cutlass/blob/main/reference/GRAPHICS.md Provides the exact XML structure for the five essential smart collections required in FCPXML. These examples are crucial for understanding how to correctly configure these collections to prevent import errors and application crashes. ```xml ``` -------------------------------- ### Minimal FCPXML Structure (XML) Source: https://github.com/andrewarrow/cutlass/blob/main/python/README.md An example of the minimal, valid FCPXML output generated by the library, suitable for import into Final Cut Pro. Includes essential elements like resources, library, event, and project setup. ```xml ``` -------------------------------- ### Create Basic Transform Animation in Go Source: https://github.com/andrewarrow/cutlass/wiki/Animation-and-Effects.md This Go function creates a basic animation for spatial transformations, including position, scale, and rotation. It utilizes keyframes to define start and end values and allows for specifying animation curves like 'linear' or 'smooth'. ```go func createBasicTransformAnimation(duration string) *fcp.AdjustTransform { startTime := "0s" endTime := duration return &fcp.AdjustTransform{ Params: []fcp.Param{ // Position animation (no attributes) { Name: "position", KeyframeAnimation: &fcp.KeyframeAnimation{ Keyframes: []fcp.Keyframe{ {Time: startTime, Value: "0 0"}, {Time: endTime, Value: "200 100"}, }, }, }, // Scale animation (curve only) { Name: "scale", KeyframeAnimation: &fcp.KeyframeAnimation{ Keyframes: []fcp.Keyframe{ {Time: startTime, Value: "1 1", Curve: "linear"}, {Time: endTime, Value: "1.5 1.5", Curve: "smooth"}, }, }, }, // Rotation animation (curve only) { Name: "rotation", KeyframeAnimation: &fcp.KeyframeAnimation{ Keyframes: []fcp.Keyframe{ {Time: startTime, Value: "0", Curve: "linear"}, {Time: endTime, Value: "45", Curve: "smooth"}, }, }, }, }, } } ``` -------------------------------- ### Go: Transactional Resource Creation Methods Source: https://github.com/andrewarrow/cutlass/blob/main/reference/BAFFLE_ONE.md Provides examples of using transaction methods in Go to create FCPXML resources like assets, formats, and effects. Emphasizes that direct appending to slices bypasses validation and can lead to errors. ```go // For assets tx.CreateAsset(assetID, filePath, baseName, duration, formatID) // For formats tx.CreateFormat(formatID, name, width, height, colorSpace) tx.CreateFormatWithFrameDuration(formatID, frameDuration, width, height, colorSpace) // For effects tx.CreateEffect(effectID, name, uid) ``` -------------------------------- ### Go Transaction Example Source: https://github.com/andrewarrow/cutlass/blob/main/go/wiki/Architecture-Overview.md Demonstrates the usage of transactions for complex operations within the Cutlass framework. It shows how to create a transaction, defer rollback, perform operations, and commit. ```go registry := fcp.NewResourceRegistry(fcpxml) tx := fcp.NewTransaction(registry) defer tx.Rollback() // Perform operations... if err := tx.Commit(); err != nil { return err } ``` -------------------------------- ### FCPXML Image Asset Example Source: https://github.com/andrewarrow/cutlass/blob/main/go/wiki/Architecture-Overview.md Illustrates the FCPXML structure for an image asset. It shows the asset definition with '0s' duration and a video wrapper, along with its format specifications. ```xml