feat(render+templates): Remotion engine, 16 branded templates (incl. 3D), seconds pricing, coming-soon
Render engine - Add Remotion (code-based) as a 2nd render engine alongside After Effects. node-agent dispatches on Job.Engine; RunRemotion maps bindings -> --props, renders native then ffmpeg-scales to the quality tier (aspect-preserving). - content.projects.render_engine + render_remotion_comp (migration 32); render-svc claim resolves engine and routes (skips .aep for Remotion). - Admin TemplatesAdmin gains an engine picker + Remotion composition id field. Template pack (services/remotion) - 16 branded, Persian (Vazirmatn), color- and text-editable templates, each in 3 aspects (16:9 / 1:1 / 9:16): LogoMotion, Opener, InstaPromo, YouTubeIntro, Slideshow, HappyBirthday, SalePromo, QuoteCard, EventInvite, Countdown, GlitterReveal (editable logo image), NowruzGreeting (animated characters), and 4 cinematic 3D templates via @remotion/three (Hero3D, Nowruz3D, Birthday3D, Promo3D) with reflections + bloom/DOF/vignette. - scripts/seed_remotion_templates.py seeds containers/projects/scenes/colors. Pricing - Rewrite /pricing to the seconds-based model (charge = length x resolution), data-driven from /v1/plans, Toman, broker checkout. Coming-soon - Persian experimental-build overlay on all pages (launch date + countdown). Fixes - middleware matcher bypasses all static asset paths; catalog mapping passes cover image + preview video so real thumbnails render. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -666,6 +666,42 @@ func (s *Store) GetTemplateCompName(ctx context.Context, originalProjectID uuid.
|
||||
return *comp, nil
|
||||
}
|
||||
|
||||
// TemplateRenderConfig describes how a template should be rendered.
|
||||
type TemplateRenderConfig struct {
|
||||
// Engine is "AfterEffects" or "Remotion".
|
||||
Engine string
|
||||
// CompName is the composition to render: render_aep_comp for AE, or
|
||||
// render_remotion_comp for Remotion.
|
||||
CompName string
|
||||
}
|
||||
|
||||
// GetTemplateRenderConfig resolves the render engine + composition for a template.
|
||||
// For Remotion templates the composition id comes from render_remotion_comp; for
|
||||
// After Effects it comes from render_aep_comp. Defaults to AfterEffects when the
|
||||
// render_engine column is missing/empty (older rows pre-migration).
|
||||
func (s *Store) GetTemplateRenderConfig(ctx context.Context, originalProjectID uuid.UUID) (TemplateRenderConfig, error) {
|
||||
var engine *string
|
||||
var aepComp, remotionComp *string
|
||||
err := s.pool.QueryRow(ctx,
|
||||
`SELECT render_engine, render_aep_comp, render_remotion_comp
|
||||
FROM content.projects WHERE id = $1`, originalProjectID).Scan(&engine, &aepComp, &remotionComp)
|
||||
if err != nil {
|
||||
return TemplateRenderConfig{}, err
|
||||
}
|
||||
cfg := TemplateRenderConfig{Engine: "AfterEffects"}
|
||||
if engine != nil && *engine != "" {
|
||||
cfg.Engine = *engine
|
||||
}
|
||||
if cfg.Engine == "Remotion" {
|
||||
if remotionComp != nil {
|
||||
cfg.CompName = *remotionComp
|
||||
}
|
||||
} else if aepComp != nil {
|
||||
cfg.CompName = *aepComp
|
||||
}
|
||||
return cfg, nil
|
||||
}
|
||||
|
||||
// GetRenderBindings returns the user's edited input values for a saved project so the
|
||||
// node can write them into the AE project before rendering (the render binder). Only
|
||||
// inputs with a non-empty value are returned (defaults are already in the template).
|
||||
|
||||
@@ -282,10 +282,14 @@ func (h *InternalHandler) Claim(c *gin.Context) {
|
||||
// and reused by every render of that template. A .zip is a full AE project
|
||||
// bundle (.aep + footage/fonts) the node must extract before rendering.
|
||||
// Errors are non-fatal — the node agent falls back to mock render when URL is empty.
|
||||
// Resolve the render engine + composition for this template. Remotion
|
||||
// templates are code-based and need no .aep download.
|
||||
rcfg, _ := h.store.GetTemplateRenderConfig(c.Request.Context(), job.OriginalProjectID)
|
||||
|
||||
aepURL := ""
|
||||
isBundle := false
|
||||
bundleMD5 := ""
|
||||
if h.minio != nil {
|
||||
if rcfg.Engine != "Remotion" && h.minio != nil {
|
||||
candidates := []struct {
|
||||
name string
|
||||
bundle bool
|
||||
@@ -311,11 +315,12 @@ func (h *InternalHandler) Claim(c *gin.Context) {
|
||||
}
|
||||
}
|
||||
|
||||
// Composition to render (-comp). Non-fatal: empty → node uses the render queue.
|
||||
compName, _ := h.store.GetTemplateCompName(c.Request.Context(), job.OriginalProjectID)
|
||||
// Composition to render: AE comp (-comp) or the Remotion composition id.
|
||||
// Non-fatal: empty → AE node uses the render queue.
|
||||
compName := rcfg.CompName
|
||||
|
||||
// User's edited input values → the node writes them into the AE project before
|
||||
// rendering (render binder). Non-fatal: empty → renders template defaults.
|
||||
// rendering, or passes them as Remotion --props. Non-fatal: empty → template defaults.
|
||||
bindings, _ := h.store.GetRenderBindings(c.Request.Context(), job.SavedProjectID)
|
||||
|
||||
c.JSON(http.StatusOK, models.ClaimedJob{
|
||||
@@ -326,6 +331,7 @@ func (h *InternalHandler) Claim(c *gin.Context) {
|
||||
FrameRate: job.FrameRate,
|
||||
HasMusic: job.HasMusic,
|
||||
HasVoiceover: job.HasVoiceover,
|
||||
Engine: rcfg.Engine,
|
||||
AEPDownloadURL: aepURL,
|
||||
IsBundle: isBundle,
|
||||
BundleMD5: bundleMD5,
|
||||
|
||||
@@ -422,6 +422,9 @@ type ClaimedJob struct {
|
||||
FrameRate int `json:"frame_rate"`
|
||||
HasMusic bool `json:"has_music"`
|
||||
HasVoiceover bool `json:"has_voiceover"`
|
||||
// Engine selects the render engine: "AfterEffects" (default) or "Remotion".
|
||||
// For Remotion jobs CompName is the composition id and AEPDownloadURL is empty.
|
||||
Engine string `json:"engine,omitempty"`
|
||||
// AEPDownloadURL is a presigned MinIO GET URL for the .aep project file
|
||||
// (or .zip bundle). Valid for 2 hours. Empty when the template is not yet uploaded.
|
||||
AEPDownloadURL string `json:"aep_download_url,omitempty"`
|
||||
|
||||
Reference in New Issue
Block a user