Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Movie writer doesn't use correct aspect ratio with window override and stretch settings #71254

Open
joemicmc opened this issue Jan 12, 2023 · 8 comments

Comments

@joemicmc
Copy link

joemicmc commented Jan 12, 2023

Godot version

4.0 beta 10

System information

Windows 10, Vulkan, AMD RX 5600 XT

Issue description

When you set a combination of settings in project settings > general > display > window, the output avi file does not have the correct aspect ratio

Size

  • Viewport Width: 640
  • Viewport Height: 360
  • Window Width Override: 1280
  • Window Height Override Override: 720

Stretch

  • Mode: viewport
  • Aspect: keep_width

Steps to reproduce

  • Open the attached project.
  • Enable movie writer
  • Run the project
  • Check the aspect ratio of the captured avi file

Minimal reproduction project

movie-writer-aspect-ratio.zip

@joemicmc
Copy link
Author

Current workaround is to not use the window override and then scale the avi using extra ffmpeg arguments (use it already to convert to mp4). Nearest neighbour is to try and preserve the crisp pixels.

ffmpeg -i input.avi -s WIDTHxHEIGHT -sws_flags neighbor output.mp4

@Calinou
Copy link
Member

Calinou commented Jan 12, 2023

This is strange, because only the viewport dimensions should matter when using the viewport stretch mode in Movie Maker mode. The actual window size set with the override should not affect the dimensions of the output video, even if you resize it while recording. This is why I was originally able to document godotengine/godot-docs#6398.

That said, even if this is fixed, the video will still not be scaled for you – you'll have to do this in post-process, or use a custom viewport instead of relying on the root viewport's scaling.

@joemicmc
Copy link
Author

joemicmc commented Jan 12, 2023

Hehe, I just updated my script to convert avi to mp4 to do the scaling! So have a workaround.

Also, used the cool project settings overrides to set the window overrides in movie mode to be 0 so I don't have to keep changing settings. Such a neat feature.

@Ayush-singla27
Copy link
Contributor

if i understood this correctly, the main issue is that output avi file should not scale with actual window size. Right?

@Calinou
Copy link
Member

Calinou commented Jan 17, 2023

if i understood this correctly, the main issue is that output avi file should not scale with actual window size. Right?

It should when using the disabled or 2d stretch modes, but not when using the viewport stretch mode.

@skeddles
Copy link

I ran into this too, still happening in 4.2.2

setting stretch mode to disabled and resetting window_width_override/window_height_override to 0 is sort of a workaround, if you want to render at 1x

though I found it better to change stretch mode to canvas_items, then you can keep the width/height override and render at a higher resolution, which is what I was hoping for / expecting. i would still have expected it to render scaled up with the viewport mode set to stretch.

imo rendering at 1x and then scaling up with nearest neighbor is a bad idea because the frames are getting jpeggified (even if mjpeg quality is set to 1 apparently), and you're going to end up scaling up that jpeggification making it much more noticeable.

@Calinou
Copy link
Member

Calinou commented Jul 10, 2024

imo rendering at 1x and then scaling up with nearest neighbor is a bad idea because the frames are getting jpeggified (even if mjpeg quality is set to 1 apparently), and you're going to end up scaling up that jpeggification making it much more noticeable.

For pixel art, you should use PNG output (or QOI if #91263 is merged). JPEG is still a lossy format at 100% quality.

@skeddles
Copy link

skeddles commented Jul 10, 2024

My target destination is still video, even with rendering it to PNG, it would still end up getting JPEGged at the end when converted to MP4 - I'm just suggesting people avoid scaling up JPEG/JPEGged video because it will scale up the artifacts and make them more noticeable.

Though it's true, rendering to PNG could be a better workaround for now, if you want to force everything to be rendered at the native resolution, since changing to the canvas_items stretch mode renders everything at higher res.

But I hope this can be fixed so that when using the viewport stretch mode you can render scaled up pixel art video at the native resolution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants