jpk
June 1, 2026, 6:06pm
1
Godot Version
4.6.3
Question
Hello,
I have more of a theoretical question: is it possible, to have two cameras, one being the player view and the other one recording what it sees following the player via script and saving the record to a file (starting and stoping the recording by pressing keys for example)?
I’m new to Godot and trying to figure out limitations and mechanics.
Thanks in advance!
In theory, most likely yeah. But in practice… well, in Godot, you can do almost anything with extensions if there aren’t any ready-made solutions.
But it’s an interesting question — I’ve got it on my list to look into.
Oh, it’s already been resolved
Hacky way taking png screenshots:
@onready var sub: SubViewport = $RecordViewport
@onready var rec_cam: Camera3D = $RecordViewport/RecordCamera
@onready var player: Node3D = $Player
var frame := 0
func _ready() -> void:
sub.render_target_update_mode = SubViewport.UPDATE_ALWAYS
_record_loop()
func _record_loop() -> void:
while true:
await RenderingServer.frame_post_draw
sub.get_texture().get_image().save_png("user://rec/frame_%04d.png" % frame)
frame += 1
I then combined it with ffmpeg to make a video:
It’s saved as a PNG, which can be a bit resource-intensive in some cases. But the main thing is that it works.
@dginovker ’s approach will be fine if your viewport resolution is relatively small. Otherwise, if the image data throughput is large and cannot keep up with the frame rate, you might need to cycle through several viewports and transfer data from gpu to cpu asynchronously using RenderingDevice::texture_get_data_async(). Although even that might exceed the bandwidth, depending on framerate, resolution and hardware.
tomcat
June 2, 2026, 10:31am
7
What to do if:
As far as I understand, this plugin generates a video stream, but it doesn’t capture (record) anything.
And its license is incredibly complicated. I’m even tired of reading it. But there’s a reference to U.S. laws. And the laws in that country are wild — it’s not like civilized Europe.
Since you broadcast the viewport, it’s easier to capture it with OBS, for example, and get a smoother experience.
tomcat
June 2, 2026, 11:07am
9
Then there’s the question of purpose: watching replays in a separate program after the game, or watching them directly from within the game using its own tools? The second option is more interesting.
As far as I understand, Godot has less support for encoding and decoding video than OBS.
master ← berarma:video_importer
opened 09:17AM - 14 Jul 25 UTC
Closes godotengine/godot-proposals#7062.
The goal for this PR is being able t… o import video files from a variety of formats to be used with the built-in VideoStreamPlayer. The imported video files are converted internally to Ogg Theora (OGV) using an external FFmpeg binary so that users don't have to do it manually.
The user has to set `filesystem/import/video/ffmpeg_path` in the editor settings to the FFmpeg binary in their system.
The accepted video file extensions are:
- mp4
- webm
- mpg
- mpeg
- mkv
- avi
- mov
- wmv
I've chosen these extensions because they're well known. Suggestions welcomed. The supported video codecs will be the ones compatible with these containers and built into the FFmpeg version used.
The import options are:
- Video quality.
- Audio quality.
- Keyframe interval (GOP).
- Scale width.
- Scale height.
- Alpha channel replacement color. (Replaces the alpha channel, if there's one, with a color.)
- Encoding speed.
- Custom FFmpeg arguments.
~~I would like to add the Theora encoding speed level to allow for faster encoding, but it's not an option in FFmpeg. [I've sent a patch to add this option to FFmpeg](https://ffmpeg.org/pipermail/ffmpeg-devel/2025-July/346690.html) but this is my first patch submission... we'll see.~~
## TODO
- [x] Import video files to OGV.
- [x] Imported video files working in the editor.
- [x] Imported video files working in project exports.
- [x] Add speed level option to this importer and FFmpeg.
- [x] Add a setting to disable the video importer when using an external addon for videos?
- [x] Show a warning when using an old FFmpeg version that doesn't support `-speed_level` and importing with a speed setting different to the FFmpeg default.
## Possible improvements?
- Imports can be really slow, as expected, and freeze the editor while importing. Can anything be done about this?
- Create asset library addon or automation to install FFmpeg? Calinou has proposed to create an external tools manager to centralize downloads.
tomcat
June 2, 2026, 11:15am
11
Yeah, that’s true. The video in Godot is pretty sad. But it’s nice to know they’re thinking about it and maybe working on it.
tomcat:
What to do if:
Well, there’s no other choice than to change one or more of those parameters - lower the resolutions/framerate and/or record on better hardware.
tomcat
June 2, 2026, 12:58pm
13
Then we need to clarify the question
Just treat it like any other performance bottleneck. Profile it to determine the exact cause and act accordingly.