@softure-ai/marketing-kit 0.1.12 → 0.3.1
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.
- package/CHANGELOG.md +27 -0
- package/README.md +109 -4
- package/dist/cli/footage.d.ts +6 -0
- package/dist/cli/footage.d.ts.map +1 -0
- package/dist/cli/footage.js +95 -0
- package/dist/cli/footage.js.map +1 -0
- package/dist/cli/main.js +21 -5
- package/dist/cli/main.js.map +1 -1
- package/dist/cli/options.d.ts +18 -3
- package/dist/cli/options.d.ts.map +1 -1
- package/dist/cli/options.js +41 -2
- package/dist/cli/options.js.map +1 -1
- package/dist/compose/compose.d.ts.map +1 -1
- package/dist/compose/compose.js +1 -22
- package/dist/compose/compose.js.map +1 -1
- package/dist/compose/html.d.ts +6 -0
- package/dist/compose/html.d.ts.map +1 -0
- package/dist/compose/html.js +24 -0
- package/dist/compose/html.js.map +1 -0
- package/dist/config/actions-schema.d.ts +14 -14
- package/dist/config/config.d.ts +19 -3
- package/dist/config/config.d.ts.map +1 -1
- package/dist/config/config.js +90 -2
- package/dist/config/config.js.map +1 -1
- package/dist/config/schema.d.ts +152 -70
- package/dist/config/schema.d.ts.map +1 -1
- package/dist/config/schema.js +140 -10
- package/dist/config/schema.js.map +1 -1
- package/dist/config/shot-steps.d.ts +16 -16
- package/dist/footage/cache.d.ts +23 -0
- package/dist/footage/cache.d.ts.map +1 -0
- package/dist/footage/cache.js +51 -0
- package/dist/footage/cache.js.map +1 -0
- package/dist/footage/compose.d.ts +50 -0
- package/dist/footage/compose.d.ts.map +1 -0
- package/dist/footage/compose.js +166 -0
- package/dist/footage/compose.js.map +1 -0
- package/dist/footage/edl.d.ts +83 -0
- package/dist/footage/edl.d.ts.map +1 -0
- package/dist/footage/edl.js +166 -0
- package/dist/footage/edl.js.map +1 -0
- package/dist/footage/elevenlabs.d.ts +31 -0
- package/dist/footage/elevenlabs.d.ts.map +1 -0
- package/dist/footage/elevenlabs.js +140 -0
- package/dist/footage/elevenlabs.js.map +1 -0
- package/dist/footage/fake.d.ts +38 -0
- package/dist/footage/fake.d.ts.map +1 -0
- package/dist/footage/fake.js +66 -0
- package/dist/footage/fake.js.map +1 -0
- package/dist/footage/film.d.ts +103 -0
- package/dist/footage/film.d.ts.map +1 -0
- package/dist/footage/film.js +29 -0
- package/dist/footage/film.js.map +1 -0
- package/dist/footage/music.d.ts +37 -0
- package/dist/footage/music.d.ts.map +1 -0
- package/dist/footage/music.js +63 -0
- package/dist/footage/music.js.map +1 -0
- package/dist/footage/normalize.d.ts +41 -0
- package/dist/footage/normalize.d.ts.map +1 -0
- package/dist/footage/normalize.js +114 -0
- package/dist/footage/normalize.js.map +1 -0
- package/dist/footage/pipeline.d.ts +105 -0
- package/dist/footage/pipeline.d.ts.map +1 -0
- package/dist/footage/pipeline.js +385 -0
- package/dist/footage/pipeline.js.map +1 -0
- package/dist/footage/probe.d.ts +64 -0
- package/dist/footage/probe.d.ts.map +1 -0
- package/dist/footage/probe.js +138 -0
- package/dist/footage/probe.js.map +1 -0
- package/dist/footage/providers.d.ts +61 -0
- package/dist/footage/providers.d.ts.map +1 -0
- package/dist/footage/providers.js +13 -0
- package/dist/footage/providers.js.map +1 -0
- package/dist/footage/render.d.ts +20 -0
- package/dist/footage/render.d.ts.map +1 -0
- package/dist/footage/render.js +76 -0
- package/dist/footage/render.js.map +1 -0
- package/dist/index.d.ts +14 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +16 -3
- package/dist/index.js.map +1 -1
- package/dist/messages/index.d.ts +10 -22
- package/dist/messages/index.d.ts.map +1 -1
- package/dist/messages/index.js +8 -6
- package/dist/messages/index.js.map +1 -1
- package/dist/render/render.d.ts +6 -0
- package/dist/render/render.d.ts.map +1 -1
- package/dist/render/render.js +1 -1
- package/dist/render/render.js.map +1 -1
- package/package.json +1 -1
- package/schema/marketing.schema.json +339 -3
- package/src/cli/footage.ts +87 -0
- package/src/cli/main.ts +20 -5
- package/src/cli/options.ts +51 -4
- package/src/compose/compose.ts +1 -25
- package/src/compose/html.ts +28 -0
- package/src/config/config.ts +101 -5
- package/src/config/schema.ts +146 -12
- package/src/footage/cache.ts +66 -0
- package/src/footage/compose.ts +213 -0
- package/src/footage/edl.ts +204 -0
- package/src/footage/elevenlabs.ts +154 -0
- package/src/footage/fake.ts +92 -0
- package/src/footage/film.ts +111 -0
- package/src/footage/music.ts +86 -0
- package/src/footage/normalize.ts +133 -0
- package/src/footage/pipeline.ts +447 -0
- package/src/footage/probe.ts +172 -0
- package/src/footage/providers.ts +71 -0
- package/src/footage/render.ts +82 -0
- package/src/index.ts +110 -3
- package/src/messages/index.ts +16 -8
- package/src/render/render.ts +1 -1
- package/dist/messages/pl.d.ts +0 -3
- package/dist/messages/pl.d.ts.map +0 -1
- package/dist/messages/pl.js +0 -21
- package/dist/messages/pl.js.map +0 -1
- package/src/messages/pl.ts +0 -22
|
@@ -17,7 +17,91 @@
|
|
|
17
17
|
"locale": {
|
|
18
18
|
"type": "string",
|
|
19
19
|
"pattern": "^[a-z]{2,3}(-[A-Za-z0-9]{2,8})*$",
|
|
20
|
-
"description": "BCP 47 locale (en-US): the recording browser's locale
|
|
20
|
+
"description": "BCP 47 locale (en-US): the recording browser's locale and <html lang>. The copy is English unless brand.messages translates it."
|
|
21
|
+
},
|
|
22
|
+
"messages": {
|
|
23
|
+
"default": {},
|
|
24
|
+
"description": "The copy of the posts and the film, every key optional (src/messages/en.ts): the product's own translation, or changed English copy. A key left out reads English.",
|
|
25
|
+
"type": "object",
|
|
26
|
+
"properties": {
|
|
27
|
+
"posts": {
|
|
28
|
+
"description": "The copy of posts.md.",
|
|
29
|
+
"type": "object",
|
|
30
|
+
"properties": {
|
|
31
|
+
"title": {
|
|
32
|
+
"description": "src/messages/en.ts posts.title: the heading of posts.md, {title} is the film's title; English when left out.",
|
|
33
|
+
"type": "string",
|
|
34
|
+
"minLength": 1
|
|
35
|
+
},
|
|
36
|
+
"linkInBio": {
|
|
37
|
+
"description": "src/messages/en.ts posts.linkInBio: the call to action where a caption link is not clickable; English when left out.",
|
|
38
|
+
"type": "string",
|
|
39
|
+
"minLength": 1
|
|
40
|
+
},
|
|
41
|
+
"bioLink": {
|
|
42
|
+
"description": "src/messages/en.ts posts.bioLink: the bio link line, {link}; English when left out.",
|
|
43
|
+
"type": "string",
|
|
44
|
+
"minLength": 1
|
|
45
|
+
},
|
|
46
|
+
"postLink": {
|
|
47
|
+
"description": "src/messages/en.ts posts.postLink: the post link line, {link}; English when left out.",
|
|
48
|
+
"type": "string",
|
|
49
|
+
"minLength": 1
|
|
50
|
+
},
|
|
51
|
+
"platforms": {
|
|
52
|
+
"description": "The platform names in posts.md.",
|
|
53
|
+
"type": "object",
|
|
54
|
+
"properties": {
|
|
55
|
+
"instagram": {
|
|
56
|
+
"description": "src/messages/en.ts posts.platforms.instagram; English when left out.",
|
|
57
|
+
"type": "string",
|
|
58
|
+
"minLength": 1
|
|
59
|
+
},
|
|
60
|
+
"facebook": {
|
|
61
|
+
"description": "src/messages/en.ts posts.platforms.facebook; English when left out.",
|
|
62
|
+
"type": "string",
|
|
63
|
+
"minLength": 1
|
|
64
|
+
},
|
|
65
|
+
"tiktok": {
|
|
66
|
+
"description": "src/messages/en.ts posts.platforms.tiktok; English when left out.",
|
|
67
|
+
"type": "string",
|
|
68
|
+
"minLength": 1
|
|
69
|
+
},
|
|
70
|
+
"youtube": {
|
|
71
|
+
"description": "src/messages/en.ts posts.platforms.youtube; English when left out.",
|
|
72
|
+
"type": "string",
|
|
73
|
+
"minLength": 1
|
|
74
|
+
},
|
|
75
|
+
"linkedin": {
|
|
76
|
+
"description": "src/messages/en.ts posts.platforms.linkedin; English when left out.",
|
|
77
|
+
"type": "string",
|
|
78
|
+
"minLength": 1
|
|
79
|
+
},
|
|
80
|
+
"x": {
|
|
81
|
+
"description": "src/messages/en.ts posts.platforms.x; English when left out.",
|
|
82
|
+
"type": "string",
|
|
83
|
+
"minLength": 1
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
"additionalProperties": false
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
"additionalProperties": false
|
|
90
|
+
},
|
|
91
|
+
"film": {
|
|
92
|
+
"description": "The copy inside the film.",
|
|
93
|
+
"type": "object",
|
|
94
|
+
"properties": {
|
|
95
|
+
"persona": {
|
|
96
|
+
"description": "src/messages/en.ts film.persona: the persona card's first line, {name} and {age}; English when left out.",
|
|
97
|
+
"type": "string",
|
|
98
|
+
"minLength": 1
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
"additionalProperties": false
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
"additionalProperties": false
|
|
21
105
|
},
|
|
22
106
|
"timezone": {
|
|
23
107
|
"type": "string",
|
|
@@ -514,7 +598,6 @@
|
|
|
514
598
|
"description": "The voiceover: provider, voice, language and the paid cache."
|
|
515
599
|
},
|
|
516
600
|
"videos": {
|
|
517
|
-
"minItems": 1,
|
|
518
601
|
"type": "array",
|
|
519
602
|
"items": {
|
|
520
603
|
"type": "object",
|
|
@@ -2522,7 +2605,260 @@
|
|
|
2522
2605
|
],
|
|
2523
2606
|
"additionalProperties": false
|
|
2524
2607
|
},
|
|
2525
|
-
"description": "The films
|
|
2608
|
+
"description": "The screen films recorded from the app (may be empty when footage has a film); videos and footage hold at least one film between them."
|
|
2609
|
+
},
|
|
2610
|
+
"footage": {
|
|
2611
|
+
"default": [],
|
|
2612
|
+
"description": "Footage films cut from filmed clips (softure-marketing footage).",
|
|
2613
|
+
"type": "array",
|
|
2614
|
+
"items": {
|
|
2615
|
+
"type": "object",
|
|
2616
|
+
"properties": {
|
|
2617
|
+
"id": {
|
|
2618
|
+
"type": "string",
|
|
2619
|
+
"pattern": "^[a-z0-9]+(-[a-z0-9]+)*$",
|
|
2620
|
+
"description": "The film's id: its folder under output.dir, unique across videos and footage; social.posts may name it."
|
|
2621
|
+
},
|
|
2622
|
+
"title": {
|
|
2623
|
+
"type": "string",
|
|
2624
|
+
"minLength": 1,
|
|
2625
|
+
"description": "The film's title: the heading of its posts.md and the composition's <title>."
|
|
2626
|
+
},
|
|
2627
|
+
"format": {
|
|
2628
|
+
"default": "9:16",
|
|
2629
|
+
"description": "The film's aspect ratio: 9:16 (1080×1920), 1:1 or 16:9; every clip is fitted to it.",
|
|
2630
|
+
"type": "string",
|
|
2631
|
+
"enum": [
|
|
2632
|
+
"9:16",
|
|
2633
|
+
"1:1",
|
|
2634
|
+
"16:9"
|
|
2635
|
+
]
|
|
2636
|
+
},
|
|
2637
|
+
"language": {
|
|
2638
|
+
"description": "ISO 639 code the clips speak (pl, en): the transcript's language and the default fillers; without it, voice.language.",
|
|
2639
|
+
"type": "string",
|
|
2640
|
+
"pattern": "^[a-z]{2,3}$"
|
|
2641
|
+
},
|
|
2642
|
+
"clips": {
|
|
2643
|
+
"minItems": 1,
|
|
2644
|
+
"type": "array",
|
|
2645
|
+
"items": {
|
|
2646
|
+
"type": "object",
|
|
2647
|
+
"properties": {
|
|
2648
|
+
"id": {
|
|
2649
|
+
"type": "string",
|
|
2650
|
+
"pattern": "^[a-z0-9]+(-[a-z0-9]+)*$",
|
|
2651
|
+
"description": "The clip's id, unique within the film; the EDL names clips by it."
|
|
2652
|
+
},
|
|
2653
|
+
"source": {
|
|
2654
|
+
"type": "string",
|
|
2655
|
+
"minLength": 1,
|
|
2656
|
+
"description": "The clip: a path relative to the folder of marketing.json, or an https:// URL downloaded once into the build folder."
|
|
2657
|
+
},
|
|
2658
|
+
"role": {
|
|
2659
|
+
"default": "talk",
|
|
2660
|
+
"description": "talk: someone speaks, the cut follows the words; broll: pictures without speech, kept whole with a slow zoom.",
|
|
2661
|
+
"type": "string",
|
|
2662
|
+
"enum": [
|
|
2663
|
+
"talk",
|
|
2664
|
+
"broll"
|
|
2665
|
+
]
|
|
2666
|
+
},
|
|
2667
|
+
"fit": {
|
|
2668
|
+
"default": "auto",
|
|
2669
|
+
"description": "How a clip of another aspect fills the frame: crop (cover, edges cut), blur (the whole picture over a blurred copy) or auto (crop within 15 % of the frame's aspect, else blur).",
|
|
2670
|
+
"type": "string",
|
|
2671
|
+
"enum": [
|
|
2672
|
+
"auto",
|
|
2673
|
+
"crop",
|
|
2674
|
+
"blur"
|
|
2675
|
+
]
|
|
2676
|
+
},
|
|
2677
|
+
"trim": {
|
|
2678
|
+
"description": "The part of the clip the film uses.",
|
|
2679
|
+
"default": {},
|
|
2680
|
+
"type": "object",
|
|
2681
|
+
"properties": {
|
|
2682
|
+
"start": {
|
|
2683
|
+
"default": 0,
|
|
2684
|
+
"description": "Seconds cut from the clip's start.",
|
|
2685
|
+
"type": "number",
|
|
2686
|
+
"minimum": 0
|
|
2687
|
+
},
|
|
2688
|
+
"end": {
|
|
2689
|
+
"description": "The second the clip ends at; without it, its own end.",
|
|
2690
|
+
"type": "number",
|
|
2691
|
+
"exclusiveMinimum": 0
|
|
2692
|
+
}
|
|
2693
|
+
},
|
|
2694
|
+
"additionalProperties": false
|
|
2695
|
+
},
|
|
2696
|
+
"script": {
|
|
2697
|
+
"description": "What the clip says, for --placeholder only: its words spread evenly over the clip as a free stand-in transcript.",
|
|
2698
|
+
"type": "string"
|
|
2699
|
+
}
|
|
2700
|
+
},
|
|
2701
|
+
"required": [
|
|
2702
|
+
"id",
|
|
2703
|
+
"source"
|
|
2704
|
+
],
|
|
2705
|
+
"additionalProperties": false
|
|
2706
|
+
},
|
|
2707
|
+
"description": "The filmed clips in the film's order."
|
|
2708
|
+
},
|
|
2709
|
+
"isolateVoice": {
|
|
2710
|
+
"default": false,
|
|
2711
|
+
"description": "Clean the talking clips' voice of background noise (ElevenLabs Voice Isolator, paid with --commit) before transcribing.",
|
|
2712
|
+
"type": "boolean"
|
|
2713
|
+
},
|
|
2714
|
+
"fillers": {
|
|
2715
|
+
"description": "Filler words cut out of the talking clips, compared without case, punctuation and repeated letters; without it, the language's defaults (pl: yyy, eee, yhm and more; en: um, uh and more).",
|
|
2716
|
+
"type": "array",
|
|
2717
|
+
"items": {
|
|
2718
|
+
"type": "string"
|
|
2719
|
+
}
|
|
2720
|
+
},
|
|
2721
|
+
"pauseSeconds": {
|
|
2722
|
+
"default": 0.6,
|
|
2723
|
+
"description": "A silence between two words longer than this is cut (0.1-10 s, default 0.6).",
|
|
2724
|
+
"type": "number",
|
|
2725
|
+
"minimum": 0.1,
|
|
2726
|
+
"maximum": 10
|
|
2727
|
+
},
|
|
2728
|
+
"padSeconds": {
|
|
2729
|
+
"default": 0.12,
|
|
2730
|
+
"description": "Seconds kept around every cut (0-1, default 0.12).",
|
|
2731
|
+
"type": "number",
|
|
2732
|
+
"minimum": 0,
|
|
2733
|
+
"maximum": 1
|
|
2734
|
+
},
|
|
2735
|
+
"maxSeconds": {
|
|
2736
|
+
"description": "The cut's longest length in seconds; later segments are shortened or dropped.",
|
|
2737
|
+
"type": "number",
|
|
2738
|
+
"minimum": 1,
|
|
2739
|
+
"maximum": 600
|
|
2740
|
+
},
|
|
2741
|
+
"transitions": {
|
|
2742
|
+
"description": "Default transitions by kind of cut; each segment of the EDL can name its own.",
|
|
2743
|
+
"default": {},
|
|
2744
|
+
"type": "object",
|
|
2745
|
+
"properties": {
|
|
2746
|
+
"jump": {
|
|
2747
|
+
"default": "zoom",
|
|
2748
|
+
"description": "A cut inside one talking clip: cut, fade, zoom (a punch-in, the default) or whoosh.",
|
|
2749
|
+
"type": "string",
|
|
2750
|
+
"enum": [
|
|
2751
|
+
"cut",
|
|
2752
|
+
"fade",
|
|
2753
|
+
"zoom",
|
|
2754
|
+
"whoosh"
|
|
2755
|
+
]
|
|
2756
|
+
},
|
|
2757
|
+
"clip": {
|
|
2758
|
+
"default": "fade",
|
|
2759
|
+
"description": "A cut from one clip to the next: cut, fade (the default), zoom or whoosh.",
|
|
2760
|
+
"type": "string",
|
|
2761
|
+
"enum": [
|
|
2762
|
+
"cut",
|
|
2763
|
+
"fade",
|
|
2764
|
+
"zoom",
|
|
2765
|
+
"whoosh"
|
|
2766
|
+
]
|
|
2767
|
+
}
|
|
2768
|
+
},
|
|
2769
|
+
"additionalProperties": false
|
|
2770
|
+
},
|
|
2771
|
+
"music": {
|
|
2772
|
+
"description": "Music under the film, ducked while someone speaks; without it, none.",
|
|
2773
|
+
"type": "object",
|
|
2774
|
+
"properties": {
|
|
2775
|
+
"file": {
|
|
2776
|
+
"description": "A local music file, relative to the folder of marketing.json.",
|
|
2777
|
+
"type": "string",
|
|
2778
|
+
"minLength": 1
|
|
2779
|
+
},
|
|
2780
|
+
"prompt": {
|
|
2781
|
+
"description": "A prompt for ElevenLabs Music (instrumental, paid with --commit, cached).",
|
|
2782
|
+
"type": "string"
|
|
2783
|
+
},
|
|
2784
|
+
"fromVideo": {
|
|
2785
|
+
"description": "ElevenLabs Video to Music scored to the cut itself (paid with --commit, cached).",
|
|
2786
|
+
"type": "object",
|
|
2787
|
+
"properties": {
|
|
2788
|
+
"description": {
|
|
2789
|
+
"default": "",
|
|
2790
|
+
"description": "What the music should be like (up to 4100 characters).",
|
|
2791
|
+
"type": "string",
|
|
2792
|
+
"maxLength": 4100
|
|
2793
|
+
},
|
|
2794
|
+
"tags": {
|
|
2795
|
+
"default": [],
|
|
2796
|
+
"description": "Style tags such as upbeat or cinematic (up to 10).",
|
|
2797
|
+
"maxItems": 10,
|
|
2798
|
+
"type": "array",
|
|
2799
|
+
"items": {
|
|
2800
|
+
"type": "string"
|
|
2801
|
+
}
|
|
2802
|
+
}
|
|
2803
|
+
},
|
|
2804
|
+
"additionalProperties": false
|
|
2805
|
+
},
|
|
2806
|
+
"volume": {
|
|
2807
|
+
"default": 0.35,
|
|
2808
|
+
"description": "The music's volume between sentences (0-1, default 0.35).",
|
|
2809
|
+
"type": "number",
|
|
2810
|
+
"minimum": 0,
|
|
2811
|
+
"maximum": 1
|
|
2812
|
+
},
|
|
2813
|
+
"duckedVolume": {
|
|
2814
|
+
"default": 0.1,
|
|
2815
|
+
"description": "The music's volume under speech (0-1, default 0.1).",
|
|
2816
|
+
"type": "number",
|
|
2817
|
+
"minimum": 0,
|
|
2818
|
+
"maximum": 1
|
|
2819
|
+
}
|
|
2820
|
+
},
|
|
2821
|
+
"additionalProperties": false
|
|
2822
|
+
},
|
|
2823
|
+
"captions": {
|
|
2824
|
+
"default": true,
|
|
2825
|
+
"description": "Word-by-word captions from the transcript (default true).",
|
|
2826
|
+
"type": "boolean"
|
|
2827
|
+
},
|
|
2828
|
+
"endCard": {
|
|
2829
|
+
"description": "The closing card after the last segment; without it, the film ends with its last segment.",
|
|
2830
|
+
"type": "object",
|
|
2831
|
+
"properties": {
|
|
2832
|
+
"headline": {
|
|
2833
|
+
"type": "string",
|
|
2834
|
+
"minLength": 1,
|
|
2835
|
+
"description": "The end card's headline."
|
|
2836
|
+
},
|
|
2837
|
+
"url": {
|
|
2838
|
+
"type": "string",
|
|
2839
|
+
"minLength": 1,
|
|
2840
|
+
"description": "The address shown in the end card's link pill, as written (e.g. example.com)."
|
|
2841
|
+
},
|
|
2842
|
+
"note": {
|
|
2843
|
+
"default": "",
|
|
2844
|
+
"description": "A small line under the link; empty: none.",
|
|
2845
|
+
"type": "string"
|
|
2846
|
+
}
|
|
2847
|
+
},
|
|
2848
|
+
"required": [
|
|
2849
|
+
"headline",
|
|
2850
|
+
"url"
|
|
2851
|
+
],
|
|
2852
|
+
"additionalProperties": false
|
|
2853
|
+
}
|
|
2854
|
+
},
|
|
2855
|
+
"required": [
|
|
2856
|
+
"id",
|
|
2857
|
+
"title",
|
|
2858
|
+
"clips"
|
|
2859
|
+
],
|
|
2860
|
+
"additionalProperties": false
|
|
2861
|
+
}
|
|
2526
2862
|
},
|
|
2527
2863
|
"social": {
|
|
2528
2864
|
"description": "Post copy for the films: the link, the platforms and their channel codes.",
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { existsSync, mkdirSync, writeFileSync } from "node:fs";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
|
|
4
|
+
import { findFootage, findMissingFootageFiles, formatConfigIssues, type FootageConfig, type MarketingConfig } from "../config/config.js";
|
|
5
|
+
import { createElevenLabsFootageProviders } from "../footage/elevenlabs.js";
|
|
6
|
+
import { cutFootage, getEdlPath, prepareFootage, readEdlFile, renderFootage, transcribeFootage, type RenderFootageOptions } from "../footage/pipeline.js";
|
|
7
|
+
import { postsMarkdown } from "../posts/posts.js";
|
|
8
|
+
import { findMachineProblem } from "../render/preflight.js";
|
|
9
|
+
import { fail } from "./failure.js";
|
|
10
|
+
import type { FootageOptions } from "./options.js";
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* `softure-marketing footage <film>`: a footage film from `marketing.json` (`footage[]`). Without `--step` it runs
|
|
14
|
+
* transcribe, cut (keeping an EDL already in the build folder, maybe edited by hand) and render; `--step=transcribe`
|
|
15
|
+
* stops after the transcripts, `--step=cut` writes the EDL afresh from them, `--step=render` renders the EDL as it is.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
function getRunOptions(config: MarketingConfig, film: FootageConfig, options: FootageOptions): RenderFootageOptions {
|
|
19
|
+
const outDir = join(config.output.dir, film.id);
|
|
20
|
+
return {
|
|
21
|
+
buildDir: join(config.output.buildDir, film.id),
|
|
22
|
+
cacheDir: config.voice.cacheDir,
|
|
23
|
+
providers: createElevenLabsFootageProviders(process.env),
|
|
24
|
+
isCommit: options.isCommit,
|
|
25
|
+
isPlaceholder: options.isPlaceholder,
|
|
26
|
+
log: (line) => console.log(line),
|
|
27
|
+
brand: { name: config.brand.name, locale: config.brand.locale, colors: config.brand.colors, fonts: config.brand.fonts, logo: config.brand.logo },
|
|
28
|
+
sfx: config.sfx,
|
|
29
|
+
quality: options.quality ?? config.output.quality,
|
|
30
|
+
// A rehearsal never takes the place of the real film.
|
|
31
|
+
output: join(outDir, options.isPlaceholder ? `${film.id}.placeholder.mp4` : `${film.id}.mp4`),
|
|
32
|
+
layout: film.layout,
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/** Writes `posts.md` for a footage film; null when `social.posts` has no entry for it. */
|
|
37
|
+
export function writeFootagePosts(config: MarketingConfig, film: FootageConfig): string | null {
|
|
38
|
+
if (config.social === null || film.post === null) return null;
|
|
39
|
+
const dir = join(config.output.dir, film.id);
|
|
40
|
+
mkdirSync(dir, { recursive: true });
|
|
41
|
+
const path = join(dir, "posts.md");
|
|
42
|
+
writeFileSync(path, postsMarkdown({ title: film.title, post: film.post, linkTemplate: config.social.linkTemplate, messages: config.brand.messages }));
|
|
43
|
+
return path;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export async function runFootage(config: MarketingConfig, options: FootageOptions): Promise<void> {
|
|
47
|
+
const film = findFootage(config, options.filmId);
|
|
48
|
+
if (film === null) fail(`no footage film "${options.filmId}" in ${config.file}. Available: ${config.footage.map((entry) => entry.id).join(", ") || "none"}.`);
|
|
49
|
+
const needsRender = options.step === "all" || options.step === "render";
|
|
50
|
+
const problem = findMachineProblem({ needsRender, cwd: config.root });
|
|
51
|
+
if (problem !== null) fail(problem);
|
|
52
|
+
const missing = findMissingFootageFiles(config, film, needsRender);
|
|
53
|
+
if (missing.length > 0) fail(formatConfigIssues(config, missing));
|
|
54
|
+
const run = getRunOptions(config, film, options);
|
|
55
|
+
if (options.isPlaceholder) console.log("footage: rehearsal on placeholder transcripts (each clip's script); nothing paid, no isolation, no generated music.");
|
|
56
|
+
|
|
57
|
+
const clips = await prepareFootage(film, run);
|
|
58
|
+
if (!clips.ok) fail(clips.error);
|
|
59
|
+
const transcript = await transcribeFootage(film, clips.value, run);
|
|
60
|
+
if (!transcript.ok) fail(transcript.error);
|
|
61
|
+
if (transcript.value.kind === "dry-run") return;
|
|
62
|
+
if (options.step === "transcribe") {
|
|
63
|
+
console.log(`✓ transcripts of ${clips.value.length} clips ready; next: softure-marketing footage ${film.id} --step=cut${options.isPlaceholder ? " --placeholder" : ""}.`);
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
const edlPath = getEdlPath(run.buildDir, options.isPlaceholder);
|
|
67
|
+
const isRecut = options.step === "cut" || (options.step === "all" && !existsSync(edlPath));
|
|
68
|
+
let edl;
|
|
69
|
+
if (isRecut) {
|
|
70
|
+
edl = cutFootage(film, clips.value, transcript.value.words, edlPath);
|
|
71
|
+
console.log(`cut: ${edl.segments.length} segments written to ${edlPath}; check or edit it, then softure-marketing footage ${film.id} --step=render.`);
|
|
72
|
+
if (options.step === "cut") return;
|
|
73
|
+
} else {
|
|
74
|
+
if (!existsSync(edlPath)) fail(`no EDL at ${edlPath}: run softure-marketing footage ${film.id} --step=cut first.`);
|
|
75
|
+
const read = readEdlFile(film, clips.value, edlPath);
|
|
76
|
+
if (!read.ok) fail(read.error);
|
|
77
|
+
edl = read.value;
|
|
78
|
+
console.log(`cut: ${edlPath} (${edl.segments.length} segments), as it is; --step=cut builds it again.`);
|
|
79
|
+
}
|
|
80
|
+
const rendered = await renderFootage(film, clips.value, transcript.value, edl, run);
|
|
81
|
+
if (!rendered.ok) fail(rendered.error);
|
|
82
|
+
if (rendered.value.kind === "dry-run") return;
|
|
83
|
+
const { output, seconds } = rendered.value;
|
|
84
|
+
console.log(`\n✓ ${output} (${seconds.toFixed(1)} s, ${film.format})`);
|
|
85
|
+
const posts = writeFootagePosts(config, film);
|
|
86
|
+
console.log(posts === null ? `no post copy: social.posts has no entry for "${film.id}" in ${config.file}.` : `✓ ${posts}: post copy`);
|
|
87
|
+
}
|
package/src/cli/main.ts
CHANGED
|
@@ -2,10 +2,9 @@
|
|
|
2
2
|
import { existsSync, mkdirSync, writeFileSync } from "node:fs";
|
|
3
3
|
import { join, resolve } from "node:path";
|
|
4
4
|
|
|
5
|
-
import { findMissingFiles, formatConfigIssues, loadMarketingConfig, type MarketingConfig } from "../config/config.js";
|
|
5
|
+
import { findFootage, findMissingFiles, findVideo, formatConfigIssues, loadMarketingConfig, type MarketingConfig } from "../config/config.js";
|
|
6
6
|
import { getGeometry, getLayoutName } from "../compose/timeline.js";
|
|
7
7
|
import { sceneBeats } from "../film.js";
|
|
8
|
-
import { getMarketingMessages } from "../messages/index.js";
|
|
9
8
|
import { postsMarkdown } from "../posts/posts.js";
|
|
10
9
|
import { recordFilm, ScreenGuardError, type RecordingLog } from "../record/record.js";
|
|
11
10
|
import { findMachineProblem } from "../render/preflight.js";
|
|
@@ -36,6 +35,7 @@ import { getFilmVoiceover, produceVoiceover, produceVoiceovers, readJson } from
|
|
|
36
35
|
* og [image]
|
|
37
36
|
* shots [<id>] [--url=...]
|
|
38
37
|
* shots --page=<url> --out=<file.png> --expect=<phrase> [...]
|
|
38
|
+
* footage <film> [--step=transcribe|cut|render] [--commit] [--placeholder]
|
|
39
39
|
*/
|
|
40
40
|
|
|
41
41
|
const getBuildDir = (config: MarketingConfig, film: LoadedFilm) => join(config.output.buildDir, film.id);
|
|
@@ -92,14 +92,14 @@ function writePosts(config: MarketingConfig, film: LoadedFilm): string | null {
|
|
|
92
92
|
mkdirSync(getOutDir(config, film), { recursive: true });
|
|
93
93
|
writeFileSync(
|
|
94
94
|
path,
|
|
95
|
-
postsMarkdown({ title: film.title, post: film.post, linkTemplate: config.social.linkTemplate, messages:
|
|
95
|
+
postsMarkdown({ title: film.title, post: film.post, linkTemplate: config.social.linkTemplate, messages: config.brand.messages }),
|
|
96
96
|
);
|
|
97
97
|
return path;
|
|
98
98
|
}
|
|
99
99
|
|
|
100
100
|
function describePosts(config: MarketingConfig, film: LoadedFilm, path: string | null): string {
|
|
101
101
|
if (path === null) return `no post copy: social.posts has no entry for "${film.id}" in ${config.file}.`;
|
|
102
|
-
const labels = (film.post?.channels ?? []).map((channel) =>
|
|
102
|
+
const labels = (film.post?.channels ?? []).map((channel) => config.brand.messages.posts.platforms[channel.platform]);
|
|
103
103
|
return `✓ ${path}: post copy for ${labels.join(", ")}`;
|
|
104
104
|
}
|
|
105
105
|
|
|
@@ -136,7 +136,7 @@ function render(config: MarketingConfig, film: LoadedFilm, options: FilmOptions)
|
|
|
136
136
|
colors: config.brand.colors,
|
|
137
137
|
brandName: config.brand.name,
|
|
138
138
|
locale: config.brand.locale,
|
|
139
|
-
messages:
|
|
139
|
+
messages: config.brand.messages,
|
|
140
140
|
quality: options.quality ?? config.output.quality,
|
|
141
141
|
output,
|
|
142
142
|
});
|
|
@@ -278,6 +278,21 @@ async function main(argv: string[]): Promise<void> {
|
|
|
278
278
|
else await shots(config, options);
|
|
279
279
|
return;
|
|
280
280
|
}
|
|
281
|
+
if (options.command === "footage") {
|
|
282
|
+
const { runFootage } = await import("./footage.js");
|
|
283
|
+
await runFootage(config, options);
|
|
284
|
+
return;
|
|
285
|
+
}
|
|
286
|
+
if (options.command === "posts" && findVideo(config, options.filmId) === null) {
|
|
287
|
+
const { writeFootagePosts } = await import("./footage.js");
|
|
288
|
+
const footage = findFootage(config, options.filmId);
|
|
289
|
+
if (footage !== null) {
|
|
290
|
+
const path = writeFootagePosts(config, footage);
|
|
291
|
+
if (path === null) fail(`no post copy for "${footage.id}": add an entry with "video": "${footage.id}" to social.posts in ${config.file}.`);
|
|
292
|
+
console.log(`✓ ${path}: post copy`);
|
|
293
|
+
return;
|
|
294
|
+
}
|
|
295
|
+
}
|
|
281
296
|
if (options.command === "voice") {
|
|
282
297
|
// Every film is loaded before the first paid call, so a typo in the fifth id costs nothing.
|
|
283
298
|
const films: LoadedFilm[] = [];
|
package/src/cli/options.ts
CHANGED
|
@@ -8,7 +8,7 @@ import { DEFAULT_CONFIG_FILE, QUALITIES, screenshotSchema, type MarketingJson, t
|
|
|
8
8
|
* instead of from the given day.
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
export const COMMANDS = ["all", "voice", "record", "render", "preview", "posts", "og", "shots"] as const;
|
|
11
|
+
export const COMMANDS = ["all", "voice", "record", "render", "preview", "posts", "og", "shots", "footage"] as const;
|
|
12
12
|
|
|
13
13
|
export type Command = (typeof COMMANDS)[number];
|
|
14
14
|
|
|
@@ -19,13 +19,19 @@ const PLACEHOLDER_COMMANDS: readonly Command[] = ["all", "record", "render"];
|
|
|
19
19
|
const SHOTS_FLAGS = ["url", "config"];
|
|
20
20
|
/** `shots --page`: one page anywhere, its settings as flags; the same names as the entry's fields where they fit. */
|
|
21
21
|
const PAGE_FLAGS = ["page", "out", "expect", "width", "height", "scale", "full", "scroll", "wait", "motion", "scheme", "auth", "minbytes", "config"];
|
|
22
|
-
|
|
22
|
+
/** `footage <film>`: the footage film's steps, paid only with --commit, rehearsed with --placeholder. */
|
|
23
|
+
const FOOTAGE_FLAGS = ["step", "commit", "placeholder", "quality", "config"];
|
|
24
|
+
const KNOWN_FLAGS = [...new Set([...FILM_FLAGS, ...SHOTS_FLAGS, ...PAGE_FLAGS, ...FOOTAGE_FLAGS])];
|
|
25
|
+
/** The steps of `footage` that run alone; `all` (no --step) runs them in order. */
|
|
26
|
+
export const FOOTAGE_STEPS = ["transcribe", "cut", "render"] as const;
|
|
27
|
+
|
|
28
|
+
export type FootageStep = (typeof FOOTAGE_STEPS)[number] | "all";
|
|
23
29
|
/** The viewport of an ad-hoc shot without --width/--height: a common laptop screen (FIRE's screenshot script). */
|
|
24
30
|
export const PAGE_SHOT_VIEWPORT = { width: 1440, height: 900 } as const;
|
|
25
31
|
const FILM_ID = /^[a-z0-9]+(-[a-z0-9]+)*$/;
|
|
26
32
|
|
|
27
33
|
export interface FilmOptions {
|
|
28
|
-
command: Exclude<Command, "og" | "shots">;
|
|
34
|
+
command: Exclude<Command, "og" | "shots" | "footage">;
|
|
29
35
|
/** The first film named; the only one for every command but `voice`. */
|
|
30
36
|
filmId: string;
|
|
31
37
|
/** Every film named, in order; `voice` takes several, the other commands one. */
|
|
@@ -79,7 +85,20 @@ export interface PageShotsOptions {
|
|
|
79
85
|
|
|
80
86
|
export type ShotsOptions = EntryShotsOptions | PageShotsOptions;
|
|
81
87
|
|
|
82
|
-
|
|
88
|
+
/** `footage <film> [--step=transcribe|cut|render] [--commit] [--placeholder] [--quality=...]`. */
|
|
89
|
+
export interface FootageOptions {
|
|
90
|
+
command: "footage";
|
|
91
|
+
filmId: string;
|
|
92
|
+
step: FootageStep;
|
|
93
|
+
/** Only `--commit` lets the speech-to-text, voice isolation and music providers spend money. */
|
|
94
|
+
isCommit: boolean;
|
|
95
|
+
/** A free stand-in transcript from each clip's script, no isolation, no generated music. */
|
|
96
|
+
isPlaceholder: boolean;
|
|
97
|
+
quality?: Quality;
|
|
98
|
+
configPath: string;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export type CliOptions = FilmOptions | OgOptions | ShotsOptions | FootageOptions;
|
|
83
102
|
|
|
84
103
|
export type ReadOptionsResult = { ok: true; options: CliOptions } | { ok: false; error: string };
|
|
85
104
|
|
|
@@ -97,6 +116,8 @@ export const USAGE = [
|
|
|
97
116
|
" shots [<id>] [--url=...] the screenshots entries (or one), each behind its quality gates",
|
|
98
117
|
" shots --page=<url> --out=<file.png> --expect=<phrase> [--width --height --scale --full --scroll --wait",
|
|
99
118
|
" --motion --scheme --auth --minbytes] one page anywhere, behind the same gates; the app is not started",
|
|
119
|
+
" footage <film> [--step=transcribe|cut|render] [--commit] [--placeholder] [--quality=draft|standard|high]",
|
|
120
|
+
" a footage film from filmed clips; paid steps only with --commit, --placeholder rehearses for free",
|
|
100
121
|
].join("\n");
|
|
101
122
|
|
|
102
123
|
function isCommand(value: string | undefined): value is Command {
|
|
@@ -131,6 +152,7 @@ export function readOptions(argv: string[]): ReadOptionsResult {
|
|
|
131
152
|
if (configPath === "true" || configPath.length === 0) return { ok: false, error: `--config needs a path, e.g. --config=${DEFAULT_CONFIG_FILE}.` };
|
|
132
153
|
if (command === "og") return readOgOptions(positional, flags, configPath);
|
|
133
154
|
if (command === "shots") return readShotsOptions(positional, flags, configPath);
|
|
155
|
+
if (command === "footage") return readFootageOptions(positional, flags, configPath);
|
|
134
156
|
const notForFilms = [...flags.keys()].find((flag) => !FILM_FLAGS.includes(flag));
|
|
135
157
|
if (notForFilms !== undefined) return { ok: false, error: `--${notForFilms} applies to shots only, not to ${command}.` };
|
|
136
158
|
const filmId = positional[0];
|
|
@@ -162,6 +184,31 @@ export function readOptions(argv: string[]): ReadOptionsResult {
|
|
|
162
184
|
};
|
|
163
185
|
}
|
|
164
186
|
|
|
187
|
+
function isFootageStep(value: string): value is (typeof FOOTAGE_STEPS)[number] {
|
|
188
|
+
return FOOTAGE_STEPS.some((step) => step === value);
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
function readFootageOptions(positional: string[], flags: Map<string, string>, configPath: string): ReadOptionsResult {
|
|
192
|
+
const unknown = [...flags.keys()].find((flag) => !FOOTAGE_FLAGS.includes(flag));
|
|
193
|
+
if (unknown !== undefined) return { ok: false, error: `--${unknown} does not apply to footage. Known: ${FOOTAGE_FLAGS.map((flag) => `--${flag}`).join(", ")}.` };
|
|
194
|
+
const [filmId, ...extra] = positional;
|
|
195
|
+
if (filmId === undefined) return { ok: false, error: "name the footage film, e.g. softure-marketing footage <film>." };
|
|
196
|
+
if (extra.length > 0) return { ok: false, error: `one footage film at a time, got ${positional.join(", ")}.` };
|
|
197
|
+
if (!FILM_ID.test(filmId)) return { ok: false, error: `film name "${filmId}": lowercase letters, digits and hyphens only.` };
|
|
198
|
+
const stepFlag = flags.get("step");
|
|
199
|
+
if (stepFlag !== undefined && !isFootageStep(stepFlag)) return { ok: false, error: `--step=${stepFlag}: expected ${FOOTAGE_STEPS.join(" | ")}.` };
|
|
200
|
+
for (const name of ["commit", "placeholder"]) {
|
|
201
|
+
const value = flags.get(name);
|
|
202
|
+
if (value !== undefined && value !== "true") return { ok: false, error: `--${name} takes no value (got "${value}").` };
|
|
203
|
+
}
|
|
204
|
+
const isCommit = flags.get("commit") === "true";
|
|
205
|
+
const isPlaceholder = flags.get("placeholder") === "true";
|
|
206
|
+
if (isCommit && isPlaceholder) return { ok: false, error: "--commit and --placeholder exclude each other: a rehearsal never pays." };
|
|
207
|
+
const quality = flags.get("quality");
|
|
208
|
+
if (quality !== undefined && !isQuality(quality)) return { ok: false, error: `--quality=${quality}: expected ${QUALITIES.join(" | ")}.` };
|
|
209
|
+
return { ok: true, options: { command: "footage", filmId, step: stepFlag ?? "all", isCommit, isPlaceholder, quality, configPath } };
|
|
210
|
+
}
|
|
211
|
+
|
|
165
212
|
function readOgOptions(positional: string[], flags: Map<string, string>, configPath: string): ReadOptionsResult {
|
|
166
213
|
const extra = [...flags.keys()].filter((name) => name !== "config");
|
|
167
214
|
if (extra.length > 0) return { ok: false, error: `og takes only --config, got ${extra.map((flag) => `--${flag}`).join(", ")}.` };
|
package/src/compose/compose.ts
CHANGED
|
@@ -3,6 +3,7 @@ import type { SfxEvent } from "../config/schema.js";
|
|
|
3
3
|
import type { Film } from "../film.js";
|
|
4
4
|
import { formatMessage, type MarketingMessages } from "../messages/index.js";
|
|
5
5
|
import type { RecordingLog } from "../record/record.js";
|
|
6
|
+
import { escapeHtml, fontFaces, fontStack } from "./html.js";
|
|
6
7
|
import { BROWSER_BAR_HEIGHT, cameraPose, captionChunks, getTransitionSeconds, widePose, type CameraPose, type Geometry } from "./timeline.js";
|
|
7
8
|
import type { BeatVoice } from "../voice/voiceover.js";
|
|
8
9
|
|
|
@@ -126,27 +127,6 @@ function getHookBeat(film: Film): Film["beats"][number] {
|
|
|
126
127
|
return beat;
|
|
127
128
|
}
|
|
128
129
|
|
|
129
|
-
function escapeHtml(text: string): string {
|
|
130
|
-
return text.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">").replaceAll('"', """);
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
const FONT_FORMATS: Record<string, string> = { woff2: "woff2", woff: "woff", ttf: "truetype", otf: "opentype" };
|
|
134
|
-
|
|
135
|
-
function getFontFormat(src: string): string {
|
|
136
|
-
const extension = src.split(".").at(-1)?.toLowerCase() ?? "";
|
|
137
|
-
const format = FONT_FORMATS[extension];
|
|
138
|
-
if (format === undefined) throw new Error(`Font ${src}: expected a .woff2, .woff, .ttf or .otf file.`);
|
|
139
|
-
return format;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
function fontFaces(font: ComposeFont | null): string[] {
|
|
143
|
-
if (font === null) return [];
|
|
144
|
-
return font.faces.map((face) => {
|
|
145
|
-
const range = face.unicodeRange === null ? "" : `;unicode-range:${face.unicodeRange}`;
|
|
146
|
-
return `@font-face{font-family:"${font.family}";src:url("${face.src}") format("${getFontFormat(face.src)}");font-weight:${face.weight};font-style:${face.style}${range}}`;
|
|
147
|
-
});
|
|
148
|
-
}
|
|
149
|
-
|
|
150
130
|
/** The CSS and the opening markup of what stands around the screen: a phone's bezel or a browser window. */
|
|
151
131
|
function getWindowParts(geometry: Geometry, colors: BrandColors, address: string): { css: string; open: string } {
|
|
152
132
|
const { screen, screenHeight } = geometry;
|
|
@@ -170,10 +150,6 @@ function getWindowParts(geometry: Geometry, colors: BrandColors, address: string
|
|
|
170
150
|
};
|
|
171
151
|
}
|
|
172
152
|
|
|
173
|
-
function fontStack(font: ComposeFont | null, fallback: string): string {
|
|
174
|
-
return font === null ? fallback : `"${font.family}",${font.fallback}`;
|
|
175
|
-
}
|
|
176
|
-
|
|
177
153
|
/** The film's timeline derived from the recording and the voiceover: one place for every time. */
|
|
178
154
|
export function filmTimes(film: Film, log: RecordingLog, voices: BeatVoice[]) {
|
|
179
155
|
const voice = new Map(voices.map((v) => [v.id, v]));
|