Periodically save images from camera to file

Hello,
I’m trying to save screenshots from a specific camera.
Attached is the blueprint that I’m using to dump periodic captures.

But the issue is that for every “capture”, I’m getting two screenshot, one from the normal Actor’s view, and the other from the camera.

Also I was hoping to be able to have incremental naming, but if I do that, it just overwrites the CineCamera’s pictures with the Actor’s camera view, basically rendering the entire exercise pointless.

I would welcome any help on the subject please.
Thank you in advance.

bump

Hey again Jpowwe!

Unless you have another screenshot being taken elsewhere, this shouldn’t be a thing.
Also you want to use this node
image

High Res Screenshot should have a defined X and Y resolution, typically 4k or higher.
:slight_smile:

Hello again Mind-Brain!

Glad to see it’s you responding.

There is no other screenshot blueprint so far as I can see. I did disable the rendering for the camera for another plugin. Now it’s taking a double screenshot only randomly and not very consistently. Also I noticed that minimizing UE stops the capture of screenshots. This issue is intermittent.

I tried using your method of Take Automation Screenshot at Camera, but it did not save anything anywhere (I simply swapped out the take High Res Screenshot with the Take Automation Screenshot). When that didn’t work, I created a new Event Begin Play, and connected it to that and that didn’t work either.

Hey @Jpowwe! Sorry for the late reply!

Have you tried to use the “Now” and “DateTime” nodes, plugged them into a "concatenate"d string, converted to a name, and named your files that way?

Also you might not want to do this on tick. Maybe use a timer node on begin play? Tick runs 3x/frame so IDK if you want THAT many screenshots :stuck_out_tongue:

Thank you for your response. I have been doing something else, but I’ll update you as soon as I can try it out.

Hi, Jpowwe ! Glad to see your post, I think we met similar question, I saw your blueprint nodes,one thing I want to know is that how did you set the saving path to save your screenshot? Thanks!

Hey @FunnyCharly!

I think Jpowwe was just using the default directory location on Windows. The file extension and two arrows in the top right show that it is not likely they’re showing it in Unreal. Changing that directory requires modifying the source of the Engine.

The default folder is YourProjectFolder\Saved\Screenshots\Windows\ Folder.

Hope this helps! :slight_smile:

@Jpowwe Did you ever get your original question solved? Let us know!

Thanks for your post, I renewed the default folder in Project Settings/General Settings/Screenshots/Game Screenshot Save Directory, and then it worked. But I found even I connected the node ‘Take High Res Screenshot’ after ‘Event Tick’, this could save only one screenshot rather than many screenshots. Do you know how to save my custom camera viewport as screenshots by frames?

I didn’t solve my original question yet, I still try to find the solution.

As taking high res screenshots can bog down performance quite hard, I don’t really recommend taking one each frame… But I think it is doable with “TakeAutomationScreenshotAtCamera”.
You should go ahead and make a new thread of your own! That will give it a lot more visibility as this post is getting close to two years old, and it’s not necessarily what jpowwe was going for, so it needs a new thread anyway. :slight_smile:

You are right! Take high res screenshots by frame is certainly difficult. So I 'm trying to take lower res screenshots now. I use the node ‘TakeAutomationScreenshotAtCamera’ , but I don’t know how to set the saving path, even the default folder ‘YourProjectFolder\Saved\Screenshots\Windows\ Folder’ doesn‘t have the screenshots.

Hey @FunnyCharly,

I think it’s because it is on tick, with a delay of 0.2, and because tick is so fast, it’s restarting the function. Try using a timer- Use “BindTimerByEvent” on BEGIN PLAY, not tick. Try connecting that to an event that takes the camera shot. Give the timer a time of 0.2, looping, and in the setting for the automated screenshot give it delay of 0. I am not sure that this will work but I don’t know why it wouldn’t like this!

Thanks a lot for your advice, @Mind-Brain
I tried to rewrite my level blueprint like the picture below, but it still doesn’t work, just as you expected , I have no idea where the problem is, maybe I wrote a wrong ‘Name Override’ of the node ‘Take Automation Screenshot At Camera’, or the wrong details of the node ‘Make AutomationScreenshotOptions’ :sob:

I don’t know if this will FIX the problem, but I do know this is going to stop you from proceeding:


The delay matching the time means it will restart before the pic is taken, you forgot to set the screenshot delay to 0.0 :slight_smile: the timer is handling the delay.

You may have to make an asset to go in the View Settings variable, and set those values. Without that it could be passing in zeros for all settings. The name override problem is something to make sure you get multiple pictures- let’s focus on getting one picture first. :slight_smile:

Thank you, @Mind-Brain
I set these to 0.0, it didn’t work still. Maybe because the ‘view settings’ is empty, I don’t know how to set this, so I give up this test. :sob: Take screenshots by frame is not a good idea indeed, but at least, I know the risks of doing this. Now I try to use MRQ to achieve this, anyhow, thank you very much! :heartbeat:

1 Like

This is a weird problem, however, I do have a solution for you. You need this type of component in the scene SceneCaptureComponent2D. If you are not sure how to use the SceneCaptureComponent2D, there is a lot of setup you need to do. Here is a chatgpt explaining how you would do what you are trying to do.

Hope that helps, :wink:

1 Like

How do you get this node to produce files or find them? I cannot find the taken screenshot anywhere.

If you right-click the “Options” struct and break the struct pin you should have the option to tell it where to put the file.

If you don’t set up a way to override the name and create a new name each time, however, it will continually overwrite each other!

Actually, I am using C++. I specified a file name generation in the options, it did capture the screenshots, but the files were still saved to a weird location as showed in the log. I decided to use another function anyway.

Here is how it gets weird in UE 5.2:

https://github.com/EpicGames/UnrealEngine/blob/02dc8dbdd89f749cd5500376e9bb87271bf64848/Engine/Source/Runtime/Engine/Private/Tests/AutomationCommon.cpp#L151-L152

https://github.com/EpicGames/UnrealEngine/blob/02dc8dbdd89f749cd5500376e9bb87271bf64848/Engine/Source/Developer/FunctionalTesting/Private/AutomationBlueprintFunctionLibrary.cpp#L775

https://github.com/EpicGames/UnrealEngine/blob/02dc8dbdd89f749cd5500376e9bb87271bf64848/Engine/Source/Developer/FunctionalTesting/Private/AutomationBlueprintFunctionLibrary.cpp#L458