@lalalic/markcut 3.2.52 → 3.2.54

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,73 @@
1
+ # Shotcraft recipe experiments in Markcut
2
+
3
+ A **12.65-second, 720 × 1280, 30-fps vertical demo** that tests three
4
+ video-shotcraft animation recipes as **native Markcut component scenes**.
5
+ It does not splice pre-rendered Shotcraft gallery movies.
6
+
7
+ ## Examples
8
+
9
+ | Scene | Frames | Shotcraft card + implementation | What to look for |
10
+ | --- | ---: | --- | --- |
11
+ | PaperTitle | 55 | typography/paper-title-card → demos/typography/paper-title-card/PaperTitleCard.tsx | Staggered word-by-word letterpress (4f offset, 9f per word, 1.28× scale and 7px blur), 18f underline, end fade |
12
+ | Multiplane | 165 | camera/depth-layer-moves → demos/camera/depth-layer-moves/MultiplaneReal.tsx | Three layers at 0.35×, 0.7× and 1.4× travel speed, fixed heading, 22f final-card lift |
13
+ | FreezeAnnotate | 158 | rhythm/speed-ramp-freeze → demos/rhythm/speed-ramp-freeze/FreezeAnnotateReal.tsx | Moving shot strip; abrupt 70f freeze; 3f shutter flash, 10f hand-drawn circle, then eased resume |
14
+
15
+ Recipe files live at:
16
+ ~/.agents/skills/video-shotcraft/references/shots/{typography,camera,rhythm}/.
17
+ Exact gallery keys (from gallery/api/library.json) are
18
+ paper-title-card, multiplane, and freeze-annotate.
19
+
20
+ These are **adaptations** of the recipe motion principles for a 9:16 Vlog;
21
+ they are *not* pixel-identical reproductions. Source scenes use built-in
22
+ drawn scenery, not imported footage or the private owner's media. The demo
23
+ has no narration/BGM/SFX so the movement is easier to isolate. A real Vlog
24
+ would substitute Visioner-selected stills/clips and synchronize SFX to
25
+ the rendered frames.
26
+
27
+ ## Run
28
+
29
+ From Markcut's repository root:
30
+
31
+ ~~~sh
32
+ node bin/markcut verify examples/shotcraft-recipes/video.md
33
+ node bin/markcut preview examples/shotcraft-recipes/video.md
34
+ node bin/markcut render examples/shotcraft-recipes/video.md \
35
+ --output out/shotcraft-recipe-demo.mp4
36
+ ffprobe -v error -show_entries stream=width,height,nb_frames \
37
+ -show_entries format=duration -of default=noprint_wrappers=1 \
38
+ out/shotcraft-recipe-demo.mp4
39
+ ~~~
40
+
41
+ The Markdown's JS imports block contains all three React/Remotion
42
+ components; Markcut resolves their imports and exposes them as JSX scene
43
+ nodes. Each scene can be used independently by deleting the other scenes
44
+ while keeping the imports block.
45
+
46
+ ## Preview in ChatGPT / Neo Mobile
47
+
48
+ Preview showcases the already-rendered MP4 using a separate Markcut
49
+ source, **showcase.md**, so the same clip plays on mobile without rebuilding
50
+ React components in the hosted player.
51
+
52
+ The regular desktop CLI renderer supports the custom JS imports used in
53
+ video.md. The current standalone Neo-hosted preview compiler does **not**
54
+ publish its JS imports registry; previewing video.md directly there can
55
+ produce missing JSX. Until that separate hosted capability is implemented,
56
+ use showcase.md for owner-facing playback, and use video.md to edit/re-render
57
+ the original animation.
58
+
59
+ ## What this experiment establishes
60
+
61
+ 1. A Vlog Editor can choose a Shotcraft **shot recipe** and express it
62
+ as an ordinary Markcut component within video.md.
63
+ 2. Effects driven by useCurrentFrame render deterministically in
64
+ Markcut via its shared Remotion runtime; not every Shotcraft recipe
65
+ needs a new Markcut engine primitive.
66
+ 3. Shotcraft is a *motion vocabulary*. The Director should decide
67
+ **why** to use it; the Editor should select and adapt the recipe to
68
+ footage/story and verify playback. Not every shot should be animated.
69
+
70
+ This example also exercises a Markcut CLI correction: custom component
71
+ bundles must be copied into the actual Remotion publicDir and referenced
72
+ by a *relative* import path. A previously absolute-path import produced
73
+ a nominally successful MP4 with 404 component-load errors.
@@ -0,0 +1,5 @@
1
+ # video
2
+ width:720 height:1280 fps:30 layout:series
3
+
4
+ ## ShotcraftRecipeShowcase
5
+ - video src:assets/shotcraft-recipe-demo.mp4 duration:12.650667
@@ -0,0 +1,195 @@
1
+ # video
2
+ seed:2210396671
3
+ width:720 height:1280 fps:30 layout:series
4
+
5
+ ## PaperTitle
6
+ - component duration:1.833333 jsx:"<PaperTitleCardDemo />"
7
+
8
+ ## Multiplane
9
+ - component duration:5.5 jsx:"<MultiplaneDemo />"
10
+
11
+ ## FreezeAnnotate
12
+ - component duration:5.266667 jsx:"<FreezeAnnotateDemo />"
13
+
14
+ ~~~js imports
15
+ import React from 'react';
16
+ import {AbsoluteFill, useCurrentFrame, interpolate, Easing} from 'remotion';
17
+
18
+ // Adapted from video-shotcraft recipe paper-title-card, 55 frames.
19
+ const FONT = "'PingFang SC', 'Noto Sans CJK SC', 'Microsoft YaHei', sans-serif";
20
+ const SERIF = "'Songti SC', 'Noto Serif CJK SC', Georgia, serif";
21
+ const ease = Easing.bezier(0.2, 0.75, 0.3, 1);
22
+ const out = Easing.bezier(0.45, 0, 0.18, 1);
23
+ const bounded = (f, a, b, ev = Easing.linear) => interpolate(f, [a, b], [0, 1], {
24
+ extrapolateLeft: 'clamp', extrapolateRight: 'clamp', easing: ev
25
+ });
26
+ const SWATCH = {paper:'#f4efe5', ink:'#20292a', muted:'#697579', accent:'#b96a49', blue:'#2c637e'};
27
+ const badge = (num, name, light=false) => (
28
+ <div style={{position:'absolute',left:42,top:56,display:'flex',gap:14,alignItems:'center',zIndex:12}}>
29
+ <span style={{width:38,height:38,border:'1px solid '+(light?'#d6dedf':'#879395'),borderRadius:19,
30
+ display:'flex',alignItems:'center',justifyContent:'center',
31
+ fontFamily:FONT,fontSize:16,color:light?'#fff':SWATCH.muted}}>{num}</span>
32
+ <span style={{fontSize:20,fontWeight:600,letterSpacing:2,color:light?'#fff':SWATCH.muted,fontFamily:FONT}}>{name}</span>
33
+ </div>
34
+ );
35
+ const ScenicCard = ({name,kind=0,large=false}) => {
36
+ const palettes=[
37
+ ['#83b0bc','#ddd3bc','#3a5964'],
38
+ ['#a4b4c7','#dbdfd5','#667d7c'],
39
+ ['#bbad92','#e4cba7','#876d60'],
40
+ ['#96b3b1','#dce2d9','#3e6b65']
41
+ ];
42
+ const p=palettes[kind%palettes.length];
43
+ return <div style={{width:'100%',height:'100%',position:'relative',overflow:'hidden',
44
+ background:'linear-gradient(180deg,'+p[0]+' 0%,'+p[1]+' 70%)'}}>
45
+ <svg viewBox="0 0 420 450" preserveAspectRatio="xMidYMid slice" style={{height:'100%',width:'100%',position:'absolute'}}>
46
+ <circle cx={300-kind*35} cy={90+kind*12} r="46" fill="#fff8dc" opacity=".62"/>
47
+ <path d="M0 290 Q90 205 185 265 T420 230 L420 450 L0 450Z" fill={p[2]} opacity=".5"/>
48
+ <path d="M0 345 Q135 270 240 340 T420 315 L420 450 L0 450Z" fill={p[2]} opacity=".75"/>
49
+ <path d="M0 395 Q180 360 420 390 L420 450 L0 450Z" fill="#1f4049" opacity=".8"/>
50
+ {kind%2===0 ? <>
51
+ <path d="M100 375 L115 205 M98 258 L66 235 M112 255 L150 220 M114 300 L170 265" fill="none" stroke="#384d4e" strokeWidth="8" strokeLinecap="round"/>
52
+ <path d="M310 395 L323 150 M321 220 L285 192 M322 260 L360 230" fill="none" stroke="#304c4b" strokeWidth="7" strokeLinecap="round"/>
53
+ </> : <>
54
+ <path d="M20 380 L110 230 L210 380 M105 380 L205 200 L332 380 M234 380 L330 250 L420 380" stroke="#e6dbc7" strokeWidth="8" fill="none" opacity=".7"/>
55
+ <path d="M0 390 Q170 345 420 380" stroke="#f6f0dd" strokeWidth="5" fill="none" opacity=".9"/>
56
+ </>}
57
+ </svg>
58
+ <div style={{position:'absolute',bottom:0,left:0,right:0,padding:large?'28px 26px':'20px 22px',
59
+ background:'linear-gradient(0deg,rgba(15,32,37,.85),transparent)',color:'#fff',fontFamily:FONT,
60
+ fontWeight:650,fontSize:large?39:27}}>{name}</div>
61
+ </div>;
62
+ };
63
+
64
+ export function PaperTitleCardDemo() {
65
+ const f = useCurrentFrame();
66
+ const words = [{t:'给生活',br:true},{t:'加点料',accent:true}];
67
+ const fadeOut=interpolate(f,[47,55],[1,0],{extrapolateLeft:'clamp',extrapolateRight:'clamp'});
68
+ const under=bounded(f,16,34,Easing.bezier(.3,0,.2,1));
69
+ return <AbsoluteFill style={{background:SWATCH.paper,opacity:fadeOut,
70
+ backgroundImage:'radial-gradient(700px 780px at 47% 42%,#fffdf7,transparent 80%)',
71
+ display:'flex',alignItems:'center',justifyContent:'center',fontFamily:SERIF,color:SWATCH.ink}}>
72
+ {badge('01','PAPER TITLE')}
73
+ <div style={{width:625,textAlign:'center',marginTop:-55}}>
74
+ <div style={{fontSize:96,fontWeight:700,lineHeight:1.35,display:'flex',flexWrap:'wrap',
75
+ justifyContent:'center',columnGap:18}}>
76
+ {words.map((w,i)=>{
77
+ const t=bounded(f,4+i*4,13+i*4,ease);
78
+ return <React.Fragment key={i}><span style={{opacity:t,display:'inline-block',
79
+ transform:'scale('+(1.28-.28*t)+')',filter:'blur('+((1-t)*7)+'px)',
80
+ color:w.accent?SWATCH.accent:SWATCH.ink,
81
+ fontStyle:w.accent?'italic':'normal'}}>{w.t}</span>
82
+ {w.br&&<span style={{flexBasis:'100%',height:0}}/>}</React.Fragment>;
83
+ })}
84
+ </div>
85
+ <div style={{height:6,width:220,background:SWATCH.accent,borderRadius:3,margin:'35px auto',
86
+ transform:'scaleX('+under+')'}}/>
87
+ <div style={{fontSize:27,letterSpacing:4,fontFamily:FONT,color:SWATCH.muted,
88
+ opacity:bounded(f,12,25)}}>加拿大 · 周末散步</div>
89
+ </div>
90
+ <div style={{position:'absolute',bottom:72,fontFamily:FONT,fontSize:18,letterSpacing:2,color:SWATCH.muted}}>
91
+ WORD-BY-WORD LETTERPRESS
92
+ </div>
93
+ </AbsoluteFill>;
94
+ }
95
+
96
+ // Adapted from video-shotcraft depth-layer-moves: drive * 0.35 / 0.7 / 1.4, fixed type.
97
+ export function MultiplaneDemo() {
98
+ const f=useCurrentFrame();
99
+ const travel=bounded(f,6,136,out);
100
+ const drive=1030*travel;
101
+ const lift=bounded(f,122,144,Easing.out(Easing.cubic));
102
+ const cards=['清晨的街道','沿着小路走','河边的风景','停下来看看','把日子记下来'];
103
+ return <AbsoluteFill style={{background:'#e5e1d7',overflow:'hidden',fontFamily:FONT}}>
104
+ {badge('02','2.5D PARALLAX')}
105
+ <div style={{position:'absolute',inset:0,overflow:'hidden',opacity:.28,filter:'blur(5px) saturate(.7)',
106
+ transform:'translateX('+(-drive*.35)+'px) scale(1.18)'}}>
107
+ <div style={{position:'absolute',top:0,left:-180,width:1800,height:1280,
108
+ background:'linear-gradient(110deg,#a9b4ab,#ebd8b6 40%,#9db9b7 65%,#d3c9ad)'}}/>
109
+ {Array.from({length:10},(_,i)=><div key={i} style={{position:'absolute',
110
+ left:i*200-50,top:390+(i%3)*30,width:120,height:370,background:'#8b9991',borderRadius:20}} />)}
111
+ </div>
112
+ <div style={{position:'absolute',inset:0,background:'linear-gradient(180deg,rgba(245,242,231,.92),rgba(231,224,209,.7) 70%,rgba(211,197,176,.8))'}}/>
113
+ <div style={{position:'absolute',top:300,left:-316,display:'flex',gap:40,
114
+ transform:'translateX('+(-drive*.7)+'px)'}}>
115
+ {cards.map((name,i)=><div key={name} style={{width:365,height:575,background:'#e7e1d6',
116
+ border:'8px solid #fcf8ed',borderRadius:28,overflow:'hidden',
117
+ transform:i===3?'translateY('+(-18*lift)+'px) scale('+(1+.035*lift)+')':undefined,
118
+ boxShadow:i===3?'0 0 0 '+(4*lift)+'px #b96a49,0 32px 75px rgba(32,41,42,.24)':'0 17px 38px rgba(32,41,42,.18)'}}>
119
+ <ScenicCard name={name} kind={i} large/>
120
+ </div>)}
121
+ </div>
122
+ <div style={{position:'absolute',inset:0,filter:'blur(7px)',opacity:.68,transform:'translateX('+(-drive*1.4)+'px)'}}>
123
+ {['WINTER','WALK','OTTAWA','VLOG'].map((tag,i)=><div key={tag} style={{position:'absolute',
124
+ left:700+i*620,top:860+(i%2)*160,background:i%2?'#2d4c52':'#b96a49',color:'white',
125
+ borderRadius:70,padding:'20px 45px',fontSize:54,whiteSpace:'nowrap'}}>{tag}</div>)}
126
+ </div>
127
+ <div style={{position:'absolute',top:165,left:45,right:45,pointerEvents:'none',zIndex:5}}>
128
+ <div style={{fontSize:70,fontWeight:750,lineHeight:1.14,color:SWATCH.ink,
129
+ textShadow:'0 1px 0 #fff'}}>从街道,<br/>走到河边。</div>
130
+ <div style={{fontSize:27,marginTop:20,color:SWATCH.muted}}>镜头滑行 · 三层视差 · 主角落定</div>
131
+ </div>
132
+ <div style={{position:'absolute',bottom:72,left:45,right:45,fontSize:19,
133
+ color:SWATCH.muted,letterSpacing:1,zIndex:8}}>FAR 0.35× MID 0.7× NEAR 1.4×</div>
134
+ {lift>.01&&<div style={{position:'absolute',right:70,top:910,zIndex:10,
135
+ background:SWATCH.accent,color:'white',padding:'13px 23px',borderRadius:30,
136
+ opacity:lift,transform:'translateY('+((1-lift)*25)+'px)',fontSize:21}}>IN FOCUS</div>}
137
+ </AbsoluteFill>;
138
+ }
139
+
140
+ // Adapted from video-shotcraft speed-ramp-freeze: abrupt 70-frame stop,
141
+ // 3-frame shutter flash, 10-frame pen circle, smootherstep resume.
142
+ export function FreezeAnnotateDemo() {
143
+ const f=useCurrentFrame();
144
+ const freezeStart=43, freezeEnd=113;
145
+ const resume=Math.max(0,Math.min(1,(f-freezeEnd)/25));
146
+ const smooth=resume*resume*resume*(resume*(resume*6-15)+10);
147
+ const sourceFrame=f<freezeStart?f*1.28:f<freezeEnd?freezeStart*1.28:freezeStart*1.28+smooth*52+(f-freezeEnd>25?(f-freezeEnd-25)*1.6:0);
148
+ const x=225-sourceFrame*14;
149
+ const paused=f>=freezeStart&&f<freezeEnd;
150
+ const inkOut=f<freezeEnd-8?1:1-bounded(f,freezeEnd-8,freezeEnd);
151
+ const mark=bounded(f,53,63);
152
+ const note=bounded(f,69,80,Easing.out(Easing.cubic))*inkOut;
153
+ return <AbsoluteFill style={{background:'#edf3f3',overflow:'hidden',fontFamily:FONT}}>
154
+ {badge('03','FREEZE & ANNOTATE')}
155
+ <div style={{position:'absolute',top:170,left:42,fontWeight:800,fontSize:72,lineHeight:1.15,
156
+ color:SWATCH.ink}}>拍到这一刻,<br/><span style={{color:SWATCH.blue}}>停一下。</span></div>
157
+ <div style={{position:'absolute',top:385,left:42,fontSize:25,color:SWATCH.muted}}>流动 → 定格圈注 → 解冻</div>
158
+ <div style={{position:'absolute',top:540,left:0,height:440,display:'flex',gap:26,
159
+ transform:'translateX('+x+'px)'}}>
160
+ {['路口','雪后的公园','河边','日落','回家的路'].map((name,i)=><div key={i}
161
+ style={{width:355,height:430,borderRadius:25,overflow:'hidden',background:'white',
162
+ boxShadow:i===2&&paused?'0 15px 65px rgba(44,99,126,.31)':'0 12px 33px rgba(30,49,53,.17)',
163
+ transform:i===2&&paused?'translateY(-12px) scale(1.04)':undefined,
164
+ opacity:paused&&i!==2?.62:1,filter:paused&&i!==2?'saturate(.5)':'none'}}>
165
+ <ScenicCard name={name} kind={i} large />
166
+ </div>)}
167
+ </div>
168
+ <div style={{position:'absolute',top:500,left:42,right:42,display:'flex',justifyContent:'space-between',
169
+ fontSize:23,fontFamily:'monospace',fontWeight:700,color:paused?SWATCH.blue:SWATCH.accent}}>
170
+ <span>{paused?'❚❚ PAUSED':'● LIVE'}</span>
171
+ <span>{paused?'00:00:01:13':'REC • '+String(Math.floor(f/30)).padStart(2,'0')+':'+String(f%30).padStart(2,'0')}</span>
172
+ </div>
173
+ {paused&&<svg viewBox="0 0 720 1280" style={{position:'absolute',inset:0,zIndex:6,width:'100%',height:'100%',pointerEvents:'none'}}>
174
+ <rect x="142" y="575" width="436" height="370" fill="none" stroke="#2c637e" strokeWidth="4" strokeDasharray="14 13" opacity=".42"/>
175
+ <path d="M155 600 C175 510 535 520 560 660 C610 820 520 970 330 960 C130 965 110 810 155 600"
176
+ fill="none" stroke="#2c637e" strokeWidth="12" strokeLinecap="round"
177
+ strokeDasharray="1450" strokeDashoffset={1450*(1-mark)} opacity={inkOut}/>
178
+ <path d="M560 870 Q620 875 625 970 L604 950 M625 970 L639 945"
179
+ fill="none" stroke="#2c637e" strokeWidth="8" strokeLinecap="round"
180
+ strokeDasharray="200" strokeDashoffset={200*(1-bounded(f,68,77))} opacity={inkOut}/>
181
+ </svg>}
182
+ {paused&&<div style={{position:'absolute',bottom:110,left:60,right:60,opacity:note,
183
+ transform:'translateY('+((1-note)*20)+'px)',textAlign:'center',color:SWATCH.blue,zIndex:8}}>
184
+ <div style={{fontSize:59,fontWeight:800}}>这一帧值得留下</div>
185
+ <div style={{height:7,width:240,background:SWATCH.blue,margin:'16px auto',borderRadius:8}}/>
186
+ <div style={{fontSize:24,marginTop:23,color:SWATCH.muted}}>FREEZE THE MOMENT</div>
187
+ </div>}
188
+ {f>=freezeStart&&f<freezeStart+3&&<div style={{position:'absolute',inset:0,background:'white',
189
+ opacity:(1-(f-freezeStart)/3)*.62,zIndex:11}}/>}
190
+ {!paused&&<div style={{position:'absolute',bottom:70,left:45,fontSize:21,color:SWATCH.muted}}>
191
+ {f<freezeStart?'MOTION →':'→ RESUME'}
192
+ </div>}
193
+ </AbsoluteFill>;
194
+ }
195
+ ~~~
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lalalic/markcut",
3
- "version": "3.2.52",
3
+ "version": "3.2.54",
4
4
  "description": "Markdown-to-video engine. Describe scenes in markdown, get a rendered video.",
