Repository navigation
arigl snapshot --mp4 FILE --seconds S: record the scene running on its clock - #1310
Merged
Merged
Conversation
…s clock snapshot held still: it renders --frames frames and keeps the last, so a scene's physics, water and clouds never get far. --seconds S runs the scene clock S seconds instead, --fps frames a second (30 by default), each frame exactly 1/fps of scene time whatever the wall time, and --mp4 FILE records those frames as a video at --width x --height. --png still writes the last frame; --frames N runs N frames first, unrecorded. - cvcMedia: cvc::media::VideoWriter (cvc/media/video_writer.h), RGB frames in, an MP4 out. In process through the FFmpeg libraries the player already links, H.264 where they have libx264 or libopenh264; else an ffmpeg program on PATH fed raw RGB on its stdin (no shell); else FFmpeg's own MPEG-4 Part 2 (cvcpkg's ffmpeg-lgpl has no H.264 encoder). With none it says why. probe_video decodes a file back for tests. FFmpeg stays optional and cvcMedia's alone. - cvcGL: gla::record_frames (cvc/gl/ariadne/record.h) runs a loaded document on a fixed clock and encodes each frame read back from the offscreen view. A frame longer than the clock runs at once (max_steps_per_advance quanta, under 15 fps by default) runs as several, so no quantum is dropped. - arigl: --mp4 and --seconds in a window's snapshot; it checks the encoder and an even size before the document loads (exit 2), and says what it recorded with. run, check, --terminal and the browser shell refuse them; so does ari. - host_cli: the two flags, their help lines and their tests. ARIADNE.md and arigl's usage text describe the recording. Tests: cvcgl_ari_record records a falling ball 1 s at 10 fps, decodes it back (10 frames, 160x120, 10 fps), and checks the scene clock ran 1 s and the ball fell, in process and through an ffmpeg program where one is on PATH; arigl_record_* and ari_refuses_mp4 check the command line.
transfix
enabled auto-merge (squash)
November 16, 2026 08:21
…/snapshot-record # Conflicts: # src/arigl/main.cpp
This was referenced Nov 16, 2026
transfix
added a commit
that referenced
this pull request
Nov 16, 2026
…#1305, #1310, #1311) #1305 gives each Runtime program-lane providers of its own (add_program_intrinsics), so two documents on one app no longer reach each other's verbs and host functions, and moves AppRuntime's provider there from the app's list. This branch had split that provider in seven, each registered on the app with its kind (S1-Q7). Conflicts in ariadne.h, app_runtime.cpp and ariadne.cpp keep both: - Runtime::add_program_intrinsics takes a kind too (the form without one is host_only, as register_action_intrinsics's), and the Runtime's own list keeps it. AppRuntime adds its seven providers there, each with the kind it had, in the same order. - install_providers runs any list by kind; the Runtime's own run after the app's, by the same rules, wherever an env is built: an action, a resident, a spawned child (finish_context), the names probe, and init: and a module's init: (every kind as it is, on their own thread). - host_only_bindings counts the Runtime's own host_only providers, so one that binds anything pumps the document's group on the host thread, as an app provider does. - add_program_intrinsics marks the placement stale, as a late host verb does. - The own list is read where an env is built, a spawned child's on its pumping worker, so it is under a mutex of its own (own_mutex), copied, and run unlocked; names_mutex no longer guards it. STATE_EXEC_THREADED.md: the Runtime's own providers, AppRuntime's seven among them, and the fourth late-registration path. Built locally (MSVC Release; AB.lock held the box, so the suites were not run here); a test of the own providers by kind follows.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
arigl snapshotrendered--framesframes and kept the last, so a scene's physics, water and clouds never got far. This adds a recording:arigl snapshot --mp4 FILE --seconds Sruns the scene clock S seconds,--fpsframes a second (30 by default), offscreen at--width x --height, and encodes the frames as an MP4.What changed
Recording loop (
inc/cvc/gl/ariadne/record.h,src/cvcGL/ariadne/record.cpp):gla::record_frames(rt, view, opt)runs a loaded document on a fixed clock (AriRuntime::set_fixed_clock). Each frame steps the scene clock by exactly 1/fps of scene time, whatever the wall time, so physics, the clock's tickers (water, clouds) and the custom nodes' ticks move with it. A slow machine makes the same video, only more slowly. Each frame is read back withSceneRenderer::frameRGBand encoded. Frames are paced no faster than real time, as a snapshot's are. The world clock runs at mostmax_steps_per_advancequanta per advance (1/15 s by default) and drops the rest. So a recorded frame longer than that (under 15 fps) runs as several runtime frames, and no quantum is dropped. Without this, a 10 fps recording ran 0.667 s of clock in 1 s of video.Encoder (
inc/cvc/media/video_writer.h,src/cvcMedia/record/video_writer.cpp):cvc::media::VideoWritertakes RGB frames and writes an MP4. It tries three paths in this order:ffmpegprogram on PATH, fed raw RGB on its stdin through CreateProcessW or posix_spawn. No shell is involved, and SIGPIPE is held off the writing thread.With none of them,
video_encoder()returns "" with the reason.probe_video()decodes a file back, for tests. FFmpeg stays an optional, shared, cvcMedia-only dependency, and the core libraries don't depend on it. The FFmpeg log stays quiet, as the player keeps it, unlessCVC_MEDIA_FFMPEG_LOG=1.arigl (
src/arigl/main.cpp):--mp4and--secondswork in a window's snapshot.arigl: recorded 150 frames (5 s at 30 fps, 1280x720, libx264) to ....--pngwrites the last recorded frame.--frames Nruns N frames first without recording them.--secondswithout--mp4runs the same frames and writes only the PNG.run,check,--terminaland the browser shell refuse both flags. So doesari(src/ari/main.cpp).host_cli: adds the two flags, their help lines and
HostOptions::mp4/seconds.Docs:
docs/ARIADNE.md(the hosts' section, "Recording a video") and arigl's usage text. The old line saying a window snapshot's clock "is fixed" now says it steps a fixed 1/30 s per frame, which is whatset_fixed_clock(true)withframe(1/30)does.How it was checked (Windows 11, MSVC, Release)
FFmpeg 7.1.2 here comes from cvcpkg's
ffmpeg-cli(H.264 only, libx264). Its headers come from theffmpegrecipe's identical 7.1.2 install, named throughCVC_FFMPEG_INCLUDE_DIR/CVC_FFMPEG_*_LIBRARY.cvcgl_ari_record(new): records a ball falling onto a static box, 1 s at 10 fps, 160x120. It checks:app.world_clock()went 0 -> 1.0000;--pngwrote the last frame.It runs the same checks through an ffmpeg program on PATH, where there is one, and passed both ways. It also checks that an odd size and a missing program are refused with a reason. It skips, printing why, when there is no encoder.
AriadneHostCli.Mp4AndSecondsRecordASnapshot(new),arigl_record_mp4,arigl_record_needs_seconds,arigl_record_not_in_terminal,ari_refuses_mp4(new), plus the existingAriadneHostCli.*,arigl_window_snapshot,arigl_check,arigl_url_document,cvcgl_ari_switchandcvcmedia_audio_output: all pass.The writer compiled on its own without
CVC_MEDIA_FFMPEG, which is what a cvcMedia without FFmpeg gets:no video encoder: this cvcMedia was built without FFmpeg, and there is no ffmpeg program on PATH.terrain_lab, 5 s at 1280x720, 30 fps, with the track camera on crate_b (command above): 150 frames, libx264, 4.9 MB, about 35 s of wall time. Two runs gave the same frames. In the frames:
Not checked
arigl_record_mp4andcvcgl_ari_recordrun there or skip.cvcmedia_playerfails locally because this machine's FFmpeg (ffmpeg-cli, H.264 only) has no WebM/Opus decoders for its clip. This branch doesn't touch the player.__EMSCRIPTEN__, but no wasm build was run.