A native wgpu + Tauri 2 teaching example for recording procedural GPU output at a resolution independent from the visible preview window.
This project is intentionally based on the verified file-recording pipeline from Example 28. It does not depend on the paused FFmpeg network-streaming example.
ffprobe verification after finalizationThe renderer window is only a preview.
When 3840 × 2160 is selected, the procedural shader is rendered into a native 3840 × 2160 authoritative texture. The output is not a 720p image enlarged to 4K.
Selected native resolution
↓
Authoritative wgpu shader texture
↓
Same-resolution recording texture
↓
2-slot mapped GPU readback ring
↓
2-frame bounded CPU queue
↓
FFmpeg
↓
MP4 or MOV
High-resolution RGBA frames are large:
| Resolution | One RGBA frame | Raw traffic at 30 FPS |
|---|---|---|
| 1920 × 1080 | about 7.9 MiB | about 237 MiB/s |
| 2560 × 1440 | about 14.1 MiB | about 422 MiB/s |
| 3840 × 2160 | about 31.6 MiB | about 949 MiB/s |
| 5120 × 2880 | about 56.3 MiB | about 1.65 GiB/s |
| 7680 × 4320 | about 126.6 MiB | about 3.71 GiB/s |
A deep queue at 8K can consume gigabytes before FFmpeg receives a frame. This example therefore uses:
The goal is bounded memory and visible frame drops, not unbounded latency.
PATHVerify FFmpeg before starting:
ffmpeg -version
ffprobe -version
You can override the executable paths:
export FFMPEG_PATH=/absolute/path/to/ffmpeg
export FFPROBE_PATH=/absolute/path/to/ffprobe
cd 30-wgpu-high-resolution-record
npm install
npm run dev
Two windows should open:
Use:
H.264 / MP4
1920 × 1080
30 FPS
0 ms writer delay
Record for five seconds, stop, wait for Complete, and play the result.
Use:
H.264 / MP4
3840 × 2160
30 FPS
0 ms writer delay
Confirm:
3840 × 21603840 × 2160ProRes 422 HQ produces much larger files and can require substantially more disk bandwidth. Start with 1080p before testing 4K.
The acknowledgement checkbox is required because the readback pipeline can use hundreds of megabytes and several gigabytes per second of raw memory traffic.
An 8K failure does not mean wgpu cannot render 8K. It may mean one of these stages cannot sustain the workload in real time:
Recordings are written to:
./recordings/
Filenames include codec, resolution, FPS, and timestamp:
junkpile-30-h264-3840x2160-30fps-<timestamp>.mp4
junkpile-30-prores-3840x2160-30fps-<timestamp>.mov
7680 × 4320max_texture_dimension_2dThose are separate future examples.
High-resolution output should be treated as a resource contract, not merely a larger width and height. Every stage must disclose:
This example makes those costs visible before recording starts.