5
5
  "bin": {
6
6
  "markcut": "bin/markcut"
@@ -100,6 +100,16 @@ export function externalizePreviewMedia(compiled,revisionId,origin=publicOrigin(
100
100
  try {real=realpathSync(full);} catch {return resolvePreviewSource(src,sourceDir,origin);}
101
101
  if(!real.startsWith(root+sep))return resolvePreviewSource(src,sourceDir,origin);
102
102
  if(frozenPaths.has(real))return frozenPaths.get(real);
103
+ // Dedicated preview route lets NeoY reuse Visioner proxies without changing video.md.
104
+ // If no proxy exists, NeoY serves the original media at the same preview URL.
105
+ if(/\.(mov|mp4|webm)$/i.test(real)) {
106
+ const mounted=resolveMountedFile(real,origin);
107
+ if(mounted) {
108
+ const previewUrl=mounted.replace(origin+"/files/",origin+"/preview-files/");
109
+ frozenPaths.set(real,previewUrl);
110
+ return previewUrl;
111
+ }
112
+ }
103
113
  const stats=statSync(real);
104
114
  if(!stats.isFile()||stats.size>512*1024*1024)throw new Error("Preview local media must be a file of at most 512 MB");
105
115
  const ext=extname(real).toLowerCase();
@@ -7,7 +7,7 @@
7
7
  * (TTS/STT/durations)
8
8
  */
9
9
  import { execSync, spawn } from "node:child_process";
10
- import { readFileSync, writeFileSync, mkdirSync, existsSync } from "node:fs";
10
+ import { readFileSync, writeFileSync, mkdirSync, existsSync, copyFileSync } from "node:fs";
11
11
  import { resolve, dirname, join } from "node:path";
12
12
  import { fileURLToPath } from "node:url";
13
13
  import {
@@ -401,7 +401,15 @@ edit=${DEFAULT_EDIT_CLI}`);
401
401
  mkdirSync(bundleDir, { recursive: true });
402
402
  const bundle = await bundleFromEntries(entries, extraSpecs, rawSource, bundleDir);
403
403
  if (bundle.url) {
404
- streamTree.imports = join(bundleDir, bundle.url.split("/").pop());
404
+ // Remotion fetches modules from its publicDir, not absolute host paths.
405
+ // Stage this cached bundle alongside the Markdown's generated media.
406
+ const bundleName = bundle.url.split("/").pop();
407
+ const publicDir = renderPublicDir || join(ROOT, "public");
408
+ const relativeBundle = join(".markcut", "generated", "components", bundleName);
409
+ const target = join(publicDir, relativeBundle);
410
+ mkdirSync(dirname(target), { recursive: true });
411
+ copyFileSync(join(bundleDir, bundleName), target);
412
+ streamTree.imports = relativeBundle;
405
413
  console.log(` \u2705 components \u2192 ${bundle.exports.join(", ")}`);
406
414
  }
407
415
  }