Skip to content

EffectCraft: An open-source motion graphics and compositing tool written by scratch in pure Rust

Merge branch 'main' into worktree-agent-a9fea98fe9839069d (filmcraft rev 2c5ba7a: AAF and OMF interchange)

Brandon Thomasb73028d99908
diff --cc Cargo.lock
index f79cccf14,53487e437..13fb2761a
--- a/Cargo.lock
+++ b/Cargo.lock
@@@ -2002,15 -1988,16 +2010,21 @@@ dependencies =
[[package]]
name = "filmcraft-bitstream"
- version = "0.1.0"
- source = "git+https://github.com/storytold/filmcraft?rev=89cfbf24f698b0f0e538eb7795929f19bbfb1dbb#89cfbf24f698b0f0e538eb7795929f19bbfb1dbb"
+ version = "0.1.1"
+ source = "git+https://github.com/storytold/filmcraft?rev=2c5ba7a72619935f0481f99d59409e0d1844b234#2c5ba7a72619935f0481f99d59409e0d1844b234"
+
++[[package]]
++name = "filmcraft-cfb"
++version = "0.1.1"
++source = "git+https://github.com/storytold/filmcraft?rev=2c5ba7a72619935f0481f99d59409e0d1844b234#2c5ba7a72619935f0481f99d59409e0d1844b234"
+
[[package]]
name = "filmcraft-codecs"
- version = "0.1.0"
- source = "git+https://github.com/storytold/filmcraft?rev=89cfbf24f698b0f0e538eb7795929f19bbfb1dbb#89cfbf24f698b0f0e538eb7795929f19bbfb1dbb"
+ version = "0.1.1"
+ source = "git+https://github.com/storytold/filmcraft?rev=2c5ba7a72619935f0481f99d59409e0d1844b234#2c5ba7a72619935f0481f99d59409e0d1844b234"
dependencies = [
"filmcraft-aac",
+ "filmcraft-ac3",
"filmcraft-av1",
"filmcraft-bitstream",
"filmcraft-color",
@@@ -2060,18 -2052,10 +2079,18 @@@ dependencies =
"serde",
]
+[[package]]
+name = "filmcraft-geom"
- version = "0.1.0"
- source = "git+https://github.com/storytold/filmcraft?rev=89cfbf24f698b0f0e538eb7795929f19bbfb1dbb#89cfbf24f698b0f0e538eb7795929f19bbfb1dbb"
++version = "0.1.1"
++source = "git+https://github.com/storytold/filmcraft?rev=2c5ba7a72619935f0481f99d59409e0d1844b234#2c5ba7a72619935f0481f99d59409e0d1844b234"
+dependencies = [
+ "serde",
+]
+
[[package]]
name = "filmcraft-h264"
- version = "0.1.0"
- source = "git+https://github.com/storytold/filmcraft?rev=89cfbf24f698b0f0e538eb7795929f19bbfb1dbb#89cfbf24f698b0f0e538eb7795929f19bbfb1dbb"
+ version = "0.1.1"
+ source = "git+https://github.com/storytold/filmcraft?rev=2c5ba7a72619935f0481f99d59409e0d1844b234#2c5ba7a72619935f0481f99d59409e0d1844b234"
dependencies = [
"filmcraft-bitstream",
"rayon",
@@@ -2098,26 -2082,10 +2117,27 @@@ dependencies =
"thiserror 2.0.21",
]
+[[package]]
+name = "filmcraft-interchange"
- version = "0.1.0"
- source = "git+https://github.com/storytold/filmcraft?rev=89cfbf24f698b0f0e538eb7795929f19bbfb1dbb#89cfbf24f698b0f0e538eb7795929f19bbfb1dbb"
++version = "0.1.1"
++source = "git+https://github.com/storytold/filmcraft?rev=2c5ba7a72619935f0481f99d59409e0d1844b234#2c5ba7a72619935f0481f99d59409e0d1844b234"
+dependencies = [
++ "filmcraft-cfb",
+ "filmcraft-color",
+ "filmcraft-geom",
+ "filmcraft-media",
+ "filmcraft-project",
+ "filmcraft-time",
+ "roxmltree",
+ "serde",
+ "serde_json",
+ "thiserror 2.0.21",
+]
+
[[package]]
name = "filmcraft-isobmff"
- version = "0.1.0"
- source = "git+https://github.com/storytold/filmcraft?rev=89cfbf24f698b0f0e538eb7795929f19bbfb1dbb#89cfbf24f698b0f0e538eb7795929f19bbfb1dbb"
+ version = "0.1.1"
+ source = "git+https://github.com/storytold/filmcraft?rev=2c5ba7a72619935f0481f99d59409e0d1844b234#2c5ba7a72619935f0481f99d59409e0d1844b234"
dependencies = [
"filmcraft-bitstream",
"thiserror 2.0.21",
@@@ -2142,29 -2110,42 +2162,56 @@@ dependencies =
"thiserror 2.0.21",
]
+ [[package]]
+ name = "filmcraft-mpeg2v"
+ version = "0.1.1"
+ source = "git+https://github.com/storytold/filmcraft?rev=2c5ba7a72619935f0481f99d59409e0d1844b234#2c5ba7a72619935f0481f99d59409e0d1844b234"
+ dependencies = [
+ "rayon",
+ "thiserror 2.0.21",
+ ]
+
+ [[package]]
+ name = "filmcraft-mpegts"
+ version = "0.1.1"
+ source = "git+https://github.com/storytold/filmcraft?rev=2c5ba7a72619935f0481f99d59409e0d1844b234#2c5ba7a72619935f0481f99d59409e0d1844b234"
+ dependencies = [
+ "thiserror 2.0.21",
+ ]
+
+ [[package]]
+ name = "filmcraft-mxf"
+ version = "0.1.1"
+ source = "git+https://github.com/storytold/filmcraft?rev=2c5ba7a72619935f0481f99d59409e0d1844b234#2c5ba7a72619935f0481f99d59409e0d1844b234"
+
+ [[package]]
+ name = "filmcraft-ogg"
+ version = "0.1.1"
+ source = "git+https://github.com/storytold/filmcraft?rev=2c5ba7a72619935f0481f99d59409e0d1844b234#2c5ba7a72619935f0481f99d59409e0d1844b234"
+
[[package]]
name = "filmcraft-opus"
- version = "0.1.0"
- source = "git+https://github.com/storytold/filmcraft?rev=89cfbf24f698b0f0e538eb7795929f19bbfb1dbb#89cfbf24f698b0f0e538eb7795929f19bbfb1dbb"
+ version = "0.1.1"
+ source = "git+https://github.com/storytold/filmcraft?rev=2c5ba7a72619935f0481f99d59409e0d1844b234#2c5ba7a72619935f0481f99d59409e0d1844b234"
+[[package]]
+name = "filmcraft-project"
- version = "0.1.0"
- source = "git+https://github.com/storytold/filmcraft?rev=89cfbf24f698b0f0e538eb7795929f19bbfb1dbb#89cfbf24f698b0f0e538eb7795929f19bbfb1dbb"
++version = "0.1.1"
++source = "git+https://github.com/storytold/filmcraft?rev=2c5ba7a72619935f0481f99d59409e0d1844b234#2c5ba7a72619935f0481f99d59409e0d1844b234"
+dependencies = [
+ "filmcraft-color",
+ "filmcraft-geom",
+ "filmcraft-media",
+ "filmcraft-time",
+ "serde",
+ "serde_json",
+ "thiserror 2.0.21",
+]
+
[[package]]
name = "filmcraft-prores"
- version = "0.1.0"
- source = "git+https://github.com/storytold/filmcraft?rev=89cfbf24f698b0f0e538eb7795929f19bbfb1dbb#89cfbf24f698b0f0e538eb7795929f19bbfb1dbb"
+ version = "0.1.1"
+ source = "git+https://github.com/storytold/filmcraft?rev=2c5ba7a72619935f0481f99d59409e0d1844b234#2c5ba7a72619935f0481f99d59409e0d1844b234"
dependencies = [
"filmcraft-bitstream",
"rayon",
diff --cc Cargo.toml
index 0b38eb2d1,ddf3376f3..3e3bd2e46
--- a/Cargo.toml
+++ b/Cargo.toml
@@@ -69,27 -68,23 +69,27 @@@ exr = "1.74
image = { version = "0.25", default-features = false, features = ["png", "jpeg"] }
# media codecs + containers: FilmCraft's pure-Rust crates, pinned to a revision (plan/adr/0001).
-# Only `crates/media` and `crates/export` may depend on these.
+# Only `crates/media`, `crates/export` and `crates/interchange` may depend on these.
- filmcraft-codecs = { git = "https://github.com/storytold/filmcraft", rev = "89cfbf24f698b0f0e538eb7795929f19bbfb1dbb" }
- filmcraft-media = { git = "https://github.com/storytold/filmcraft", rev = "89cfbf24f698b0f0e538eb7795929f19bbfb1dbb" }
- filmcraft-frame = { git = "https://github.com/storytold/filmcraft", rev = "89cfbf24f698b0f0e538eb7795929f19bbfb1dbb" }
- filmcraft-color = { git = "https://github.com/storytold/filmcraft", rev = "89cfbf24f698b0f0e538eb7795929f19bbfb1dbb" }
- filmcraft-time = { git = "https://github.com/storytold/filmcraft", rev = "89cfbf24f698b0f0e538eb7795929f19bbfb1dbb" }
+ filmcraft-codecs = { git = "https://github.com/storytold/filmcraft", rev = "2c5ba7a72619935f0481f99d59409e0d1844b234" }
+ filmcraft-media = { git = "https://github.com/storytold/filmcraft", rev = "2c5ba7a72619935f0481f99d59409e0d1844b234" }
+ filmcraft-frame = { git = "https://github.com/storytold/filmcraft", rev = "2c5ba7a72619935f0481f99d59409e0d1844b234" }
+ filmcraft-color = { git = "https://github.com/storytold/filmcraft", rev = "2c5ba7a72619935f0481f99d59409e0d1844b234" }
+ filmcraft-time = { git = "https://github.com/storytold/filmcraft", rev = "2c5ba7a72619935f0481f99d59409e0d1844b234" }
# encoders + muxer (crates/export)
- filmcraft-h264enc = { git = "https://github.com/storytold/filmcraft", rev = "89cfbf24f698b0f0e538eb7795929f19bbfb1dbb" }
- filmcraft-prores = { git = "https://github.com/storytold/filmcraft", rev = "89cfbf24f698b0f0e538eb7795929f19bbfb1dbb" }
- filmcraft-aac = { git = "https://github.com/storytold/filmcraft", rev = "89cfbf24f698b0f0e538eb7795929f19bbfb1dbb" }
- filmcraft-isobmff = { git = "https://github.com/storytold/filmcraft", rev = "89cfbf24f698b0f0e538eb7795929f19bbfb1dbb" }
+ filmcraft-h264enc = { git = "https://github.com/storytold/filmcraft", rev = "2c5ba7a72619935f0481f99d59409e0d1844b234" }
+ filmcraft-prores = { git = "https://github.com/storytold/filmcraft", rev = "2c5ba7a72619935f0481f99d59409e0d1844b234" }
+ filmcraft-aac = { git = "https://github.com/storytold/filmcraft", rev = "2c5ba7a72619935f0481f99d59409e0d1844b234" }
+ filmcraft-isobmff = { git = "https://github.com/storytold/filmcraft", rev = "2c5ba7a72619935f0481f99d59409e0d1844b234" }
# decoder used as the round-trip oracle of effectcraft-opusenc (crates/export dev-dependency)
- filmcraft-opus = { git = "https://github.com/storytold/filmcraft", rev = "89cfbf24f698b0f0e538eb7795929f19bbfb1dbb" }
- filmcraft-vp9 = { git = "https://github.com/storytold/filmcraft", rev = "89cfbf24f698b0f0e538eb7795929f19bbfb1dbb" }
+ filmcraft-opus = { git = "https://github.com/storytold/filmcraft", rev = "2c5ba7a72619935f0481f99d59409e0d1844b234" }
+ filmcraft-vp9 = { git = "https://github.com/storytold/filmcraft", rev = "2c5ba7a72619935f0481f99d59409e0d1844b234" }
# decoders used as the round-trip oracles of effectcraft-hevcenc / effectcraft-av1enc (dev-dependencies only)
- filmcraft-hevc = { git = "https://github.com/storytold/filmcraft", rev = "89cfbf24f698b0f0e538eb7795929f19bbfb1dbb" }
- filmcraft-av1 = { git = "https://github.com/storytold/filmcraft", rev = "89cfbf24f698b0f0e538eb7795929f19bbfb1dbb" }
+ filmcraft-hevc = { git = "https://github.com/storytold/filmcraft", rev = "2c5ba7a72619935f0481f99d59409e0d1844b234" }
+ filmcraft-av1 = { git = "https://github.com/storytold/filmcraft", rev = "2c5ba7a72619935f0481f99d59409e0d1844b234" }
+# timeline interchange (EDL, FCP7 XML, FCPXML, OTIO) for Premiere Pro interop (crates/interchange only)
- filmcraft-interchange = { git = "https://github.com/storytold/filmcraft", rev = "89cfbf24f698b0f0e538eb7795929f19bbfb1dbb" }
- filmcraft-project = { git = "https://github.com/storytold/filmcraft", rev = "89cfbf24f698b0f0e538eb7795929f19bbfb1dbb" }
- filmcraft-geom = { git = "https://github.com/storytold/filmcraft", rev = "89cfbf24f698b0f0e538eb7795929f19bbfb1dbb" }
++filmcraft-interchange = { git = "https://github.com/storytold/filmcraft", rev = "2c5ba7a72619935f0481f99d59409e0d1844b234" }
++filmcraft-project = { git = "https://github.com/storytold/filmcraft", rev = "2c5ba7a72619935f0481f99d59409e0d1844b234" }
++filmcraft-geom = { git = "https://github.com/storytold/filmcraft", rev = "2c5ba7a72619935f0481f99d59409e0d1844b234" }
# gpu (the same wgpu eframe / egui-wgpu use)
wgpu = { version = "30.0.1", features = ["fragile-send-sync-non-atomic-wasm"] }
diff --cc crates/engine/src/commands/timeline.rs
index e914a2d1f,000000000..3614ac37d
mode 100644,000000..100644
--- a/crates/engine/src/commands/timeline.rs
+++ b/crates/engine/src/commands/timeline.rs
@@@ -1,228 -1,0 +1,228 @@@
+//! Premiere Pro interop (`effectcraft-interchange`): File ▸ Import ▸ Adobe Premiere Pro Project /
+//! Timeline Interchange… and File ▸ Export ▸ Adobe Premiere Pro Project…, through the public
+//! interchange formats Premiere reads and writes. Export writes Final Cut Pro XML (`.xml`) by
+//! default, which Premiere Pro imports (File ▸ Import); FCPXML, OpenTimelineIO and EDL on request.
+//! The native `.prproj` format has no public specification and is not read or written.
+
+use std::collections::HashMap;
+
+use effectcraft_interchange::{ExportOptions, ImportOptions, PrecompMode, PrerenderMode, Prerendered, TimelineFormat};
+use effectcraft_project::render_queue::{AudioOutput, Channels, OutputFormat, OutputModule, ProResProfile, RenderQueueItem, TimeSpan};
+use effectcraft_project::{ItemId, LayerId, LayerSource, Project};
+use serde_json::{Value, json};
+
+use super::{CommandSpec, always, bad, comp_id, f_p, has_comp, str_p};
+use crate::{EngineError, Result, Session, cmd};
+
+fn format_p(p: &Value, cmd: &str) -> Result<Option<TimelineFormat>> {
+ match str_p(p, "format") {
+ None | Some("") | Some("auto") => Ok(None),
- Some(f) => TimelineFormat::parse(f).map(Some).ok_or_else(|| bad(cmd, format!("unknown format `{f}` (xml, fcpxml, otio, edl)"))),
++ Some(f) => TimelineFormat::parse(f).map(Some).ok_or_else(|| bad(cmd, format!("unknown format `{f}` (xml, fcpxml, otio, edl, aaf, omf)"))),
+ }
+}
+
+fn import_timeline(s: &mut Session, p: &Value) -> Result<Value> {
+ const CMD: &str = "file.importTimeline";
+ let path = str_p(p, "path").ok_or_else(|| bad(CMD, "missing `path`"))?.to_string();
+ if path.to_ascii_lowercase().ends_with(".prproj") {
+ return Err(bad(
+ CMD,
+ "native Premiere Pro projects (.prproj) are not supported: in Premiere Pro use File ▸ Export ▸ Final Cut Pro XML… and import the .xml",
+ ));
+ }
+ let format = format_p(p, CMD)?;
+ let bytes = s.services.read_file(&path).map_err(|e| EngineError::Other(format!("cannot read {path}: {e}")))?;
+ let fp = std::path::Path::new(&path);
+ let opts = ImportOptions {
+ base_dir: fp.parent().map(|d| d.to_string_lossy().to_string()).filter(|d| !d.is_empty()),
+ name: fp.file_name().map(|n| n.to_string_lossy().to_string()).unwrap_or_else(|| "Timeline".into()),
+ edl_frame_rate: f_p(p, "edlFrameRate"),
+ };
+ let importer = s.importer.clone();
+ let services = s.services.clone();
+ let mut probe = move |m: &str| -> Option<effectcraft_project::Footage> {
+ if !services.exists(m) {
+ return None;
+ }
+ importer.as_ref()?.probe(m).ok()
+ };
+ let res = s.edit("Import Timeline", None, |proj, st| {
+ let r = effectcraft_interchange::import(proj, &bytes, format, &opts, &mut probe).map_err(|e| EngineError::Other(e.to_string()))?;
+ st.project_selection = r.comps.clone();
+ Ok(r)
+ })?;
+ if let Some(c) = res.comps.first() {
+ s.open_comp(*c);
+ }
+ let n = res.missing.len();
+ s.toast(match n {
+ 0 => format!("Imported {}", opts.name),
+ _ => format!("Imported {} ({n} missing file{})", opts.name, if n == 1 { "" } else { "s" }),
+ });
+ Ok(json!({
+ "format": res.format.map(|f| f.id()),
+ "folder": res.folder.0,
+ "comps": res.comps.iter().map(|c| c.0).collect::<Vec<_>>(),
+ "allComps": res.all_comps.iter().map(|c| c.0).collect::<Vec<_>>(),
+ "items": res.items.iter().map(|c| c.0).collect::<Vec<_>>(),
+ "missing": res.missing,
+ "warnings": res.warnings,
+ }))
+}
+
+/// File-name-safe text.
+fn safe(s: &str) -> String {
+ let t: String = s.chars().map(|c| if c.is_alphanumeric() || c == '-' || c == '_' { c } else { '_' }).collect();
+ if t.is_empty() { "layer".into() } else { t }
+}
+
+/// A copy of the project where comp `cid` shows layer `lid` alone (cameras and lights kept, so 3D
+/// layers render as they look in the comp).
+fn isolate(project: &Project, cid: ItemId, lid: LayerId) -> Option<Project> {
+ let mut q = project.clone();
+ let c = q.comp_mut(cid)?;
+ for l in &mut c.layers {
+ if l.id == lid {
+ l.switches.solo = false;
+ l.switches.video = true;
+ } else if !matches!(l.source, LayerSource::Camera | LayerSource::Light { .. }) {
+ l.switches.video = false;
+ l.switches.audio = false;
+ l.switches.solo = false;
+ }
+ }
+ Some(q)
+}
+
+/// Render one layer to ProRes 4444 with alpha over its in–out span.
+fn prerender(s: &Session, cid: ItemId, lid: LayerId, path: &str) -> std::result::Result<Prerendered, String> {
+ let exporter = s.exporter.clone().ok_or("export is not available in this build")?;
+ if !exporter.formats().contains(&OutputFormat::ProRes) {
+ return Err("ProRes export is not available in this build".into());
+ }
+ let comp = s.project.comp(cid).ok_or("no composition")?;
+ let l = comp.layer(lid).ok_or("no layer")?;
+ let fd = comp.frame_duration();
+ let start = comp.frame_rate.snap(l.in_point.max(effectcraft_time::Tick::ZERO));
+ let end = l.out_point.min(comp.duration).max(start + fd);
+ let q = isolate(&s.project, cid, lid).ok_or("no composition")?;
+ let mut item = RenderQueueItem::new(0, cid);
+ item.settings.time_span = TimeSpan::Custom { start, end };
+ item.output = OutputModule::for_format(OutputFormat::ProRes);
+ item.output.channels = Channels::Rgba;
+ item.output.prores_profile = ProResProfile::P4444;
+ item.output.audio = AudioOutput::Off;
+ item.output.output = path.to_string();
+ let job = crate::ExportJob {
+ project: &q,
+ footage: s.footage.as_ref(),
+ expr: s.expr.as_deref(),
+ accel: s.accel.as_deref(),
+ item: &item,
+ path,
+ storage: None,
+ label: format!("Pre-render {}", l.name),
+ nested_switches: s.prefs.general.switches_affect_nested_comps,
+ };
+ let r = exporter.export(&job, &mut |_, _| true)?;
+ Ok(Prerendered { path: r.path, width: comp.width, height: comp.height, frame_rate: comp.frame_rate, duration: end - start })
+}
+
+fn export_timeline(s: &mut Session, p: &Value) -> Result<Value> {
+ const CMD: &str = "file.exportTimeline";
+ let mut path = str_p(p, "path").ok_or_else(|| bad(CMD, "missing `path`"))?.to_string();
+ let format = format_p(p, CMD)?.or_else(|| TimelineFormat::from_path(&path)).unwrap_or(TimelineFormat::Fcp7Xml);
+ if TimelineFormat::from_path(&path).is_none() || path.to_ascii_lowercase().ends_with(".prproj") {
+ if let Some(stem) = path.strip_suffix(".prproj").map(str::to_string) {
+ path = stem;
+ }
+ path = format!("{path}.{}", format.extension());
+ }
+ let cid = comp_id(s, p)?;
+ let prerender_mode = match str_p(p, "prerender") {
+ None => match p.get("prerender").and_then(Value::as_bool) {
+ Some(false) => PrerenderMode::None,
+ _ => PrerenderMode::Unsupported,
+ },
+ Some(m) => PrerenderMode::parse(m).ok_or_else(|| bad(CMD, "prerender: none|unsupported|all"))?,
+ };
+ let precomps = match str_p(p, "precomps") {
+ None | Some("nest") => PrecompMode::Nest,
+ Some("prerender") => PrecompMode::Prerender,
+ Some(_) => return Err(bad(CMD, "precomps: nest|prerender")),
+ };
+ let fp = std::path::Path::new(&path);
+ let dir = fp.parent().map(|d| d.to_path_buf()).unwrap_or_default();
+ let stem = fp.file_stem().map(|n| n.to_string_lossy().to_string()).unwrap_or_else(|| "Timeline".into());
+ let relative_to = Some(dir.to_string_lossy().to_string()).filter(|d| !d.is_empty());
+ let opts = ExportOptions { format, prerender: prerender_mode, precomps, relative_to };
+ // Pre-render what the timeline can't represent.
+ let mut pre: HashMap<(ItemId, LayerId), Prerendered> = HashMap::new();
+ let mut rendered = vec![];
+ let mut errors = vec![];
+ for (c, l) in effectcraft_interchange::plan_prerender(&s.project, cid, &opts) {
+ let comp_name = s.project.item(c).map(|i| i.name.clone()).unwrap_or_default();
+ let layer_name = s.project.comp(c).and_then(|cc| cc.layer(l)).map(|x| x.name.clone()).unwrap_or_default();
+ let file = dir.join(format!("{stem}_{}_{}_{}.mov", safe(&comp_name), safe(&layer_name), l.0)).to_string_lossy().to_string();
+ match prerender(s, c, l, &file) {
+ Ok(r) => {
+ rendered.push(r.path.clone());
+ pre.insert((c, l), r);
+ }
+ Err(e) => errors.push(format!("{comp_name} ▸ {layer_name}: {e}")),
+ }
+ }
+ let out = effectcraft_interchange::export(&s.project, cid, &opts, &pre).map_err(|e| EngineError::Other(e.to_string()))?;
+ s.services.write_file(&path, &out.bytes).map_err(|e| EngineError::Other(format!("cannot write {path}: {e}")))?;
+ let mut warnings = out.warnings.clone();
+ warnings.extend(errors.iter().map(|e| format!("pre-render failed: {e}")));
+ s.toast(match format {
+ TimelineFormat::Fcp7Xml => format!("Exported {path} (Final Cut Pro XML; import it in Premiere Pro with File ▸ Import)"),
+ _ => format!("Exported {path} ({})", format.label()),
+ });
+ Ok(json!({
+ "path": path,
+ "format": format.id(),
+ "bytes": out.bytes.len(),
+ "sequences": out.sequences,
+ "videoTracks": out.video_tracks,
+ "audioTracks": out.audio_tracks,
+ "clips": out.clips,
+ "prerendered": rendered,
+ "warnings": warnings,
+ }))
+}
+
+/// The formats, for agents and the export dialog.
+fn timeline_formats(_: &mut Session, _: &Value) -> Result<Value> {
+ Ok(json!(
+ TimelineFormat::ALL
+ .iter()
+ .map(|f| json!({"id": f.id(), "label": f.label(), "extension": f.extension(), "import": true, "export": true}))
+ .collect::<Vec<_>>()
+ ))
+}
+
+pub fn specs() -> Vec<CommandSpec> {
+ vec![
+ cmd!(
+ "file.importTimeline",
+ "Adobe Premiere Pro Project...",
+ ["File", "Import"],
+ None,
- "{path (.xml Final Cut Pro XML from Premiere Pro or .fcpxml .otio .edl), format?: auto|xml|fcpxml|otio|edl, edlFrameRate?: number}",
++ "{path (.xml Final Cut Pro XML from Premiere Pro or .fcpxml .otio .edl .aaf .omf), format?: auto|xml|fcpxml|otio|edl|aaf|omf, edlFrameRate?: number}",
+ always,
+ import_timeline
+ ),
+ cmd!(
+ "file.exportTimeline",
+ "Adobe Premiere Pro Project...",
+ ["File", "Export"],
+ None,
- "{comp?, path (Final Cut Pro XML .xml for Premiere Pro or .fcpxml .otio .edl), format?: xml|fcpxml|otio|edl, prerender?: none|unsupported|all, precomps?: nest|prerender}",
++ "{comp?, path (Final Cut Pro XML .xml for Premiere Pro or .fcpxml .otio .edl .aaf .omf), format?: xml|fcpxml|otio|edl|aaf|omf, prerender?: none|unsupported|all, precomps?: nest|prerender}",
+ has_comp,
+ export_timeline
+ ),
+ cmd!("file.timelineFormats", "Timeline Interchange Formats", [], None, "{}", always, timeline_formats),
+ ]
+}
diff --cc crates/engine/src/tests_timeline_interchange.rs
index 2d3361b6d,000000000..b32e19c49
mode 100644,000000..100644
--- a/crates/engine/src/tests_timeline_interchange.rs
+++ b/crates/engine/src/tests_timeline_interchange.rs
@@@ -1,66 -1,0 +1,66 @@@
+//! File ▸ Import / Export ▸ Adobe Premiere Pro Project… (timeline interchange) through the command
+//! registry, without media decoding (pixels: `crates/host/tests/timeline_interop.rs`).
+
+use serde_json::json;
+
+use crate::Session;
+use crate::project::{ItemId, ItemKind, LayerSource};
+
+fn tmp(name: &str) -> String {
+ let d = std::env::temp_dir().join(format!("effectcraft-timeline-tests-{}", std::process::id()));
+ std::fs::create_dir_all(&d).unwrap();
+ d.join(name).to_string_lossy().to_string()
+}
+
+#[test]
+fn export_and_reimport_timeline_commands() {
+ let mut s = Session::default();
+ s.execute("comp.new", json!({"name": "Main", "width": 320, "height": 180, "frameRate": 25, "duration": 2})).unwrap();
+ let full = s.execute("layer.newSolid", json!({"color": "#ff8000"})).unwrap()["layer"].as_u64().unwrap();
+ s.execute("prop.set", json!({"layer": full, "path": "transform/opacity", "value": 40})).unwrap();
+ s.execute("layer.newSolid", json!({"color": "#0080ff", "width": 50, "height": 50})).unwrap();
+ s.execute("layer.newNull", json!({})).unwrap();
+ let main = s.active_comp_id().unwrap().0;
+ for (ext, format) in [("xml", "xml"), ("fcpxml", "fcpxml"), ("otio", "otio")] {
+ let path = tmp(&format!("Main.{ext}"));
+ // No exporter in a bare session: the small solid can't be pre-rendered and is left out.
+ let r = s.execute_checked("file.exportTimeline", json!({"comp": main, "path": path})).unwrap();
+ assert_eq!(r["format"], format);
+ // Only Final Cut Pro XML carries colour mattes; the other formats would pre-render solids.
+ assert_eq!(r["videoTracks"], if format == "xml" { 1 } else { 0 }, "{r}");
+ assert!(r["warnings"].as_array().unwrap().iter().any(|w| w.as_str().unwrap().contains("pre-render")), "{r}");
+ let r = s.execute_checked("file.importTimeline", json!({"path": path})).unwrap();
+ assert_eq!(r["format"], format);
+ let cid = ItemId(r["comps"][0].as_u64().unwrap());
+ assert_eq!(s.active_comp_id(), Some(cid));
+ let c = s.project.comp(cid).unwrap();
+ assert_eq!((c.width, c.height), (320, 180));
+ if format != "xml" {
+ assert!(c.layers.is_empty());
+ continue;
+ }
+ assert_eq!(c.layers.len(), 1);
+ let l = &c.layers[0];
+ let LayerSource::Solid { item } = l.source else { panic!("{:?}", l.source) };
+ let ItemKind::Solid(sol) = &s.project.item(item).unwrap().kind else { panic!() };
+ assert!((sol.color[0] - 1.0).abs() < 0.01 && (sol.color[2]).abs() < 0.01, "{:?}", sol.color);
+ assert!((l.transform().unwrap().get("opacity").unwrap().value.as_f64() - 40.0).abs() < 1e-6);
+ let folder = ItemId(r["folder"].as_u64().unwrap());
+ assert_eq!(s.project.item(folder).unwrap().name, format!("Main.{ext}"));
+ }
+ // A path without an extension gets the format's.
+ let r = s.execute_checked("file.exportTimeline", json!({"comp": main, "path": tmp("NoExt"), "format": "otio", "prerender": "none"})).unwrap();
+ assert!(r["path"].as_str().unwrap().ends_with("NoExt.otio"));
+ assert!(s.execute_checked("file.exportTimeline", json!({"path": tmp("x.xml"), "prerender": "sometimes"})).is_err());
+ assert!(s.execute_checked("file.importTimeline", json!({"path": "/nope/a.prproj"})).is_err());
+ let formats = s.execute("file.timelineFormats", json!({})).unwrap();
- assert_eq!(formats.as_array().unwrap().len(), 4);
++ assert_eq!(formats.as_array().unwrap().len(), 6);
+}
+
+#[test]
+fn premiere_menu_entries_keep_after_effects_labels() {
+ let entries = crate::menus::entries();
+ let find = |cmd: &str| entries.iter().find(|(_, e)| e.command == cmd).map(|(p, e)| (p.join(" > "), e.label.clone()));
+ assert_eq!(find("file.exportTimeline"), Some(("File > Export".into(), "Adobe Premiere Pro Project...".into())));
+ assert_eq!(find("file.importTimeline"), Some(("File > Import".into(), "Adobe Premiere Pro Project...".into())));
+}
diff --cc crates/interchange/src/lib.rs
index 57e802b4d,000000000..b9e678cfc
mode 100644,000000..100644
--- a/crates/interchange/src/lib.rs
+++ b/crates/interchange/src/lib.rs
@@@ -1,190 -1,0 +1,206 @@@
+//! Premiere Pro interop through the public timeline interchange formats Premiere itself reads and
+//! writes (After Effects' File ▸ Import / Export ▸ Adobe Premiere Pro Project…):
+//!
+//! - **Final Cut Pro 7 XML** (`xmeml`, `.xml`): Premiere's File ▸ Export ▸ Final Cut Pro XML and
+//! File ▸ Import; the default for export;
+//! - **FCPXML** 1.9–1.11 (`.fcpxml`);
+//! - **OpenTimelineIO** (`.otio`);
- //! - **CMX 3600 EDL** (`.edl`).
++//! - **CMX 3600 EDL** (`.edl`);
++//! - **AAF** (`.aaf`) and **OMF** (`.omf`) (embedded audio is not extracted).
+//!
+//! Parsing and writing is FilmCraft's `filmcraft-interchange` (our first-party sibling project);
+//! this crate maps its timeline model to compositions and back:
+//!
+//! - [`import`]: sequences → compositions (size, rate, duration, pixel aspect, start timecode,
+//! markers); video tracks → layers stacked by track (top track = top layer); clips → footage
+//! layers with in/out/start, speed and reverse (time stretch), frame holds (time remapping),
+//! Motion (position/scale/rotation/anchor point) and Opacity with keyframes; cross dissolves and
+//! dips → overlapping layers with opacity keyframes; nested sequences → precomps; audio tracks →
+//! audio-only layers with Audio Levels; bins → Project panel folders; missing media →
+//! placeholders.
+//! - [`export`]: a composition → one sequence with one track per layer (bottom layer = V1),
+//! footage clips with their timing, Motion and Opacity; precomps as nested sequences; solids as
+//! colour mattes; layers only EffectCraft can draw (text, shapes, effects, masks, 3D…) are
+//! either left out or pre-rendered by the caller (ProRes 4444 with alpha, see
+//! [`plan_prerender`]) and referenced as media.
+//!
+//! The native `.prproj` format has no public specification and is not read or written.
+//!
+//! This crate is L3 and does no file I/O: media files are probed through a callback, pre-rendered
+//! media come in as paths, and documents are bytes.
+
+mod export;
+mod import;
+#[cfg(test)]
+mod tests;
+
+pub use export::{ExportOptions, ExportOutput, PrecompMode, PrerenderMode, Prerendered, export, plan_prerender, prerender_reason};
+pub use import::{ImportOptions, ImportResult, import};
+
+pub use filmcraft_geom as fc_geom;
+/// FilmCraft's interchange crate (format readers/writers) and timeline model, re-exported so
+/// tests and tools can build documents in code.
+pub use filmcraft_interchange as fc;
+pub use filmcraft_media as fc_media;
+pub use filmcraft_project as fc_project;
+pub use filmcraft_time as fc_time;
+
+use serde::{Deserialize, Serialize};
+
+/// A timeline interchange format.
+#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub enum TimelineFormat {
+ /// Final Cut Pro 7 XML (`xmeml`), the format Premiere Pro imports and exports.
+ Fcp7Xml,
+ /// FCPXML 1.9–1.11.
+ Fcpxml,
+ /// OpenTimelineIO JSON.
+ Otio,
+ /// CMX 3600 edit decision list.
+ Edl,
++ /// Advanced Authoring Format (AAF Edit Protocol), as Premiere Pro exports for audio post.
++ Aaf,
++ /// OMF Interchange 2.0.
++ Omf,
+}
+
+impl TimelineFormat {
- pub const ALL: [TimelineFormat; 4] = [TimelineFormat::Fcp7Xml, TimelineFormat::Fcpxml, TimelineFormat::Otio, TimelineFormat::Edl];
++ pub const ALL: [TimelineFormat; 6] =
++ [TimelineFormat::Fcp7Xml, TimelineFormat::Fcpxml, TimelineFormat::Otio, TimelineFormat::Edl, TimelineFormat::Aaf, TimelineFormat::Omf];
+
+ /// Id used by commands (`xml`, `fcpxml`, `otio`, `edl`).
+ pub fn id(self) -> &'static str {
+ match self {
+ TimelineFormat::Fcp7Xml => "xml",
+ TimelineFormat::Fcpxml => "fcpxml",
+ TimelineFormat::Otio => "otio",
+ TimelineFormat::Edl => "edl",
++ TimelineFormat::Aaf => "aaf",
++ TimelineFormat::Omf => "omf",
+ }
+ }
+
+ pub fn label(self) -> &'static str {
+ match self {
+ TimelineFormat::Fcp7Xml => "Final Cut Pro XML (Premiere Pro)",
+ TimelineFormat::Fcpxml => "FCPXML",
+ TimelineFormat::Otio => "OpenTimelineIO",
+ TimelineFormat::Edl => "CMX 3600 EDL",
++ TimelineFormat::Aaf => "AAF",
++ TimelineFormat::Omf => "OMF",
+ }
+ }
+
+ /// File extension (without the dot).
+ pub fn extension(self) -> &'static str {
+ self.fc().extension()
+ }
+
+ /// Parse a command parameter: a format id, a name or an extension.
+ pub fn parse(s: &str) -> Option<TimelineFormat> {
+ match s.trim().trim_start_matches('.').to_ascii_lowercase().replace([' ', '_', '-'], "").as_str() {
+ "xml" | "fcp7" | "fcp7xml" | "xmeml" | "finalcutproxml" | "premiere" | "premierepro" | "prproj" => Some(TimelineFormat::Fcp7Xml),
+ "fcpxml" | "fcpxmld" | "fcpx" => Some(TimelineFormat::Fcpxml),
+ "otio" | "opentimelineio" => Some(TimelineFormat::Otio),
+ "edl" | "cmx3600" | "cmx" => Some(TimelineFormat::Edl),
++ "aaf" => Some(TimelineFormat::Aaf),
++ "omf" | "omfi" => Some(TimelineFormat::Omf),
+ _ => None,
+ }
+ }
+
+ /// Format of a file from its extension.
+ pub fn from_path(path: &str) -> Option<TimelineFormat> {
+ let ext = path.rsplit_once('.').map(|(_, e)| e)?;
+ if ext.contains('/') || ext.contains('\\') {
+ return None;
+ }
+ filmcraft_interchange::Format::from_extension(ext).map(TimelineFormat::from_fc)
+ }
+
+ /// Sniff a document (bytes first, the extension as a hint for ambiguous `.xml`).
+ pub fn detect(bytes: &[u8], path: Option<&str>) -> Option<TimelineFormat> {
+ let ext = path.and_then(|p| p.rsplit_once('.')).map(|(_, e)| e);
+ filmcraft_interchange::detect(bytes, ext).map(TimelineFormat::from_fc)
+ }
+
+ pub(crate) fn fc(self) -> filmcraft_interchange::Format {
+ match self {
+ TimelineFormat::Fcp7Xml => filmcraft_interchange::Format::Fcp7Xml,
+ TimelineFormat::Fcpxml => filmcraft_interchange::Format::Fcpxml,
+ TimelineFormat::Otio => filmcraft_interchange::Format::Otio,
+ TimelineFormat::Edl => filmcraft_interchange::Format::Edl,
++ TimelineFormat::Aaf => filmcraft_interchange::Format::Aaf,
++ TimelineFormat::Omf => filmcraft_interchange::Format::Omf,
+ }
+ }
+
+ pub(crate) fn from_fc(f: filmcraft_interchange::Format) -> TimelineFormat {
+ match f {
+ filmcraft_interchange::Format::Fcp7Xml => TimelineFormat::Fcp7Xml,
+ filmcraft_interchange::Format::Fcpxml => TimelineFormat::Fcpxml,
+ filmcraft_interchange::Format::Otio => TimelineFormat::Otio,
+ filmcraft_interchange::Format::Edl => TimelineFormat::Edl,
++ filmcraft_interchange::Format::Aaf => TimelineFormat::Aaf,
++ filmcraft_interchange::Format::Omf => TimelineFormat::Omf,
+ }
+ }
+}
+
+#[derive(Debug, thiserror::Error)]
+pub enum Error {
+ #[error("{0}")]
+ Interchange(#[from] filmcraft_interchange::Error),
+ #[error("not a timeline document (expected Final Cut Pro XML, FCPXML, OpenTimelineIO or EDL)")]
+ UnknownFormat,
+ #[error("no composition {0}")]
+ NoComp(u64),
+}
+
+pub type Result<T> = std::result::Result<T, Error>;
+
+// ---------------------------------------------------------------- shared conversions
+
+pub(crate) fn rate_in(r: filmcraft_time::FrameRate) -> effectcraft_time::FrameRate {
+ if r.num <= 0 || r.den <= 0 { effectcraft_time::FrameRate::new(30, 1) } else { effectcraft_time::FrameRate::new(r.num, r.den) }
+}
+
+pub(crate) fn rate_out(r: effectcraft_time::FrameRate) -> filmcraft_time::FrameRate {
+ filmcraft_time::FrameRate { num: r.num, den: r.den }
+}
+
+// Both projects count time in the same ticks (254 016 000 000 per second).
+const _: () = assert!(filmcraft_time::TICKS_PER_SECOND == effectcraft_time::TICKS_PER_SECOND);
+
+pub(crate) fn tick_in(t: filmcraft_time::Tick) -> effectcraft_time::Tick {
+ effectcraft_time::Tick(t.0)
+}
+
+pub(crate) fn tick_out(t: effectcraft_time::Tick) -> filmcraft_time::Tick {
+ filmcraft_time::Tick(t.0)
+}
+
+/// A pixel aspect ratio as a small fraction (1.0 → 1:1, 0.9 → 9:10, 1.2121 → 40:33…).
+pub(crate) fn par_fraction(par: f64) -> (u32, u32) {
+ if !par.is_finite() || par <= 0.0 || (par - 1.0).abs() < 1e-6 {
+ return (1, 1);
+ }
+ let mut best = (1u32, 1u32);
+ let mut err = f64::MAX;
+ for den in 1..=200u32 {
+ let num = (par * den as f64).round() as u32;
+ if num == 0 {
+ continue;
+ }
+ let e = (num as f64 / den as f64 - par).abs();
+ if e < err - 1e-9 {
+ err = e;
+ best = (num, den);
+ }
+ if e < 1e-6 {
+ break;
+ }
+ }
+ best
+}
diff --cc crates/interchange/src/tests.rs
index 530ed4556,000000000..474a4a386
mode 100644,000000..100644
--- a/crates/interchange/src/tests.rs
+++ b/crates/interchange/src/tests.rs
@@@ -1,474 -1,0 +1,500 @@@
+//! Import of documents written in code with FilmCraft's writers, and export → re-import.
+
+use std::collections::HashMap;
+use std::sync::Arc;
+
+use effectcraft_keyframe::{Keyframe, Value};
+use effectcraft_project::{Comp, Footage, FootageKind, ItemId, ItemKind, Layer, LayerSource, Project};
+use effectcraft_time::{FrameRate, Tick};
+use filmcraft_project as fp;
+
+use crate::*;
+
+const W: u32 = 640;
+const H: u32 = 360;
+
+fn secs(s: f64) -> filmcraft_time::Tick {
+ filmcraft_time::Tick::from_seconds_f64(s)
+}
+
+fn t(s: f64) -> Tick {
+ Tick::from_seconds_f64(s)
+}
+
+fn info(kind: filmcraft_media::MediaKind, video: bool, audio: bool) -> filmcraft_media::MediaInfo {
+ filmcraft_media::MediaInfo {
+ name: String::new(),
+ kind,
+ duration: secs(20.0),
+ video: video.then(|| filmcraft_media::VideoStreamInfo {
+ width: W,
+ height: H,
+ frame_rate: filmcraft_time::FrameRate { num: 25, den: 1 },
+ par: (1, 1),
+ codec: "png".into(),
+ pixel_format: String::new(),
+ color: Default::default(),
+ has_alpha: false,
+ bitrate: None,
+ }),
+ audio: audio.then(|| filmcraft_media::AudioStreamInfo { sample_rate: 48_000, channels: 2, codec: "pcm".into(), bits_per_sample: Some(16) }),
+ container: String::new(),
+ start_timecode: None,
+ file_size: None,
+ }
+}
+
+fn media(p: &mut fp::Project, name: &str, path: &str, kind: filmcraft_media::MediaKind, video: bool, audio: bool, bin: Option<fp::BinId>) -> fp::ItemId {
+ let clip = fp::MediaClip {
+ media: fp::MediaRef::File { path: path.into() },
+ info: info(kind, video, audio),
+ interpret: Default::default(),
+ mark_in: None,
+ mark_out: None,
+ markers: vec![],
+ offline: false,
+ proxy: None,
+ identity: None,
+ };
+ p.add_item(name, fp::Label::Iris, fp::ItemKind::Media(clip), bin)
+}
+
+fn rate() -> filmcraft_time::FrameRate {
+ filmcraft_time::FrameRate { num: 25, den: 1 }
+}
+
+fn item(p: &mut fp::Project, it: fp::ItemId, kind: fp::TrackKind, start: f64, src: f64, dur: f64) -> fp::TrackItem {
+ p.make_track_item(it, kind, secs(start), filmcraft_time::TimeRange::new(secs(src), secs(dur)), rate()).unwrap()
+}
+
+/// A Premiere-like edit: two clips with a cross dissolve on V1, a speed-changed, scaled and
+/// faded clip on V2, a nested sequence on V3, and an audio clip at -6 dB on A1.
+fn edit() -> (fp::Project, fp::ItemId) {
+ let mut p = fp::Project::new("Edit");
+ let bin = p.add_bin("Footage", None);
+ let a = media(&mut p, "a.png", "/media/a.mov", filmcraft_media::MediaKind::Movie, true, false, Some(bin));
+ let b = media(&mut p, "b.png", "/media/b.mov", filmcraft_media::MediaKind::Movie, true, false, Some(bin));
+ let s = media(&mut p, "tone.wav", "/media/tone.wav", filmcraft_media::MediaKind::AudioOnly, false, true, Some(bin));
+ let settings = fp::SequenceSettings { width: W, height: H, frame_rate: rate(), ..Default::default() };
+ let nested = p.new_sequence("Nested", settings.clone(), 1, 0, None);
+ let n_clip = item(&mut p, a, fp::TrackKind::Video, 0.0, 0.0, 2.0);
+ p.sequence_mut(nested).unwrap().video_tracks[0].items.push(n_clip);
+ let main = p.new_sequence("Main", settings, 3, 1, None);
+
+ let ca = item(&mut p, a, fp::TrackKind::Video, 0.0, 0.0, 2.0);
+ let cb = item(&mut p, b, fp::TrackKind::Video, 2.0, 1.0, 2.0);
+ let tr = fp::Transition {
+ id: fp::TransitionId(p.alloc_id()),
+ effect: fp::find_effect("cross_dissolve").unwrap().instance(),
+ start: secs(1.6),
+ duration: secs(0.8),
+ from: Some(ca.id),
+ to: Some(cb.id),
+ align: fp::TransitionAlign::CenterAtCut,
+ reverse: false,
+ };
+ let mut cc = item(&mut p, b, fp::TrackKind::Video, 1.0, 2.0, 2.0);
+ cc.speed = 2.0;
+ let m = cc.effect_mut("motion").unwrap();
+ m.params.insert("scale".into(), fp::Param::new(fp::ParamValue::Float(50.0)));
+ m.params.insert("rotation".into(), fp::Param::new(fp::ParamValue::Float(30.0)));
+ let mut pos = fp::Param::new(fp::ParamValue::Vec2(filmcraft_geom::Vec2 { x: 100.0, y: 100.0 }));
+ pos.keyframes = vec![
+ fp::Keyframe::new(secs(0.0), fp::ParamValue::Vec2(filmcraft_geom::Vec2 { x: 100.0, y: 100.0 })),
+ fp::Keyframe::new(secs(1.0), fp::ParamValue::Vec2(filmcraft_geom::Vec2 { x: 300.0, y: 200.0 })),
+ ];
+ m.params.insert("position".into(), pos);
+ cc.effect_mut("opacity").unwrap().params.insert("opacity".into(), fp::Param::new(fp::ParamValue::Float(50.0)));
+ let cn = item(&mut p, nested, fp::TrackKind::Video, 4.0, 0.0, 2.0);
+ let mut cs = item(&mut p, s, fp::TrackKind::Audio, 0.0, 0.0, 3.0);
+ cs.effect_mut("volume").unwrap().params.insert("level".into(), fp::Param::new(fp::ParamValue::Float(-6.0)));
+ let seq = p.sequence_mut(main).unwrap();
+ seq.video_tracks[0].items = vec![ca, cb];
+ seq.video_tracks[0].transitions = vec![tr];
+ seq.video_tracks[1].items = vec![cc];
+ seq.video_tracks[2].items = vec![cn];
+ seq.audio_tracks[0].items = vec![cs];
+ (p, main)
+}
+
+fn probe(path: &str) -> Option<Footage> {
+ let audio = path.ends_with(".wav");
+ Some(Footage {
+ path: path.into(),
+ kind: if audio { FootageKind::Audio } else { FootageKind::Video },
+ width: if audio { 0 } else { W },
+ height: if audio { 0 } else { H },
+ frame_rate: FrameRate::new(25, 1),
+ duration: t(20.0),
+ has_video: !audio,
+ has_audio: audio,
+ ..Default::default()
+ })
+}
+
+fn import_doc(bytes: &[u8], name: &str, probe_fn: &mut dyn FnMut(&str) -> Option<Footage>) -> (Project, ImportResult) {
+ let mut p = Project::default();
+ let r = import(&mut p, bytes, None, &ImportOptions { name: name.into(), ..Default::default() }, probe_fn).unwrap();
+ (p, r)
+}
+
+fn layer<'a>(c: &'a Comp, name: &str) -> &'a Layer {
+ c.layers.iter().find(|l| l.name == name).unwrap_or_else(|| panic!("no layer {name}: {:?}", c.layers.iter().map(|l| &l.name).collect::<Vec<_>>()))
+}
+
+fn near(a: Tick, b: Tick) -> bool {
+ (a.0 - b.0).abs() <= Tick::from_seconds_f64(0.001).0
+}
+
+fn check_structure(p: &Project, r: &ImportResult, motion: bool) {
+ let main = r.comps.iter().copied().find(|c| p.item(*c).unwrap().name == "Main").expect("Main comp");
+ let c = p.comp(main).unwrap();
+ assert_eq!((c.width, c.height), (W, H));
+ assert_eq!(c.frame_rate, FrameRate::new(25, 1));
+ assert!(near(c.duration, t(6.0)), "{:?}", c.duration.seconds());
+ // V3 (nested) on top, then V2, then V1's later clip, then the earlier one; audio last.
+ let names: Vec<&str> = c.layers.iter().map(|l| l.name.as_str()).collect();
+ let pos = |n: &str| names.iter().position(|x| x.starts_with(n)).unwrap_or_else(|| panic!("{n} in {names:?}"));
+ assert!(pos("Nested") < pos("b.png"), "{names:?}");
+ let nested = layer(c, "Nested");
+ assert!(matches!(nested.source, LayerSource::Comp { .. }));
+ assert!(near(nested.in_point, t(4.0)) && near(nested.out_point, t(6.0)));
+ // The faster clip: 200 % speed → 50 % stretch, source 2 s at its in point.
+ let fast = c.layers.iter().find(|l| (l.stretch - 50.0).abs() < 1e-6).expect("stretched layer");
+ assert!(near(fast.in_point, t(1.0)) && near(fast.out_point, t(3.0)));
+ assert!(near(fast.layer_time(t(1.0)), t(2.0)), "{}", fast.layer_time(t(1.0)).seconds());
+ // V1: b above a, overlapping over the dissolve; b fades in.
+ let v1: Vec<&Layer> =
+ c.layers.iter().filter(|l| (l.stretch - 100.0).abs() < 1e-6 && matches!(l.source, LayerSource::Footage { .. }) && l.switches.video).collect();
+ assert_eq!(v1.len(), 2, "{names:?}");
+ let (lb, la) = (v1[0], v1[1]);
+ assert!(near(la.in_point, t(0.0)) && near(la.out_point, t(2.4)), "{:?}", la.out_point.seconds());
+ assert!(near(lb.in_point, t(1.6)) && near(lb.out_point, t(4.0)), "{:?}", lb.in_point.seconds());
+ assert!(near(lb.layer_time(t(2.0)), t(1.0)));
+ let op = lb.transform().unwrap().get("opacity").unwrap();
+ assert_eq!(op.keys.len(), 2);
+ assert!(op.value_at(lb.layer_time(t(1.6))).as_f64() < 1e-6);
+ assert!((op.value_at(lb.layer_time(t(2.0))).as_f64() - 50.0).abs() < 1.0);
+ assert!((op.value_at(lb.layer_time(t(3.0))).as_f64() - 100.0).abs() < 1e-6);
+ // Audio: an audio-only layer at -6 dB.
+ let au = c.layers.iter().find(|l| !l.switches.video && l.switches.audio).expect("audio layer");
+ assert!(near(au.out_point, t(3.0)));
+ if motion {
+ let lv = au.props.prop("audio/levels").unwrap().value.as_vec2();
+ assert!((lv[0] + 6.0).abs() < 0.01, "{lv:?}");
+ let tr = fast.transform().unwrap();
+ assert_eq!(tr.get("scale").unwrap().value.as_vec3()[..2], [50.0, 50.0]);
+ assert!((tr.get("rotation").unwrap().value.as_f64() - 30.0).abs() < 1e-6);
+ assert!((tr.get("opacity").unwrap().value.as_f64() - 50.0).abs() < 1e-6);
+ let pk = &tr.get("position").unwrap().keys;
+ assert_eq!(pk.len(), 2);
+ // Clip time 1 s = comp 2 s = layer time 4 s at 200 % speed.
+ assert!(near(pk[1].time, fast.layer_time(t(2.0))));
+ assert_eq!(pk[1].value.as_vec3()[..2], [300.0, 200.0]);
+ }
+ // Everything lands in the document's folder.
+ assert!(p.item(r.folder).unwrap().is_folder());
+ assert!(p.items.values().filter(|i| i.id != r.folder).all(|i| i.parent.is_some()));
+}
+
+/// A Premiere-style xmeml export with a bin, a master clip, Basic Motion and Opacity keyframes.
+const PREMIERE_XML: &str = r#"<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE xmeml>
+<xmeml version="4">
+ <project>
+ <name>Promo</name>
+ <children>
+ <bin>
+ <name>Shots</name>
+ <children>
+ <bin>
+ <name>Day 1</name>
+ <children>
+ <clip id="masterclip-1">
+ <name>wide.mov</name>
+ <duration>250</duration>
+ <rate><timebase>25</timebase><ntsc>FALSE</ntsc></rate>
+ <media><video><track><clipitem id="clipitem-m1"><name>wide.mov</name>
+ <file id="file-1">
+ <name>wide.mov</name>
+ <pathurl>file://localhost/media/wide%20shot.mov</pathurl>
+ <rate><timebase>25</timebase><ntsc>FALSE</ntsc></rate>
+ <duration>250</duration>
+ <media><video><samplecharacteristics><width>640</width><height>360</height></samplecharacteristics></video></media>
+ </file>
+ </clipitem></track></video></media>
+ </clip>
+ </children>
+ </bin>
+ </children>
+ </bin>
+ <sequence id="sequence-1">
+ <name>Promo Cut</name>
+ <duration>50</duration>
+ <rate><timebase>25</timebase><ntsc>FALSE</ntsc></rate>
+ <media>
+ <video>
+ <format><samplecharacteristics><rate><timebase>25</timebase></rate><width>640</width><height>360</height><pixelaspectratio>square</pixelaspectratio></samplecharacteristics></format>
+ <track>
+ <clipitem id="clipitem-1">
+ <masterclipid>masterclip-1</masterclipid>
+ <name>wide.mov</name>
+ <enabled>TRUE</enabled>
+ <rate><timebase>25</timebase><ntsc>FALSE</ntsc></rate>
+ <start>0</start><end>50</end><in>25</in><out>75</out>
+ <file id="file-1"/>
+ <filter>
+ <effect>
+ <name>Basic Motion</name><effectid>basic</effectid><effectcategory>motion</effectcategory><effecttype>motion</effecttype><mediatype>video</mediatype>
+ <parameter><parameterid>scale</parameterid><name>Scale</name><value>150</value></parameter>
+ <parameter><parameterid>center</parameterid><name>Center</name><value><horiz>0.25</horiz><vert>0</vert></value></parameter>
+ </effect>
+ </filter>
+ <filter>
+ <effect>
+ <name>Opacity</name><effectid>opacity</effectid><effectcategory>motion</effectcategory><effecttype>motion</effecttype><mediatype>video</mediatype>
+ <parameter><parameterid>opacity</parameterid><name>Opacity</name>
+ <keyframe><when>0</when><value>0</value></keyframe>
+ <keyframe><when>25</when><value>100</value></keyframe>
+ </parameter>
+ </effect>
+ </filter>
+ </clipitem>
+ </track>
+ </video>
+ </media>
+ </sequence>
+ </children>
+ </project>
+</xmeml>
+"#;
+
+#[test]
+fn premiere_xml_bins_motion_and_opacity() {
+ let mut paths = vec![];
+ let (p, r) = import_doc(PREMIERE_XML.as_bytes(), "Promo.xml", &mut |path| {
+ paths.push(path.to_string());
+ probe(path)
+ });
+ assert_eq!(paths, vec!["/media/wide shot.mov".to_string()]);
+ let shots = p.items.values().find(|i| i.name == "Shots").unwrap();
+ assert_eq!(shots.parent, Some(r.folder));
+ let day = p.items.values().find(|i| i.name == "Day 1").unwrap();
+ assert_eq!(day.parent, Some(shots.id));
+ assert!(p.items.values().any(|i| i.name == "wide.mov" && i.parent == Some(day.id)));
+ let c = p.comp(r.comps[0]).unwrap();
+ assert_eq!(p.item(r.comps[0]).unwrap().name, "Promo Cut");
+ assert!(near(c.duration, t(2.0)));
+ let l = &c.layers[0];
+ assert!(near(l.layer_time(Tick::ZERO), t(1.0)), "source in 1 s");
+ let tr = l.transform().unwrap();
+ assert_eq!(tr.get("scale").unwrap().value.as_vec3()[..2], [150.0, 150.0]);
+ // Center 0.25 of the width right of the frame centre.
+ assert_eq!(tr.get("position").unwrap().value.as_vec3()[..2], [320.0 + 160.0, 180.0]);
+ let op = tr.get("opacity").unwrap();
+ assert_eq!(op.keys.len(), 2);
+ assert!(near(op.keys[1].time, l.layer_time(t(1.0))));
+ assert!((op.value_at(l.layer_time(t(0.5))).as_f64() - 50.0).abs() < 1e-6);
+}
+
+#[test]
+fn imports_fcp7_xml_fcpxml_and_otio() {
+ let (doc, main) = edit();
+ for (fmt, motion) in [(fc::Format::Fcp7Xml, true), (fc::Format::Fcpxml, false), (fc::Format::Otio, false)] {
+ let (bytes, _) = fc::export(&doc, main, fmt, &Default::default()).unwrap();
+ let name = format!("Main.{}", fmt.extension());
+ assert_eq!(TimelineFormat::detect(&bytes, Some(&name)).map(|f| f.fc()), Some(fmt));
+ let (p, r) = import_doc(&bytes, &name, &mut probe);
+ assert!(r.missing.is_empty(), "{fmt:?}: {:?}", r.missing);
+ check_structure(&p, &r, motion);
+ }
+}
+
++#[test]
++fn imports_aaf_and_omf() {
++ let (doc, main) = edit();
++ for fmt in [fc::Format::Aaf, fc::Format::Omf] {
++ let (bytes, _) = fc::export(&doc, main, fmt, &Default::default()).unwrap();
++ let name = format!("Main.{}", fmt.extension());
++ assert_eq!(TimelineFormat::detect(&bytes, Some(&name)).map(|f| f.fc()), Some(fmt));
++ let (p, r) = import_doc(&bytes, &name, &mut probe);
++ let c = p.comp(r.comps[0]).unwrap();
++ if fmt == fc::Format::Aaf {
++ assert_eq!((c.width, c.height), (W, H));
++ }
++ // Audio: an audio-only layer for the A1 clip (OMF carries the audio tracks only).
++ let au = c.layers.iter().find(|l| !l.switches.video && l.switches.audio).expect("audio layer");
++ assert!(near(au.in_point, Tick::ZERO) && near(au.out_point, t(3.0)));
++ if fmt == fc::Format::Aaf {
++ // The dissolve's clips overlap over the transition, the incoming one on top.
++ let a = layer(c, "a.png");
++ assert!(near(a.out_point, t(2.4)), "{}", a.out_point.seconds());
++ let b = c.layers.iter().find(|l| near(l.in_point, t(1.6))).expect("incoming clip");
++ assert!(c.index_of(b.id) < c.index_of(a.id));
++ assert_eq!(b.transform().unwrap().get("opacity").unwrap().keys.len(), 2);
++ }
++ }
++}
++
+#[test]
+fn missing_media_become_placeholders() {
+ let (doc, main) = edit();
+ let (bytes, _) = fc::export(&doc, main, fc::Format::Fcp7Xml, &Default::default()).unwrap();
+ let (p, r) = import_doc(&bytes, "Main.xml", &mut |_| None);
+ assert_eq!(r.missing.len(), 3, "{:?}", r.missing);
+ let a = p.items.values().find(|i| i.name == "a.png").unwrap();
+ match &a.kind {
+ ItemKind::Footage(f) => assert!(f.missing && f.width == W && f.height == H && f.has_video),
+ _ => panic!(),
+ }
+ check_structure(&p, &r, true);
+}
+
+#[test]
+fn edl_imports_one_track() {
+ let (doc, main) = edit();
+ let (bytes, _) = fc::export(&doc, main, fc::Format::Edl, &Default::default()).unwrap();
+ let mut p = Project::default();
+ let r = import(&mut p, &bytes, None, &ImportOptions { name: "Main.edl".into(), edl_frame_rate: Some(25.0), ..Default::default() }, &mut probe).unwrap();
+ assert_eq!(r.format, Some(TimelineFormat::Edl));
+ let c = p.comp(r.comps[0]).unwrap();
+ assert!(c.layers.len() >= 2);
+}
+
+#[test]
+fn rejects_unknown_documents() {
+ let mut p = Project::default();
+ assert!(matches!(import(&mut p, b"hello", None, &ImportOptions::default(), &mut probe), Err(Error::UnknownFormat)));
+}
+
+// ---------------------------------------------------------------- export
+
+fn footage_item(p: &mut Project, path: &str) -> ItemId {
+ let f = probe(path).unwrap();
+ p.add_item(path.rsplit('/').next().unwrap(), effectcraft_color::Label::Aqua, None, ItemKind::Footage(f))
+}
+
+fn comp_item(p: &mut Project, name: &str, c: Comp) -> ItemId {
+ p.add_item(name, effectcraft_color::Label::Sandstone, None, ItemKind::Comp(Arc::new(c)))
+}
+
+/// A comp with a stretched, keyframed footage layer, a text layer, a precomp and an audio layer.
+fn ae_project() -> (Project, ItemId) {
+ let mut p = Project::default();
+ let a = footage_item(&mut p, "/media/a.mov");
+ let s = footage_item(&mut p, "/media/tone.wav");
+ let mut inner = Comp::new(W, H, FrameRate::new(25, 1), t(4.0));
+ let li = effectcraft_project::build::layer(&mut p, &inner, "inner a", LayerSource::Footage { item: a }, (W, H), None);
+ inner.layers.push(li);
+ let inner_id = comp_item(&mut p, "Inner", inner);
+ let mut c = Comp::new(W, H, FrameRate::new(25, 1), t(5.0));
+ let mut la = effectcraft_project::build::layer(&mut p, &c, "clip a", LayerSource::Footage { item: a }, (W, H), None);
+ la.stretch = 200.0; // half speed
+ la.start_time = t(-1.0); // layer time 1 s at comp 3 s… source 1 s at comp 1 s
+ la.in_point = t(1.0);
+ la.out_point = t(4.0);
+ {
+ let tr = la.transform_mut().unwrap();
+ let pos = tr.get_mut("position").unwrap();
+ pos.keys = vec![Keyframe::new(t(1.0), Value::Vec3([100.0, 120.0, 0.0])), Keyframe::new(t(2.0), Value::Vec3([500.0, 240.0, 0.0])).hold()];
+ tr.get_mut("scale").unwrap().value = Value::Vec3([80.0, 80.0, 100.0]);
+ tr.get_mut("rotation").unwrap().value = Value::Scalar(-15.0);
+ tr.get_mut("opacity").unwrap().value = Value::Scalar(75.0);
+ }
+ let mut lt = effectcraft_project::build::layer(&mut p, &c, "Title", LayerSource::Text, (W, H), None);
+ lt.in_point = t(0.6);
+ lt.out_point = t(2.6);
+ let mut lp = effectcraft_project::build::layer(&mut p, &c, "Inner", LayerSource::Comp { item: inner_id }, (W, H), None);
+ lp.start_time = t(2.0);
+ lp.in_point = t(2.0);
+ lp.out_point = t(5.0);
+ let mut ls = effectcraft_project::build::layer(&mut p, &c, "tone", LayerSource::Footage { item: s }, (0, 0), None);
+ ls.out_point = t(3.0);
+ ls.props.prop_mut("audio/levels").unwrap().value = Value::Vec2([-3.0, -3.0]);
+ c.layers = vec![lt, lp, la, ls];
+ let cid = comp_item(&mut p, "Main", c);
+ (p, cid)
+}
+
+#[test]
+fn plan_prerenders_rendered_only_layers() {
+ let (p, cid) = ae_project();
+ let opts = ExportOptions::default();
+ let plan = plan_prerender(&p, cid, &opts);
+ let c = p.comp(cid).unwrap();
+ assert_eq!(plan, vec![(cid, layer(c, "Title").id)]);
+ assert_eq!(prerender_reason(&p, cid, layer(c, "Title").id, &opts).as_deref(), Some("text layer"));
+ let all = plan_prerender(&p, cid, &ExportOptions { prerender: PrerenderMode::All, ..Default::default() });
+ assert_eq!(all.len(), 3, "audio-only layers are never rendered");
+ assert!(plan_prerender(&p, cid, &ExportOptions { prerender: PrerenderMode::None, ..Default::default() }).is_empty());
+}
+
+#[test]
+fn export_then_reimport_keeps_the_timeline() {
+ let (p, cid) = ae_project();
+ let c = p.comp(cid).unwrap();
+ let title = layer(c, "Title").id;
+ let mut pre = HashMap::new();
+ pre.insert((cid, title), Prerendered { path: "/render/Title.mov".into(), width: W, height: H, frame_rate: FrameRate::new(25, 1), duration: t(2.0) });
+ for format in [TimelineFormat::Fcp7Xml, TimelineFormat::Fcpxml, TimelineFormat::Otio] {
+ let out = export(&p, cid, &ExportOptions { format, ..Default::default() }, &pre).unwrap();
+ assert_eq!(out.prerendered, 1);
+ assert_eq!(out.sequences, 2);
+ assert_eq!(out.video_tracks, 4, "3 in Main + 1 in Inner");
+ assert_eq!(out.audio_tracks, 1);
+ let text = String::from_utf8(out.bytes.clone()).unwrap();
+ assert!(text.contains("Title.mov"), "{format:?}");
+ let (q, r) = import_doc(&out.bytes, &format!("Main.{}", format.extension()), &mut probe);
+ let main = r.comps.iter().copied().find(|c| q.item(*c).unwrap().name == "Main").expect("Main");
+ let m = q.comp(main).unwrap();
+ assert_eq!(m.layers.len(), 4, "{format:?}: {:?}", m.layers.iter().map(|l| &l.name).collect::<Vec<_>>());
+ // Stacking order kept: Title (pre-rendered) on top, then the precomp, then clip a.
+ assert_eq!(m.layers[0].name, "Title");
+ assert!(near(m.layers[0].in_point, t(0.6)) && near(m.layers[0].out_point, t(2.6)));
+ assert!(matches!(m.layers[1].source, LayerSource::Comp { .. }), "{format:?}");
+ assert!(near(m.layers[1].in_point, t(2.0)) && near(m.layers[1].layer_time(t(2.0)), Tick::ZERO));
+ let la = &m.layers[2];
+ assert!((la.stretch - 200.0).abs() < 1e-6, "{format:?} stretch {}", la.stretch);
+ assert!(near(la.in_point, t(1.0)) && near(la.out_point, t(4.0)));
+ let orig = layer(c, "clip a");
+ assert!(near(la.layer_time(t(1.0)), orig.layer_time(t(1.0))), "{format:?} {}", la.layer_time(t(1.0)).seconds());
+ assert!(!m.layers[3].switches.video && m.layers[3].switches.audio);
+ if format == TimelineFormat::Fcp7Xml {
+ let tr = la.transform().unwrap();
+ assert_eq!(tr.get("scale").unwrap().value.as_vec3()[..2], [80.0, 80.0]);
+ assert!((tr.get("rotation").unwrap().value.as_f64() + 15.0).abs() < 1e-6);
+ assert!((tr.get("opacity").unwrap().value.as_f64() - 75.0).abs() < 1e-6);
+ let pk = &tr.get("position").unwrap().keys;
+ assert_eq!(pk.len(), 2);
+ for (k, o) in pk.iter().zip(&tr_orig(orig).keys) {
+ assert!(near(la.comp_time(k.time), orig.comp_time(o.time)), "{} vs {}", k.time.seconds(), o.time.seconds());
+ assert_eq!(k.value.as_vec3()[..2], o.value.as_vec3()[..2]);
+ }
+ let lv = m.layers[3].props.prop("audio/levels").unwrap().value.as_vec2();
+ assert!((lv[0] + 3.0).abs() < 0.01, "{lv:?}");
+ }
+ }
+}
+
+fn tr_orig(l: &Layer) -> &effectcraft_project::Property {
+ l.transform().unwrap().get("position").unwrap()
+}
+
+#[test]
+fn export_without_prerender_leaves_text_out() {
+ let (p, cid) = ae_project();
+ let out = export(&p, cid, &ExportOptions { prerender: PrerenderMode::None, ..Default::default() }, &HashMap::new()).unwrap();
+ assert!(out.warnings.iter().any(|w| w.contains("Title")), "{:?}", out.warnings);
+ assert_eq!(out.prerendered, 0);
+ assert_eq!(out.video_tracks, 3);
+}
+
+#[test]
+fn formats_parse() {
+ assert_eq!(TimelineFormat::parse("premiere"), Some(TimelineFormat::Fcp7Xml));
+ assert_eq!(TimelineFormat::parse(".fcpxml"), Some(TimelineFormat::Fcpxml));
+ assert_eq!(TimelineFormat::from_path("/a/b.otio"), Some(TimelineFormat::Otio));
+ assert_eq!(TimelineFormat::Fcp7Xml.extension(), "xml");
+ assert_eq!(par_fraction(0.9), (9, 10));
+ assert_eq!(par_fraction(1.0), (1, 1));
+}
diff --cc crates/ui-egui/src/menus.rs
index ba5afb8c0,15b05401e..1dfb54d35
--- a/crates/ui-egui/src/menus.rs
+++ b/crates/ui-egui/src/menus.rs
@@@ -929,7 -929,6 +929,7 @@@ fn file_dialog(app: &mut EffectcraftApp
"view.importGuides" => ("path", Ask::Open(&["json"])),
"file.exportLottie" => ("path", Ask::Save("Animation.json")),
"file.importLottie" => ("path", Ask::Open(&["json", "lottie"])),
- "file.importTimeline" => ("path", Ask::Open(&["xml", "fcpxml", "otio", "edl"])),
++ "file.importTimeline" => ("path", Ask::Open(&["xml", "fcpxml", "otio", "edl", "aaf", "omf"])),
"render.saveCurrentPreview" => ("path", Ask::Save("Preview.mp4")),
"file.runScript" if params.get("name").is_none() => ("path", Ask::Open(&["jsx", "js", "jsonl", "json", "txt"])),
"file.installScript" | "file.installScriptUIPanel" => ("path", Ask::Open(&["jsx", "js"])),
diff --cc crates/ui-egui/src/panels/forms.rs
index 0b2e3993d,896e6613f..6eaf10818
--- a/crates/ui-egui/src/panels/forms.rs
+++ b/crates/ui-egui/src/panels/forms.rs
@@@ -510,41 -499,6 +510,43 @@@ pub fn open_form(app: &mut EffectcraftA
],
)
}
+ // File ▸ Export ▸ Adobe Premiere Pro Project…: Final Cut Pro XML (or FCPXML / OTIO / EDL).
+ "file.exportTimeline" if !has(p, &["path"]) => {
+ let name = s.active_comp_id().and_then(|c| s.project.item(c)).map(|i| i.name.clone()).unwrap_or_else(|| "Composition".into());
+ let dir = s.path.as_deref().and_then(|p| std::path::Path::new(p).parent()).map(|d| d.to_path_buf()).unwrap_or_default();
+ let path = dir.join(format!("{name}.xml")).to_string_lossy().to_string();
+ (
+ "Export Adobe Premiere Pro Project".into(),
+ vec![
+ Field::note("note", "Writes Final Cut Pro XML (.xml), which Premiere Pro opens with File ▸ Import. Native .prproj files are not written."),
+ Field::save_path("path", "File", &path),
+ Field::choice(
+ "format",
+ "Format",
+ &[
+ ("Final Cut Pro XML (.xml) – Premiere Pro", json!("xml")),
+ ("FCPXML (.fcpxml)", json!("fcpxml")),
+ ("OpenTimelineIO (.otio)", json!("otio")),
+ ("CMX 3600 EDL (.edl, V1 only)", json!("edl")),
++ ("AAF (.aaf)", json!("aaf")),
++ ("OMF (.omf, audio)", json!("omf")),
+ ],
+ 0,
+ ),
+ Field::choice(
+ "prerender",
+ "Pre-render (ProRes 4444)",
+ &[
+ ("Layers Premiere can't show (text, shapes, effects…)", json!("unsupported")),
+ ("All layers", json!("all")),
+ ("None (leave them out)", json!("none")),
+ ],
+ 0,
+ ),
+ Field::choice("precomps", "Precomps", &[("Nested sequences", json!("nest")), ("Pre-render", json!("prerender"))], 0),
+ ],
+ )
+ }
"file.importPlaceholder" | "file.replaceWithPlaceholder" if p.as_object().is_none_or(|m| m.is_empty()) => (
"New Placeholder".into(),
vec![
diff --cc docs/agents.md
index c57d124bd,914135f8e..7c293385e
--- a/docs/agents.md
+++ b/docs/agents.md
@@@ -397,23 -397,6 +397,23 @@@ cannot express (most effects, cameras a
agent can check what a player will not show. A `.lottie` path writes a dotLottie archive.
`file.importLottie` returns `{comp, items, warnings}` and opens the new composition.
+Premiere Pro interop goes through timeline interchange (MCP: the `execute_command` tool; control channel: `engine.execute`
+with the same ids):
+
+```sh
- effectcraft-cli exec file.importTimeline '{"path":"edit.xml"}' main.ecproj --save # FCP7 XML / .fcpxml / .otio / .edl
++effectcraft-cli exec file.importTimeline '{"path":"edit.xml"}' main.ecproj --save # FCP7 XML / .fcpxml / .otio / .edl / .aaf / .omf
+effectcraft-cli exec file.exportTimeline '{"comp":"Main","path":"Main.xml"}' main.ecproj --json
+effectcraft-cli exec file.exportTimeline '{"comp":"Main","path":"Main.otio","prerender":"none"}' main.ecproj
+```
+
+`file.importTimeline` returns `{format, folder, comps, allComps, items, missing, warnings}`
+(`missing` lists media imported as placeholders). `file.exportTimeline` writes Final Cut Pro XML
+(`.xml`, which Premiere Pro opens with File ▸ Import) unless `format` or the extension says
- `fcpxml`, `otio` or `edl`; `prerender` (`unsupported` by default, `all`, `none`) controls which
++`fcpxml`, `otio`, `edl`, `aaf` or `omf`; `prerender` (`unsupported` by default, `all`, `none`) controls which
+layers are rendered to ProRes 4444 movies next to the document. It returns `{path, format,
+sequences, videoTracks, audioTracks, clips, prerendered, warnings}`. Native `.prproj` files are
+not read or written.
+
`<comp>` is an id or name, or `-` for the active comp. `<value>` is JSON (`50`, `[960,540]`,
`"#ff0000"`) or a bare string.
diff --cc docs/architecture.md
index 04bea07c3,6b2a2721c..f9906009f
--- a/docs/architecture.md
+++ b/docs/architecture.md
@@@ -36,7 -36,6 +36,7 @@@ cpal or muda. Everything in L0 to L4, t
| L3 | `expr` | The expression engine (JavaScript via boa) with the After Effects object model |
| L3 | `export` | Render queue encoding: H.264, HEVC and AV1 MP4, ProRes, WebM (VP9 + alpha or AV1, Opus), PNG/JPEG/TIFF/EXR sequences, GIF, WAV/AIFF |
| L3 | `gpu` | The GPU compositor and GPU effects on wgpu compute shaders (Metal, Vulkan, Direct3D 12, WebGPU), checked against the CPU renderer |
- | L3 | `interchange` | Premiere Pro interop through timeline interchange (FCP7 XML, FCPXML, OTIO, EDL via FilmCraft's `filmcraft-interchange`): sequences ↔ compositions (§6a) |
++| L3 | `interchange` | Premiere Pro interop through timeline interchange (FCP7 XML, FCPXML, OTIO, EDL, AAF, OMF via FilmCraft's `filmcraft-interchange`): sequences ↔ compositions (§6a) |
| L3 | `lottie` | Lottie JSON / dotLottie import and export (layers, precomps, eased and spatial keyframes, shapes, masks, mattes) with a warnings list for what Lottie cannot express |
| L3 | `plugin` | Effect plug-ins: loads sandboxed WebAssembly effect modules (plug-in API v1; the wasmi interpreter behind the `wasm` feature, on for native hosts) into the effect registry ([plugins.md](plugins.md)) |
| L4 | `engine` | `Session`: project, branching undo history, editor state, the command registry and menus, the ScriptUI window model (`scriptui`) |
@@@ -452,43 -455,6 +456,43 @@@ applied on the UI thread
The shortcut dispatcher and the menus read the active preset. See
[preferences.md](preferences.md).
+## 6a. Premiere Pro interop (timeline interchange)
+
+After Effects' File ▸ Import / Export ▸ Adobe Premiere Pro Project… go through the public
+interchange formats Premiere Pro itself reads and writes, not the native `.prproj` file (it has no
+public specification; supporting it awaits a decision). `crates/interchange` (L3, no file I/O)
+maps FilmCraft's timeline model (`filmcraft-project`, parsed and written by `filmcraft-interchange`,
+pinned at the same git revision as the other `filmcraft-*` crates; pure Rust, builds for wasm32)
+to compositions and back:
+
+- **Import** (`file.importTimeline {path, format?, edlFrameRate?}`): Final Cut Pro 7 XML (`xmeml`,
- Premiere's File ▸ Export ▸ Final Cut Pro XML), FCPXML 1.9–1.11, OpenTimelineIO and CMX 3600 EDL.
++ Premiere's File ▸ Export ▸ Final Cut Pro XML), FCPXML 1.9–1.11, OpenTimelineIO, CMX 3600 EDL, AAF and OMF.
+ Sequences become comps (size, rate, duration, pixel aspect, start timecode, markers); video
+ tracks become layers stacked by track (top track = top layer, later clips of a track above
+ earlier ones); clips become footage layers with their in/out/start, speed and reverse (time
+ stretch) and frame holds (Time Remap); Motion (position, scale / scale width, rotation, anchor
+ point, Scale to Frame Size) and Opacity (blend mode) with keyframes, keyframe times converted
+ from clip time to layer time; cross dissolves and dips become overlapping layers with opacity
+ keyframes; nested sequences become precomps; audio tracks become audio-only layers with Audio
+ Levels (clip volume + gain + track volume, crossfades as level keyframes); colour mattes and
+ adjustment layers become solids; bins become Project panel folders under a folder named after
+ the document; media that cannot be found become placeholders with the document's metadata
+ (`missing` in the result). Effects, effect masks, titles/graphics and speed ramps are reported
+ in `warnings`.
+- **Export** (`file.exportTimeline {comp?, path, format?, prerender?, precomps?}`): one sequence
+ per comp, one track per layer (bottom layer = V1), footage clips with their timing, Motion,
+ Opacity and audio levels (linked audio clips for layers with sound), precomps as nested
+ sequences, full-frame solids as colour mattes. Layers a timeline cannot represent (text, shapes,
+ 3D, effects, masks, track mattes, parenting, expressions, animated time remapping, non-uniform
+ scale, blend modes Premiere lacks) are pre-rendered to ProRes 4444 with alpha next to the
+ document (`prerender: unsupported`, the default; `all` renders every visual layer; `none` leaves
+ them out with a warning) and referenced as media. The menu keeps After Effects' label "Adobe
+ Premiere Pro Project…", but the file written is Final Cut Pro XML (`.xml`), which Premiere Pro
- imports with File ▸ Import; the dialog says so. FCPXML, OTIO and EDL are the other formats.
++ imports with File ▸ Import; the dialog says so. FCPXML, OTIO, EDL, AAF and OMF are the other formats.
+
- AAF and OMF import arrive with the FilmCraft revision that adds them to `filmcraft-interchange`
- (the pinned revision predates them).
++AAF and OMF (FilmCraft's structured-storage and Bento readers/writers) import and export too;
++media embedded in them is not extracted, and the AAF writer keeps neither speed nor nesting.
+
## 7. Performance of everyday operations
`effectcraft-cli bench --ops [--small] [--layers N] [--comps N] [--footage N]` measures the
diff --cc docs/parity.md
index 6af437be5,92c8e0aa0..b88dafda1
--- a/docs/parity.md
+++ b/docs/parity.md
@@@ -411,17 -411,44 +411,55 @@@ in Settings (`customRgb`) and simulate
`form.field.<key>`, `form.ok` and `form.cancel` automation ids. Not yet: LUT-based (`A2B0`)
ICC profiles.
+### M13.26: Premiere Pro interop via timeline interchange
+
+| Feature | After Effects | EffectCraft | Status |
+|---|---|---|---|
- | File ▸ Import ▸ Adobe Premiere Pro Project… | reads `.prproj` | reads Final Cut Pro XML (Premiere's File ▸ Export ▸ Final Cut Pro XML), FCPXML, OTIO and EDL (`file.importTimeline`): comps, layers by track, timing/speed/reverse/holds, Motion and Opacity keyframes, dissolves as opacity keys, nested sequences as precomps, audio layers with levels, bins as folders, missing media as placeholders | ≈ 85% |
- | File ▸ Export ▸ Adobe Premiere Pro Project… | writes `.prproj` | writes Final Cut Pro XML `.xml` (also FCPXML, OTIO, EDL; `file.exportTimeline`): clips per layer with timing, Motion, Opacity and levels; precomps nested; rendered-only layers pre-rendered to ProRes 4444 with alpha | ≈ 85% |
++| File ▸ Import ▸ Adobe Premiere Pro Project… | reads `.prproj` | reads Final Cut Pro XML (Premiere's File ▸ Export ▸ Final Cut Pro XML), FCPXML, OTIO, EDL, AAF and OMF (`file.importTimeline`): comps, layers by track, timing/speed/reverse/holds, Motion and Opacity keyframes, dissolves as opacity keys, nested sequences as precomps, audio layers with levels, bins as folders, missing media as placeholders | ≈ 85% |
++| File ▸ Export ▸ Adobe Premiere Pro Project… | writes `.prproj` | writes Final Cut Pro XML `.xml` (also FCPXML, OTIO, EDL, AAF, OMF; `file.exportTimeline`): clips per layer with timing, Motion, Opacity and levels; precomps nested; rendered-only layers pre-rendered to ProRes 4444 with alpha | ≈ 85% |
+
- Not yet: native `.prproj` (no public specification; awaits a decision), AAF/OMF import (needs the
- FilmCraft revision that adds them), Premiere effects other than Motion/Opacity/Volume, speed
++Not yet: native `.prproj` (no public specification; awaits a decision), media embedded in AAF/OMF
++(not extracted), Premiere effects other than Motion/Opacity/Volume, speed
+ramps, titles/graphics, and Dynamic Link.
+
+ ## Update: M13.23 GPU effects, part B (EFF-5)
+
+ 40 more effects run on the GPU (236 in all, with M13.22's 30), each checked against the CPU oracle (≤ 1/255 at
+ 8 bpc, ≤ 1e-3 at 32 bpc) directly on a buffer (full and half resolution, adjustment) and
+ composited at 8 and 32 bpc:
+
+ - **3D Channel** (`gpu::fx_depth`): 3D Channel Extract (every channel, Anti-alias), Cryptomatte,
+ Depth Matte, Depth of Field, EXtractoR, Fog 3D (with a Gradient Layer), ID Matte and
+ IDentifier. The layer's auxiliary channels upload as an extra texture at the aux resolution and
+ are resampled onto the buffer with the CPU's index arithmetic (tested at 1× and 2× aux
+ resolution and on padded buffers). Cryptomatte's ranks are reduced per aux pixel on the CPU
+ (selection coverage and ID colours), then looked up on the GPU.
+ - **Immersive Video** (`gpu::fx_vr`): VR Blur, Chromatic Aberrations, Color Gradients, Converter
+ (all nine projections and cube layouts), De-Noise (guided filter and median), Digital Glitch,
+ Fractal Noise, Glow, Plane to Sphere, Rotate Sphere, Sharpen and Sphere to Plane, in mono and
+ both stereo layouts: the equirectangular maths (seam wrap, pole continuation, latitude-widened
+ box blurs) ported operation for operation. Exception: VR Converter re-projections that cross a
+ cube-face edge or a fisheye rim may pick the neighbouring face for directions within f32
+ rounding of the edge (the CPU decides in f64): up to 0.5 % of pixels allowed (measured 0).
+ - **Colour management** (`gpu::fx_lut`): Apply Color LUT, OCIO CDL / Color Space / Display /
+ File / Look Transform and Color Profile Converter compile to colour programs
+ (`effects::color_program`, next to the CPU effects) interpreted per pixel; 1D / 3D LUTs and
+ cineSpace shapers are read from a storage buffer with the CPU's nearest / trilinear /
+ tetrahedral interpolation and inverses (not a hardware 3D texture: its filtering rounds the
+ weights and cannot do tetrahedral). Lumetri's Input LUT and Look no longer force the CPU.
+ Custom `.ocio` configurations render on the CPU. Exception: nearest-neighbour lattice lookups
+ may pick the other lattice point for 8 bpc inputs exactly on a rounding boundary (up to 1 %
+ of pixels allowed).
+ - **Simulation render passes** (`gpu::fx_sim`): CC Rainfall, CC Snowfall, CC Star Burst, CC
+ Bubbles, CC Drizzle, CC Hair, CC Mr. Mercury, Caustics, Wave World, Foam, Shatter, Card Dance
+ and Card Wipe. The per-frame simulation / layout stays on the CPU and is shared with the CPU
+ effect as a plan (sprites, textured pieces, blobs, drops, the wave grid, Caustics' prepared
+ layers); a tiled rasteriser composites each pixel's items in the CPU's order and shading, with
+ layer-dependent colours (refracting rain, star-burst and hair roots, bubble refraction)
+ sampled per pixel. Piece plans read the frame back once (their gradient maps and textures
+ default to the layer). Shatter's wireframe views and Foam's User Defined texture,
+ Environment Map and flow-map preview render on the CPU.
+
## Highest-value gaps, in order
1. ~~On-canvas text editing and per-character styles~~ (landed: M9.9–M9.10).