@farazirfan/costar-server-executor 1.7.37 → 1.7.39

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.
Files changed (253) hide show
  1. package/dist/agent/agent.d.ts +90 -0
  2. package/dist/agent/agent.d.ts.map +1 -1
  3. package/dist/agent/agent.js +606 -0
  4. package/dist/agent/agent.js.map +1 -1
  5. package/dist/agent/pi-embedded-runner/run.d.ts.map +1 -1
  6. package/dist/agent/pi-embedded-runner/run.js +2 -1
  7. package/dist/agent/pi-embedded-runner/run.js.map +1 -1
  8. package/dist/agent/pi-embedded-runner/system-prompt.d.ts.map +1 -1
  9. package/dist/agent/pi-embedded-runner/system-prompt.js +16 -37
  10. package/dist/agent/pi-embedded-runner/system-prompt.js.map +1 -1
  11. package/dist/agent/pi-embedded-runner/tools.d.ts +4 -1
  12. package/dist/agent/pi-embedded-runner/tools.d.ts.map +1 -1
  13. package/dist/agent/pi-embedded-runner/tools.js +3 -1
  14. package/dist/agent/pi-embedded-runner/tools.js.map +1 -1
  15. package/dist/agent/pi-embedded-runner/types.d.ts +4 -0
  16. package/dist/agent/pi-embedded-runner/types.d.ts.map +1 -1
  17. package/dist/cli/env-loader.d.ts.map +1 -1
  18. package/dist/cli/env-loader.js +1 -0
  19. package/dist/cli/env-loader.js.map +1 -1
  20. package/dist/cli/setup.js +2 -2
  21. package/dist/cli/setup.js.map +1 -1
  22. package/dist/cron/normalize.d.ts +31 -0
  23. package/dist/cron/normalize.d.ts.map +1 -0
  24. package/dist/cron/normalize.js +211 -0
  25. package/dist/cron/normalize.js.map +1 -0
  26. package/dist/cron/scheduler.d.ts +33 -3
  27. package/dist/cron/scheduler.d.ts.map +1 -1
  28. package/dist/cron/scheduler.js +253 -48
  29. package/dist/cron/scheduler.js.map +1 -1
  30. package/dist/heartbeat/runner.d.ts +27 -12
  31. package/dist/heartbeat/runner.d.ts.map +1 -1
  32. package/dist/heartbeat/runner.js +82 -104
  33. package/dist/heartbeat/runner.js.map +1 -1
  34. package/dist/infra/heartbeat-events-filter.d.ts +29 -0
  35. package/dist/infra/heartbeat-events-filter.d.ts.map +1 -0
  36. package/dist/infra/heartbeat-events-filter.js +80 -0
  37. package/dist/infra/heartbeat-events-filter.js.map +1 -0
  38. package/dist/infra/index.d.ts +9 -0
  39. package/dist/infra/index.d.ts.map +1 -0
  40. package/dist/infra/index.js +9 -0
  41. package/dist/infra/index.js.map +1 -0
  42. package/dist/infra/system-events.d.ts +58 -2
  43. package/dist/infra/system-events.d.ts.map +1 -1
  44. package/dist/infra/system-events.js +80 -14
  45. package/dist/infra/system-events.js.map +1 -1
  46. package/dist/server.d.ts.map +1 -1
  47. package/dist/server.js +6 -1
  48. package/dist/server.js.map +1 -1
  49. package/dist/services/platform-keys.d.ts +19 -0
  50. package/dist/services/platform-keys.d.ts.map +1 -0
  51. package/dist/services/platform-keys.js +74 -0
  52. package/dist/services/platform-keys.js.map +1 -0
  53. package/dist/subagent/registry.d.ts +96 -0
  54. package/dist/subagent/registry.d.ts.map +1 -0
  55. package/dist/subagent/registry.js +180 -0
  56. package/dist/subagent/registry.js.map +1 -0
  57. package/dist/tools/complete-turn.d.ts +2 -2
  58. package/dist/tools/complete-turn.js +10 -10
  59. package/dist/tools/complete-turn.js.map +1 -1
  60. package/dist/tools/contacts.d.ts +13 -0
  61. package/dist/tools/contacts.d.ts.map +1 -0
  62. package/dist/tools/contacts.js +80 -0
  63. package/dist/tools/contacts.js.map +1 -0
  64. package/dist/tools/cron.d.ts +17 -2
  65. package/dist/tools/cron.d.ts.map +1 -1
  66. package/dist/tools/cron.js +117 -35
  67. package/dist/tools/cron.js.map +1 -1
  68. package/dist/tools/google-maps.d.ts +6 -6
  69. package/dist/tools/google-maps.d.ts.map +1 -1
  70. package/dist/tools/google-maps.js +207 -262
  71. package/dist/tools/google-maps.js.map +1 -1
  72. package/dist/tools/index.d.ts +17 -7
  73. package/dist/tools/index.d.ts.map +1 -1
  74. package/dist/tools/index.js +40 -9
  75. package/dist/tools/index.js.map +1 -1
  76. package/dist/tools/phone-call.d.ts +11 -0
  77. package/dist/tools/phone-call.d.ts.map +1 -0
  78. package/dist/tools/phone-call.js +151 -0
  79. package/dist/tools/phone-call.js.map +1 -0
  80. package/dist/tools/sessions-spawn.d.ts +33 -0
  81. package/dist/tools/sessions-spawn.d.ts.map +1 -0
  82. package/dist/tools/sessions-spawn.js +164 -0
  83. package/dist/tools/sessions-spawn.js.map +1 -0
  84. package/dist/tools/spotify.d.ts +12 -0
  85. package/dist/tools/spotify.d.ts.map +1 -0
  86. package/dist/tools/spotify.js +251 -0
  87. package/dist/tools/spotify.js.map +1 -0
  88. package/dist/tools/subagents.d.ts +23 -0
  89. package/dist/tools/subagents.d.ts.map +1 -0
  90. package/dist/tools/subagents.js +209 -0
  91. package/dist/tools/subagents.js.map +1 -0
  92. package/dist/tools/whatsapp.d.ts +13 -0
  93. package/dist/tools/whatsapp.d.ts.map +1 -0
  94. package/dist/tools/whatsapp.js +215 -0
  95. package/dist/tools/whatsapp.js.map +1 -0
  96. package/dist/tools/youtube.d.ts +12 -0
  97. package/dist/tools/youtube.d.ts.map +1 -0
  98. package/dist/tools/youtube.js +218 -0
  99. package/dist/tools/youtube.js.map +1 -0
  100. package/dist/utils/asterizk-auth.d.ts +43 -0
  101. package/dist/utils/asterizk-auth.d.ts.map +1 -0
  102. package/dist/utils/asterizk-auth.js +125 -0
  103. package/dist/utils/asterizk-auth.js.map +1 -0
  104. package/dist/web-server.d.ts.map +1 -1
  105. package/dist/web-server.js +132 -0
  106. package/dist/web-server.js.map +1 -1
  107. package/dist/workspace/index.d.ts +3 -4
  108. package/dist/workspace/index.d.ts.map +1 -1
  109. package/dist/workspace/index.js +3 -4
  110. package/dist/workspace/index.js.map +1 -1
  111. package/dist/workspace/templates.d.ts +8 -7
  112. package/dist/workspace/templates.d.ts.map +1 -1
  113. package/dist/workspace/templates.js +18 -127
  114. package/dist/workspace/templates.js.map +1 -1
  115. package/dist/workspace/workspace.d.ts +2 -4
  116. package/dist/workspace/workspace.d.ts.map +1 -1
  117. package/dist/workspace/workspace.js +7 -16
  118. package/dist/workspace/workspace.js.map +1 -1
  119. package/package.json +1 -1
  120. package/public/index.html +231 -0
  121. package/skills/docx/SKILL.md +468 -0
  122. package/skills/docx/scripts/__init__.py +1 -0
  123. package/skills/docx/scripts/accept_changes.py +181 -0
  124. package/skills/docx/scripts/comment.py +347 -0
  125. package/skills/docx/scripts/helpers/__init__.py +0 -0
  126. package/skills/docx/scripts/helpers/merge_runs.py +231 -0
  127. package/skills/docx/scripts/helpers/simplify_redlines.py +240 -0
  128. package/skills/docx/scripts/ooxml/schemas/ISO-IEC29500-4_2016/dml-chart.xsd +1499 -0
  129. package/skills/docx/scripts/ooxml/schemas/ISO-IEC29500-4_2016/dml-chartDrawing.xsd +146 -0
  130. package/skills/docx/scripts/ooxml/schemas/ISO-IEC29500-4_2016/dml-diagram.xsd +1085 -0
  131. package/skills/docx/scripts/ooxml/schemas/ISO-IEC29500-4_2016/dml-lockedCanvas.xsd +11 -0
  132. package/skills/docx/scripts/ooxml/schemas/ISO-IEC29500-4_2016/dml-main.xsd +3081 -0
  133. package/skills/docx/scripts/ooxml/schemas/ISO-IEC29500-4_2016/dml-picture.xsd +23 -0
  134. package/skills/docx/scripts/ooxml/schemas/ISO-IEC29500-4_2016/dml-spreadsheetDrawing.xsd +185 -0
  135. package/skills/docx/scripts/ooxml/schemas/ISO-IEC29500-4_2016/dml-wordprocessingDrawing.xsd +287 -0
  136. package/skills/docx/scripts/ooxml/schemas/ISO-IEC29500-4_2016/pml.xsd +1676 -0
  137. package/skills/docx/scripts/ooxml/schemas/ISO-IEC29500-4_2016/shared-additionalCharacteristics.xsd +28 -0
  138. package/skills/docx/scripts/ooxml/schemas/ISO-IEC29500-4_2016/shared-bibliography.xsd +144 -0
  139. package/skills/docx/scripts/ooxml/schemas/ISO-IEC29500-4_2016/shared-commonSimpleTypes.xsd +174 -0
  140. package/skills/docx/scripts/ooxml/schemas/ISO-IEC29500-4_2016/shared-customXmlDataProperties.xsd +25 -0
  141. package/skills/docx/scripts/ooxml/schemas/ISO-IEC29500-4_2016/shared-customXmlSchemaProperties.xsd +18 -0
  142. package/skills/docx/scripts/ooxml/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesCustom.xsd +59 -0
  143. package/skills/docx/scripts/ooxml/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesExtended.xsd +56 -0
  144. package/skills/docx/scripts/ooxml/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesVariantTypes.xsd +195 -0
  145. package/skills/docx/scripts/ooxml/schemas/ISO-IEC29500-4_2016/shared-math.xsd +582 -0
  146. package/skills/docx/scripts/ooxml/schemas/ISO-IEC29500-4_2016/shared-relationshipReference.xsd +25 -0
  147. package/skills/docx/scripts/ooxml/schemas/ISO-IEC29500-4_2016/sml.xsd +4439 -0
  148. package/skills/docx/scripts/ooxml/schemas/ISO-IEC29500-4_2016/vml-main.xsd +570 -0
  149. package/skills/docx/scripts/ooxml/schemas/ISO-IEC29500-4_2016/vml-officeDrawing.xsd +509 -0
  150. package/skills/docx/scripts/ooxml/schemas/ISO-IEC29500-4_2016/vml-presentationDrawing.xsd +12 -0
  151. package/skills/docx/scripts/ooxml/schemas/ISO-IEC29500-4_2016/vml-spreadsheetDrawing.xsd +108 -0
  152. package/skills/docx/scripts/ooxml/schemas/ISO-IEC29500-4_2016/vml-wordprocessingDrawing.xsd +96 -0
  153. package/skills/docx/scripts/ooxml/schemas/ISO-IEC29500-4_2016/wml.xsd +3646 -0
  154. package/skills/docx/scripts/ooxml/schemas/ISO-IEC29500-4_2016/xml.xsd +116 -0
  155. package/skills/docx/scripts/ooxml/schemas/ecma/fouth-edition/opc-contentTypes.xsd +42 -0
  156. package/skills/docx/scripts/ooxml/schemas/ecma/fouth-edition/opc-coreProperties.xsd +50 -0
  157. package/skills/docx/scripts/ooxml/schemas/ecma/fouth-edition/opc-digSig.xsd +49 -0
  158. package/skills/docx/scripts/ooxml/schemas/ecma/fouth-edition/opc-relationships.xsd +33 -0
  159. package/skills/docx/scripts/ooxml/schemas/mce/mc.xsd +75 -0
  160. package/skills/docx/scripts/ooxml/schemas/microsoft/wml-2010.xsd +560 -0
  161. package/skills/docx/scripts/ooxml/schemas/microsoft/wml-2012.xsd +67 -0
  162. package/skills/docx/scripts/ooxml/schemas/microsoft/wml-2018.xsd +14 -0
  163. package/skills/docx/scripts/ooxml/schemas/microsoft/wml-cex-2018.xsd +20 -0
  164. package/skills/docx/scripts/ooxml/schemas/microsoft/wml-cid-2016.xsd +13 -0
  165. package/skills/docx/scripts/ooxml/schemas/microsoft/wml-sdtdatahash-2020.xsd +4 -0
  166. package/skills/docx/scripts/ooxml/schemas/microsoft/wml-symex-2015.xsd +8 -0
  167. package/skills/docx/scripts/ooxml/scripts/pack.py +159 -0
  168. package/skills/docx/scripts/ooxml/scripts/unpack.py +29 -0
  169. package/skills/docx/scripts/ooxml/scripts/validate.py +106 -0
  170. package/skills/docx/scripts/ooxml/scripts/validation/__init__.py +15 -0
  171. package/skills/docx/scripts/ooxml/scripts/validation/base.py +1023 -0
  172. package/skills/docx/scripts/ooxml/scripts/validation/docx.py +519 -0
  173. package/skills/docx/scripts/ooxml/scripts/validation/pptx.py +315 -0
  174. package/skills/docx/scripts/ooxml/scripts/validation/redlining.py +284 -0
  175. package/skills/docx/scripts/pack.py +166 -0
  176. package/skills/docx/scripts/templates/comments.xml +3 -0
  177. package/skills/docx/scripts/templates/commentsExtended.xml +3 -0
  178. package/skills/docx/scripts/templates/commentsExtensible.xml +3 -0
  179. package/skills/docx/scripts/templates/commentsIds.xml +3 -0
  180. package/skills/docx/scripts/templates/people.xml +3 -0
  181. package/skills/docx/scripts/unpack.py +134 -0
  182. package/skills/longform-video-generation/SKILL.md +298 -0
  183. package/skills/longform-video-generation/references/advanced_techniques.md +474 -0
  184. package/skills/longform-video-generation/references/google_api_guide.md +288 -0
  185. package/skills/longform-video-generation/scripts/video_generator.py +579 -0
  186. package/skills/pdf/FORMS.md +305 -0
  187. package/skills/pdf/REFERENCE.md +612 -0
  188. package/skills/pdf/SKILL.md +293 -0
  189. package/skills/pdf/scripts/check_bounding_boxes.py +70 -0
  190. package/skills/pdf/scripts/check_fillable_fields.py +12 -0
  191. package/skills/pdf/scripts/convert_pdf_to_images.py +35 -0
  192. package/skills/pdf/scripts/create_validation_image.py +41 -0
  193. package/skills/pdf/scripts/extract_form_field_info.py +152 -0
  194. package/skills/pdf/scripts/extract_form_structure.py +124 -0
  195. package/skills/pdf/scripts/fill_fillable_fields.py +116 -0
  196. package/skills/pdf/scripts/fill_pdf_form_with_annotations.py +136 -0
  197. package/skills/pptx/SKILL.md +171 -0
  198. package/skills/pptx/editing.md +205 -0
  199. package/skills/pptx/pptxgenjs.md +377 -0
  200. package/skills/pptx/scripts/add_slide.py +225 -0
  201. package/skills/pptx/scripts/clean.py +309 -0
  202. package/skills/pptx/scripts/ooxml/schemas/ISO-IEC29500-4_2016/dml-chart.xsd +1499 -0
  203. package/skills/pptx/scripts/ooxml/schemas/ISO-IEC29500-4_2016/dml-chartDrawing.xsd +146 -0
  204. package/skills/pptx/scripts/ooxml/schemas/ISO-IEC29500-4_2016/dml-diagram.xsd +1085 -0
  205. package/skills/pptx/scripts/ooxml/schemas/ISO-IEC29500-4_2016/dml-lockedCanvas.xsd +11 -0
  206. package/skills/pptx/scripts/ooxml/schemas/ISO-IEC29500-4_2016/dml-main.xsd +3081 -0
  207. package/skills/pptx/scripts/ooxml/schemas/ISO-IEC29500-4_2016/dml-picture.xsd +23 -0
  208. package/skills/pptx/scripts/ooxml/schemas/ISO-IEC29500-4_2016/dml-spreadsheetDrawing.xsd +185 -0
  209. package/skills/pptx/scripts/ooxml/schemas/ISO-IEC29500-4_2016/dml-wordprocessingDrawing.xsd +287 -0
  210. package/skills/pptx/scripts/ooxml/schemas/ISO-IEC29500-4_2016/pml.xsd +1676 -0
  211. package/skills/pptx/scripts/ooxml/schemas/ISO-IEC29500-4_2016/shared-additionalCharacteristics.xsd +28 -0
  212. package/skills/pptx/scripts/ooxml/schemas/ISO-IEC29500-4_2016/shared-bibliography.xsd +144 -0
  213. package/skills/pptx/scripts/ooxml/schemas/ISO-IEC29500-4_2016/shared-commonSimpleTypes.xsd +174 -0
  214. package/skills/pptx/scripts/ooxml/schemas/ISO-IEC29500-4_2016/shared-customXmlDataProperties.xsd +25 -0
  215. package/skills/pptx/scripts/ooxml/schemas/ISO-IEC29500-4_2016/shared-customXmlSchemaProperties.xsd +18 -0
  216. package/skills/pptx/scripts/ooxml/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesCustom.xsd +59 -0
  217. package/skills/pptx/scripts/ooxml/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesExtended.xsd +56 -0
  218. package/skills/pptx/scripts/ooxml/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesVariantTypes.xsd +195 -0
  219. package/skills/pptx/scripts/ooxml/schemas/ISO-IEC29500-4_2016/shared-math.xsd +582 -0
  220. package/skills/pptx/scripts/ooxml/schemas/ISO-IEC29500-4_2016/shared-relationshipReference.xsd +25 -0
  221. package/skills/pptx/scripts/ooxml/schemas/ISO-IEC29500-4_2016/sml.xsd +4439 -0
  222. package/skills/pptx/scripts/ooxml/schemas/ISO-IEC29500-4_2016/vml-main.xsd +570 -0
  223. package/skills/pptx/scripts/ooxml/schemas/ISO-IEC29500-4_2016/vml-officeDrawing.xsd +509 -0
  224. package/skills/pptx/scripts/ooxml/schemas/ISO-IEC29500-4_2016/vml-presentationDrawing.xsd +12 -0
  225. package/skills/pptx/scripts/ooxml/schemas/ISO-IEC29500-4_2016/vml-spreadsheetDrawing.xsd +108 -0
  226. package/skills/pptx/scripts/ooxml/schemas/ISO-IEC29500-4_2016/vml-wordprocessingDrawing.xsd +96 -0
  227. package/skills/pptx/scripts/ooxml/schemas/ISO-IEC29500-4_2016/wml.xsd +3646 -0
  228. package/skills/pptx/scripts/ooxml/schemas/ISO-IEC29500-4_2016/xml.xsd +116 -0
  229. package/skills/pptx/scripts/ooxml/schemas/ecma/fouth-edition/opc-contentTypes.xsd +42 -0
  230. package/skills/pptx/scripts/ooxml/schemas/ecma/fouth-edition/opc-coreProperties.xsd +50 -0
  231. package/skills/pptx/scripts/ooxml/schemas/ecma/fouth-edition/opc-digSig.xsd +49 -0
  232. package/skills/pptx/scripts/ooxml/schemas/ecma/fouth-edition/opc-relationships.xsd +33 -0
  233. package/skills/pptx/scripts/ooxml/schemas/mce/mc.xsd +75 -0
  234. package/skills/pptx/scripts/ooxml/schemas/microsoft/wml-2010.xsd +560 -0
  235. package/skills/pptx/scripts/ooxml/schemas/microsoft/wml-2012.xsd +67 -0
  236. package/skills/pptx/scripts/ooxml/schemas/microsoft/wml-2018.xsd +14 -0
  237. package/skills/pptx/scripts/ooxml/schemas/microsoft/wml-cex-2018.xsd +20 -0
  238. package/skills/pptx/scripts/ooxml/schemas/microsoft/wml-cid-2016.xsd +13 -0
  239. package/skills/pptx/scripts/ooxml/schemas/microsoft/wml-sdtdatahash-2020.xsd +4 -0
  240. package/skills/pptx/scripts/ooxml/schemas/microsoft/wml-symex-2015.xsd +8 -0
  241. package/skills/pptx/scripts/ooxml/scripts/pack.py +159 -0
  242. package/skills/pptx/scripts/ooxml/scripts/unpack.py +29 -0
  243. package/skills/pptx/scripts/ooxml/scripts/validate.py +106 -0
  244. package/skills/pptx/scripts/ooxml/scripts/validation/__init__.py +15 -0
  245. package/skills/pptx/scripts/ooxml/scripts/validation/base.py +1023 -0
  246. package/skills/pptx/scripts/ooxml/scripts/validation/docx.py +519 -0
  247. package/skills/pptx/scripts/ooxml/scripts/validation/pptx.py +315 -0
  248. package/skills/pptx/scripts/ooxml/scripts/validation/redlining.py +284 -0
  249. package/skills/pptx/scripts/pack.py +168 -0
  250. package/skills/pptx/scripts/thumbnail.py +318 -0
  251. package/skills/pptx/scripts/unpack.py +86 -0
  252. package/skills/xlsx/SKILL.md +291 -0
  253. package/skills/xlsx/recalc.py +247 -0
