Repository: godot
Issue: Movie writer won't respect desired resolution depending on strech mode and stretch aspect
Labels: bug,topic:rendering

### Godot version

4.0.beta17

### System information

windows 10, nvidia graphics, compatibility backend

### Issue description

When recording a movie from the CLI, the output resolution provided via the --resolution parameter won't always be respected. The behavior will change according to the combination of the 
"display/window/stretch/aspect" and "display/window/stretch/mode" project configurations.

I haven't tested all possible combinations, but mode:disabled+aspect:keep was the only combination where the output resolution was always respected and the aspect was always kept. But in fact, for mode:disabled the concept of aspect ratio does not apply since changing the resolution also changes the visible scene area accordingly.

I've created a 400x224 project and tried to record with "mode:canvas_items + aspect:keep" and "mode:viewport + aspect:keep" combinations, using different resolutions, and here are the outputs:

canvas items + keep, 400x224: The base resolution, movie is written with the expected resolution

https://user-images.githubusercontent.com/5783414/216827564-e6c2963d-d751-44fc-ae3b-93dbbd97ebaa.mp4

canvas items + keep, 400x448: Movie is written with the expected resolution but output is visually wrong. It gets stretched instead of getting black borders up and down

https://user-images.githubusercontent.com/5783414/216827571-708642a4-3c21-4b92-baf0-a3380254062c.mp4

canvas items + keep, 800x224: Movie is written with the wrong resolution (400x224 instead of 800x224)

https://user-images.githubusercontent.com/5783414/216827582-38e720ff-3873-4e21-b43a-cb52363eaa72.mp4

canvas items + keep, 800x448: Movie is written with the expected resolution and output is visually correct, equally scaled on both axis

https://user-images.githubusercontent.com/5783414/216827589-50d07b99-7952-4390-a184-63008a7dfb73.mp4

viewport + keep, 400x224:The base resolution, movie is written with the expected resolution

https://user-images.githubusercontent.com/5783414/216827607-b292a1a7-847a-4e1c-9d01-8cbb7c70b5c5.mp4

viewport + keep, 400x448: Movie is written with the expected resolution but output is visually wrong. It gets stretched instead of getting black borders up and down

https://user-images.githubusercontent.com/5783414/216827618-9b36f0a5-22ef-417c-bcec-a22175fa010f.mp4

viewport + keep, 800x224: Movie is written with the wrong resolution (400x224 instead of 800x224)

https://user-images.githubusercontent.com/5783414/216827623-de05beee-39b7-4ddf-942d-2b2301afc5f6.mp4

viewport + keep, 800x448: Movie is written with the wrong resolution (400x448 instead of 800x448) and output is visually wrong. It gets stretched instead of getting black borders up and down

https://user-images.githubusercontent.com/5783414/216827631-55320c55-a279-4599-98b7-bcc1e9523e2e.mp4



It should also be noticed that when using mode != disabled and aspect == keep, the borders of the window that should be black, instead keep flickering with the splash image:

https://user-images.githubusercontent.com/5783414/216836948-015cfb85-9b4d-4dbf-8b7b-85c01e95fd15.mp4

### Steps to reproduce

Create an empty project with an empty 2d scene, then try different combinations of "display/window/stretch/aspect" and "display/window/stretch/mode" and try to record with different resolutions, specially those with different aspect ratio than the base  (main/default) resolution.

### Minimal reproduction project

[MovieMakerWontUseResolutionOverride.zip](https://github.com/godotengine/godot/files/10611328/MovieMakerWontUseResolutionOverride.zip)