feat(render #36): real per-tier output height (360/540/720/1080/4K)
Build backend images / build content-svc (push) Failing after 50s
Build backend images / build file-svc (push) Failing after 57s
Build backend images / build gateway (push) Failing after 50s
Build backend images / build identity-svc (push) Failing after 58s
Build backend images / build notification-svc (push) Failing after 48s
Build backend images / build render-svc (push) Failing after 53s
Build backend images / build studio-svc (push) Failing after 1m2s

r_height was hardcoded 1080. render-svc now derives r_height from the resolution
(ResolutionHeight) on job create; node-agent ffmpeg downscales to the tier height
(scale=-2:H). Quality picker now actually changes output size.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
soroush.asadi
2026-06-07 04:35:14 +03:30
parent c6766b18a1
commit bccebbd006
2 changed files with 49 additions and 5 deletions
+22 -2
View File
@@ -3,6 +3,7 @@ package db
import (
"context"
"fmt"
"strings"
"time"
"github.com/flatrender/render-svc/internal/models"
@@ -410,6 +411,25 @@ func (s *Store) ListActiveJobs(ctx context.Context, userID uuid.UUID) ([]*models
return out, rows.Err()
}
// ResolutionHeight maps a quality-tier label to its output height in pixels.
// Used for r_height (stored) and the node's ffmpeg downscale.
func ResolutionHeight(resolution string) int {
switch strings.ToLower(strings.TrimSpace(resolution)) {
case "360p":
return 360
case "540p":
return 540
case "720p":
return 720
case "1080p", "fullhd":
return 1080
case "4k", "2160p":
return 2160
default:
return 1080
}
}
func (s *Store) CreateJob(ctx context.Context, userID, tenantID uuid.UUID, req *models.RenderJobCreateRequest) (*models.RenderJob, error) {
priceType := "Free"
if req.PriceType != nil {
@@ -436,12 +456,12 @@ func (s *Store) CreateJob(ctx context.Context, userID, tenantID uuid.UUID, req *
-- to the saved-project id only if the lookup is somehow null.
COALESCE((SELECT original_project_id FROM studio.saved_projects WHERE id = $3), $3),
'paid'::render_priority_queue, 'Queued'::render_step, $4::price_kind,
$5::render_quality, $6, 1080, $7, COALESCE($8, FALSE),
$5::render_quality, $6, $11, $7, COALESCE($8, FALSE),
0, 'FIX', $9, $10)
RETURNING id`,
tenantID, userID, req.SavedProjectID, priceType,
req.Quality, req.Resolution, frameRate, req.Is60FPS,
tellMe, req.PreferredRegion,
tellMe, req.PreferredRegion, ResolutionHeight(req.Resolution),
).Scan(&id)
if err != nil {
return nil, err