@@ -0,0 +1,474 @@
1
+ # Advanced Techniques for Veo 3 Video Generation
2
+
3
+ Advanced workflows and techniques for creating professional-quality long-form videos.
4
+
5
+ ## Custom Transitions
6
+
7
+ ### Crossfade Transitions with FFmpeg
8
+
9
+ ```python
10
+ def add_crossfade_transitions(video_paths, output_path, fade_duration=0.5):
11
+ """Add smooth crossfade between clips."""
12
+
13
+ if len(video_paths) < 2:
14
+ return video_paths[0]
15
+
16
+ # Build filter complex
17
+ inputs = []
18
+ filters = []
19
+
20
+ for i, path in enumerate(video_paths):
21
+ inputs.extend(['-i', path])
22
+
23
+ # Create xfade filters
24
+ current = '[0:v]'
25
+ for i in range(len(video_paths) - 1):
26
+ next_input = f'[{i+1}:v]'
27
+ output = f'[v{i}]' if i < len(video_paths) - 2 else '[vout]'
28
+
29
+ # Calculate offset
30
+ probe = ffmpeg.probe(video_paths[i])
31
+ duration = float(probe['streams'][0]['duration'])
32
+ offset = duration - fade_duration
33
+
34
+ filters.append(
35
+ f'{current}{next_input}xfade=transition=fade:'
36
+ f'duration={fade_duration}:offset={offset}{output}'
37
+ )
38
+ current = output
39
+
40
+ # Execute
41
+ cmd = ['ffmpeg'] + inputs + [
42
+ '-filter_complex', ';'.join(filters),
43
+ '-map', '[vout]',
44
+ '-y', output_path
45
+ ]
46
+
47
+ subprocess.run(cmd, check=True)
48
+ return output_path
49
+ ```
50
+
51
+ ### Other Transition Types
52
+
53
+ FFmpeg xfade supports many transitions:
54
+ - `fade` - Simple crossfade
55
+ - `wipeleft`, `wiperight`, `wipeup`, `wipedown` - Directional wipes
56
+ - `slideleft`, `slideright` - Slide transitions
57
+ - `dissolve` - Dissolve effect
58
+ - `pixelize` - Pixelation transition
59
+
60
+ ## Batch Processing
61
+
62
+ ### Process Multiple Projects
63
+
64
+ ```python
65
+ def batch_generate_projects(projects):
66
+ """Generate multiple video projects in sequence."""
67
+
68
+ results = []
69
+
70
+ for project in projects:
71
+ try:
72
+ video_path = generate_longform_video(
73
+ scenes=project['scenes'],
74
+ output_filename=f"{project['name']}.mp4",
75
+ use_frame_chaining=True
76
+ )
77
+
78
+ results.append({
79
+ 'name': project['name'],
80
+ 'status': 'success',
81
+ 'path': video_path
82
+ })
83
+
84
+ except Exception as e:
85
+ results.append({
86
+ 'name': project['name'],
87
+ 'status': 'failed',
88
+ 'error': str(e)
89
+ })
90
+
91
+ return results
92
+
93
+ # Usage
94
+ projects = [
95
+ {
96
+ 'name': 'product_demo_1',
97
+ 'scenes': [...]
98
+ },
99
+ {
100
+ 'name': 'product_demo_2',
101
+ 'scenes': [...]
102
+ }
103
+ ]
104
+
105
+ results = batch_generate_projects(projects)
106
+ ```
107
+
108
+ ### Parallel Processing (with Rate Limiting)
109
+
110
+ ```python
111
+ import concurrent.futures
112
+ import time
113
+ from threading import Lock
114
+
115
+ rate_limit_lock = Lock()
116
+ last_request_time = 0
117
+ MIN_REQUEST_INTERVAL = 6 # seconds (10 requests per minute)
118
+
119
+ def rate_limited_generate(scene, scene_num):
120
+ """Generate with rate limiting."""
121
+ global last_request_time
122
+
123
+ with rate_limit_lock:
124
+ current_time = time.time()
125
+ elapsed = current_time - last_request_time
126
+
127
+ if elapsed < MIN_REQUEST_INTERVAL:
128
+ time.sleep(MIN_REQUEST_INTERVAL - elapsed)
129
+
130
+ last_request_time = time.time()
131
+
132
+ # Generate video
133
+ return generate_single_video(scene, scene_num)
134
+
135
+ def parallel_generate(scenes, max_workers=2):
136
+ """Generate multiple scenes in parallel with rate limiting."""
137
+
138
+ with concurrent.futures.ThreadPoolExecutor(max_workers=max_workers) as executor:
139
+ futures = [
140
+ executor.submit(rate_limited_generate, scene, i)
141
+ for i, scene in enumerate(scenes)
142
+ ]
143
+
144
+ results = [f.result() for f in concurrent.futures.as_completed(futures)]
145
+
146
+ return results
147
+ ```
148
+
149
+ ## Character Consistency Patterns
150
+
151
+ ### Using Character Templates
152
+
153
+ ```python
154
+ class CharacterTemplate:
155
+ """Template for maintaining character consistency."""
156
+
157
+ def __init__(self, name, age, appearance, clothing, style):
158
+ self.name = name
159
+ self.age = age
160
+ self.appearance = appearance
161
+ self.clothing = clothing
162
+ self.style = style
163
+
164
+ def get_description(self):
165
+ """Get full character description."""
166
+ return (
167
+ f"{self.name}, {self.age}, "
168
+ f"{self.appearance}, "
169
+ f"wearing {self.clothing}"
170
+ )
171
+
172
+ def create_scene_prompt(self, action):
173
+ """Create scene prompt with character."""
174
+ return f"{self.get_description()}, {self.style}. {action}"
175
+
176
+ # Usage
177
+ character = CharacterTemplate(
178
+ name="Sarah",
179
+ age="25 years old",
180
+ appearance="shoulder-length dark hair, warm brown eyes",
181
+ clothing="red leather jacket and blue jeans",
182
+ style="cinematic lighting, 35mm lens, golden hour"
183
+ )
184
+
185
+ scenes = [
186
+ character.create_scene_prompt("Walking through park"),
187
+ character.create_scene_prompt("Sitting on bench"),
188
+ character.create_scene_prompt("Looking at phone")
189
+ ]
190
+ ```
191
+
192
+ ### Style Anchoring
193
+
194
+ ```python
195
+ class StyleAnchor:
196
+ """Maintain consistent visual style across scenes."""
197
+
198
+ def __init__(self):
199
+ self.lighting = None
200
+ self.camera = None
201
+ self.color_grade = None
202
+ self.mood = None
203
+
204
+ def set_style(self, lighting, camera, color_grade, mood):
205
+ self.lighting = lighting
206
+ self.camera = camera
207
+ self.color_grade = color_grade
208
+ self.mood = mood
209
+
210
+ def apply_to_prompt(self, base_prompt):
211
+ """Apply style to any prompt."""
212
+ style_str = ", ".join([
213
+ self.lighting,
214
+ self.camera,
215
+ self.color_grade,
216
+ self.mood
217
+ ])
218
+ return f"{base_prompt}, {style_str}"
219
+
220
+ # Usage
221
+ style = StyleAnchor()
222
+ style.set_style(
223
+ lighting="soft natural light",
224
+ camera="handheld 35mm",
225
+ color_grade="warm tones",
226
+ mood="nostalgic atmosphere"
227
+ )
228
+
229
+ prompt = "Woman walking through field"
230
+ styled_prompt = style.apply_to_prompt(prompt)
231
+ # Result: "Woman walking through field, soft natural light, handheld 35mm, warm tones, nostalgic atmosphere"
232
+ ```
233
+
234
+ ## Quality Control
235
+
236
+ ### Automatic Quality Checks
237
+
238
+ ```python
239
+ def check_video_quality(video_path):
240
+ """Check video for quality issues."""
241
+
242
+ issues = []
243
+
244
+ # Check duration
245
+ probe = ffmpeg.probe(video_path)
246
+ duration = float(probe['streams'][0]['duration'])
247
+
248
+ if duration < 7:
249
+ issues.append("Video too short (< 7s)")
250
+
251
+ # Check resolution
252
+ width = probe['streams'][0]['width']
253
+ height = probe['streams'][0]['height']
254
+
255
+ if width < 1280:
256
+ issues.append(f"Low resolution: {width}x{height}")
257
+
258
+ # Check for audio
259
+ audio_streams = [s for s in probe['streams'] if s['codec_type'] == 'audio']
260
+ if not audio_streams:
261
+ issues.append("No audio track found")
262
+
263
+ # Check file size
264
+ file_size = os.path.getsize(video_path)
265
+ if file_size < 100000: # < 100KB
266
+ issues.append("File suspiciously small")
267
+
268
+ return issues
269
+
270
+ # Usage
271
+ issues = check_video_quality("scene_001.mp4")
272
+ if issues:
273
+ print(f"⚠️ Quality issues: {issues}")
274
+ # Regenerate or adjust
275
+ ```
276
+
277
+ ### Frame Similarity Check
278
+
279
+ ```python
280
+ import cv2
281
+ import numpy as np
282
+
283
+ def check_frame_continuity(video1_path, video2_path):
284
+ """Check if last frame of video1 matches first frame of video2."""
285
+
286
+ # Extract frames
287
+ cap1 = cv2.VideoCapture(video1_path)
288
+ cap1.set(cv2.CAP_PROP_POS_AVI_RATIO, 1) # Go to end
289
+ ret1, frame1 = cap1.read()
290
+
291
+ cap2 = cv2.VideoCapture(video2_path)
292
+ ret2, frame2 = cap2.read()
293
+
294
+ if not (ret1 and ret2):
295
+ return False
296
+
297
+ # Calculate similarity (structural similarity)
298
+ gray1 = cv2.cvtColor(frame1, cv2.COLOR_BGR2GRAY)
299
+ gray2 = cv2.cvtColor(frame2, cv2.COLOR_BGR2GRAY)
300
+
301
+ # Resize to same size if needed
302
+ if gray1.shape != gray2.shape:
303
+ gray2 = cv2.resize(gray2, (gray1.shape[1], gray1.shape[0]))
304
+
305
+ # Calculate MSE (Mean Squared Error)
306
+ mse = np.mean((gray1 - gray2) ** 2)
307
+
308
+ # Low MSE means high similarity
309
+ return mse < 1000 # Threshold may need tuning
310
+ ```
311
+
312
+ ## Cost Optimization
313
+
314
+ ### Preview Mode (Lower Cost Testing)
315
+
316
+ ```python
317
+ def generate_preview(scenes, output_filename="preview.mp4"):
318
+ """Generate preview with every Nth scene only."""
319
+
320
+ # Sample scenes (e.g., every 3rd scene)
321
+ preview_scenes = scenes[::3]
322
+
323
+ print(f"📊 Generating preview with {len(preview_scenes)}/{len(scenes)} scenes")
324
+
325
+ return generate_longform_video(
326
+ scenes=preview_scenes,
327
+ output_filename=output_filename,
328
+ use_frame_chaining=False # Faster, lower quality
329
+ )
330
+ ```
331
+
332
+ ### Caching Strategy
333
+
334
+ ```python
335
+ import hashlib
336
+ import pickle
337
+
338
+ def get_cache_key(prompt, reference_image=None):
339
+ """Generate cache key for a scene."""
340
+ data = f"{prompt}:{reference_image or ''}"
341
+ return hashlib.md5(data.encode()).hexdigest()
342
+
343
+ def cache_video(key, video_path, cache_dir="./cache"):
344
+ """Cache a generated video."""
345
+ os.makedirs(cache_dir, exist_ok=True)
346
+ cache_path = os.path.join(cache_dir, f"{key}.mp4")
347
+ subprocess.run(["cp", video_path, cache_path], check=True)
348
+
349
+ def get_cached_video(key, cache_dir="./cache"):
350
+ """Retrieve cached video if exists."""
351
+ cache_path = os.path.join(cache_dir, f"{key}.mp4")
352
+ return cache_path if os.path.exists(cache_path) else None
353
+
354
+ # Usage in generation workflow
355
+ def generate_with_cache(prompt, reference_image=None):
356
+ key = get_cache_key(prompt, reference_image)
357
+
358
+ # Check cache
359
+ cached = get_cached_video(key)
360
+ if cached:
361
+ print(f"✅ Using cached video for: {prompt[:50]}...")
362
+ return cached
363
+
364
+ # Generate
365
+ video = generate_single_video(prompt, reference_image)
366
+
367
+ # Cache result
368
+ cache_video(key, video)
369
+
370
+ return video
371
+ ```
372
+
373
+ ## Integration with Other Tools
374
+
375
+ ### Export to Editing Software
376
+
377
+ ```python
378
+ def export_edl(scenes, output_path="timeline.edl"):
379
+ """Export Edit Decision List for professional editing software."""
380
+
381
+ with open(output_path, 'w') as f:
382
+ f.write("TITLE: Veo 3 Generated Sequence\n")
383
+ f.write("FCM: NON-DROP FRAME\n\n")
384
+
385
+ timecode = 0
386
+
387
+ for i, scene in enumerate(scenes):
388
+ source_in = "00:00:00:00"
389
+ source_out = "00:00:08:00" # 8 seconds
390
+
391
+ rec_in = f"{timecode//3600:02d}:{(timecode%3600)//60:02d}:{timecode%60:02d}:00"
392
+ timecode += 8
393
+ rec_out = f"{timecode//3600:02d}:{(timecode%3600)//60:02d}:{timecode%60:02d}:00"
394
+
395
+ f.write(f"{i+1:03d} scene_{i+1:03d} V C "
396
+ f"{source_in} {source_out} {rec_in} {rec_out}\n")
397
+ ```
398
+
399
+ ### Add Subtitles/Captions
400
+
401
+ ```python
402
+ def add_subtitles(video_path, subtitle_text, output_path):
403
+ """Burn subtitles into video."""
404
+
405
+ # Create SRT file
406
+ srt_path = video_path.replace('.mp4', '.srt')
407
+ with open(srt_path, 'w') as f:
408
+ f.write("1\n")
409
+ f.write("00:00:00,000 --> 00:00:08,000\n")
410
+ f.write(f"{subtitle_text}\n")
411
+
412
+ # Burn into video
413
+ subprocess.run([
414
+ 'ffmpeg',
415
+ '-i', video_path,
416
+ '-vf', f"subtitles={srt_path}",
417
+ '-y', output_path
418
+ ], check=True)
419
+ ```
420
+
421
+ ## Production Workflow Template
422
+
423
+ ```python
424
+ class VideoProduction:
425
+ """Complete production workflow manager."""
426
+
427
+ def __init__(self, project_name):
428
+ self.project_name = project_name
429
+ self.scenes = []
430
+ self.character = None
431
+ self.style = None
432
+
433
+ def set_character(self, description):
434
+ self.character = description
435
+
436
+ def set_style(self, style):
437
+ self.style = style
438
+
439
+ def add_scene(self, action):
440
+ prompt = f"{self.character}, {self.style}. {action}"
441
+ self.scenes.append(prompt)
442
+
443
+ def generate_preview(self):
444
+ """Generate low-cost preview."""
445
+ preview_scenes = self.scenes[::3]
446
+ return generate_longform_video(
447
+ preview_scenes,
448
+ f"{self.project_name}_preview.mp4"
449
+ )
450
+
451
+ def generate_final(self):
452
+ """Generate final high-quality video."""
453
+ return generate_longform_video(
454
+ self.scenes,
455
+ f"{self.project_name}_final.mp4",
456
+ use_frame_chaining=True,
457
+ add_transitions=True
458
+ )
459
+
460
+ # Usage
461
+ project = VideoProduction("corporate_intro")
462
+ project.set_character("Professional woman in business attire")
463
+ project.set_style("corporate, clean lighting, modern")
464
+
465
+ project.add_scene("Walking into office building")
466
+ project.add_scene("Greeting receptionist")
467
+ project.add_scene("Entering conference room")
468
+
469
+ # Test with preview
470
+ preview = project.generate_preview()
471
+
472
+ # If approved, generate final
473
+ final = project.generate_final()
474
+ ```