catalog.ts 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. import { defineCatalog } from "@json-render/core";
  2. import {
  3. schema,
  4. standardComponentDefinitions,
  5. standardTransitionDefinitions,
  6. standardEffectDefinitions,
  7. } from "@json-render/remotion/server";
  8. /**
  9. * Custom rules for the AI to follow when generating videos
  10. */
  11. const customRules = [
  12. // Image URLs using Picsum (free, no API key)
  13. 'ImageSlide props: { "src": "https://picsum.photos/1920/1080?random=N", "alt": "description" } - use "src" NOT "imageUrl"',
  14. "Use different random numbers for each image to get different photos (e.g., ?random=1, ?random=2, ?random=3)",
  15. "Picsum provides random professional stock photos - great for product shots, backgrounds, and visual content",
  16. ];
  17. /**
  18. * Remotion video catalog
  19. *
  20. * Uses standard definitions from @json-render/remotion,
  21. * with the ability to add custom components.
  22. *
  23. * @example Adding a custom component:
  24. * ```ts
  25. * components: {
  26. * ...standardComponentDefinitions,
  27. * MyCustomComponent: {
  28. * props: z.object({ ... }),
  29. * type: "scene",
  30. * defaultDuration: 90,
  31. * description: "My custom component",
  32. * },
  33. * },
  34. * ```
  35. */
  36. export const videoCatalog = defineCatalog(schema, {
  37. // Use all standard components from the package
  38. components: standardComponentDefinitions,
  39. // Use all standard transitions from the package
  40. transitions: standardTransitionDefinitions,
  41. // Use all standard effects from the package
  42. effects: standardEffectDefinitions,
  43. });
  44. /**
  45. * Get the prompt with custom rules for image generation
  46. */
  47. export function getVideoPrompt(): string {
  48. return videoCatalog.prompt({ customRules });
  49. }