Skip to content

Deterministic rendering - #36

Draft
niklaspandersson wants to merge 3 commits into
nxt-23.xfrom
feat/nxt-deterministic-rendering
Draft

Deterministic rendering#36
niklaspandersson wants to merge 3 commits into
nxt-23.xfrom
feat/nxt-deterministic-rendering

Conversation

@niklaspandersson

Copy link
Copy Markdown
Collaborator

Adds deterministic rendering

  • Introduce the SCHEDULE command suite to schedule commands that will be recorded in non-realtime.
  • SCHEDULED commands are invoked on a virtual channel, unique for each SCHEDULE session. Use the $ channel placeholder to schedule commands in the active schedule session
  • Producers get to take as long as they need to produce a frame, and the channel doesn't tick until all registered producers have delivered a frame
  • Support for virtual time in the html producer, which means that caspar explicitly ticks cef with the correct amount of time between frames
    • video- and audio- elements are not supported by this
  • Introduce the 'shutdown-on-eof' setting, which enables workflows where a batch of SCHEDULE commands are piped in to a fresh casparcg process, which then terminates when the recording is completed

To get started:

  1. create a config without any channels
  2. set configuration.html.wait-for-fp=true and configuration.html.enable-virtual-time=true
  3. set configuration.shutdown-on-eof=true and configuration.shutdown-on-eof-grace-ms=500
  4. Create a text-file with schedule commands. For example:
    SCHEDULE BEGIN 1080p5000 ADD FILE record.mp4 -codec:a aac -b:a 128k -filter:a pan=stereo|c0=c0|c1=c1 -codec:v libx264 -filter:v format=yuv420p
    SCHEDULE FRAME 0 PLAY $-10 2_h264_hdr
    SCHEDULE FRAME 0 CG $-23 ADD 1 infobox/index 1 "<templateData>eyJoZWFkbGluZSI6ImF3ZGF3ZGF3ZHdhZHdhZHdhZHdhZGF3Iiwic3VidCI6IiIsImhvc3QxIjoiIiwiaG9zdDIiOiIiLCJlbW5lIjoic2Vmc2VmIiwiZW1uZUNvbG9yIjoidG9tIiwiaGlzdG9yeSI6bnVsbCwiX3ZmIjoibnVsbCIsIl9hZiI6ImFudWxsIiwiX2R1cmF0aW9uIjpudWxsLCJfc2NhbGVfbW9kZSI6ImZpdCIsIl9zZWVrIjowfQ==</templateData>"
    SCHEDULE FRAME 0 MIXER $-23 OPACITY 0.5
    SCHEDULE FRAME 100 MIXER $-23 OPACITY 1 100
    SCHEDULE FRAME 200 PLAY $-10 4k MIX 50
    SCHEDULE FRAME 300 CG $-23 STOP 1
    SCHEDULE END 350 COMMIT
    
  5. run casparcg casparcg-record.config < schedule.txt. It should record 350 frames to record.mp4 and terminate when ready.

Leaving this as draft until more tests has been performed

* Introduce deterministic rendering mode, where rendering is decoupled from wall clock time
* Introduce new 'SCHEDULE' command to schedule rendering commands at specific frame numbers
* Explicit frame ticking in HTML producer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant