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 Maker: VideoStreamPlayer doesn't match FPS due to --fixed-fps being enabled #69965

Open
Tracked by #101644
jorgerosa opened this issue Dec 12, 2022 · 9 comments
Open
Tracked by #101644

Comments

@jorgerosa
Copy link

jorgerosa commented Dec 12, 2022


Bugsquad note: This issue has been confirmed several times already. No need to confirm it further.


Godot version

v4.0.beta8.official [45cac42]

System information

Windows 10

Issue description

Using internal GODOT 4 - Beta 8 - "Movie Writer" everything records very well (in my own limited tests), except when recording a scene that has a mesh (it is the plane mesh, named "Ecra" as shown in the image) that gets its texture from a SubViewPort that has a VideoStreamPlayer inside.
In the final recorded AVI file, we can notice that the speed is different (it is too fast, seems to me, that is 2x or 3x faster)
Note: In the exported "exe" file or when in Godot Editor, the video file plays in the correct speed. No issues.

Recorded with these settings:
Recorded with 60 Fps
V-Sync is disabled

1) The NODES:

GODOT_4_Beta_8_MovieMaker_1

2) The recorded VIDEO:
In this video, uploaded in Youtube, the issue is visible at playing time: 04:53
Note: I haven´t noticed that when recorded it. Everything seems to be fine while recording.
Note: Even that its a "vintage" video file that is not its real speed, its 2x or 3x (at least) slower.
https://www.youtube.com/watch?v=N0Jr2ig0u8M&list=PLnhzSMPecj1HXo5IGrNFYiGyy6fHZYPTL&index=1

THANKYOU for share with us all your hard work, GODOT team !!!

.

@jorgerosa jorgerosa changed the title VideoStreamPlayer doesn´t match Movie Maker FPS VideoStreamPlayer doesn´t match Movie Writer FPS Dec 12, 2022
@jorgerosa jorgerosa changed the title VideoStreamPlayer doesn´t match Movie Writer FPS Movie Writer: The VideoStreamPlayer doesn´t match FPS Dec 12, 2022
@jorgerosa jorgerosa changed the title Movie Writer: The VideoStreamPlayer doesn´t match FPS Movie Writer: The VideoStreamPlayer doesn´t match FPS ( Godot 4 - Beta 8 ) Dec 12, 2022
@jorgerosa jorgerosa changed the title Movie Writer: The VideoStreamPlayer doesn´t match FPS ( Godot 4 - Beta 8 ) [Godot 4 - Beta 8] Movie Writer: The VideoStreamPlayer doesn´t match FPS Dec 12, 2022
@Calinou
Copy link
Member

Calinou commented Dec 12, 2022

VideoStreamPlayer doesn't take Engine.time_scale into account, and this is likely a similar case here (as --fixed-fps influences game speed depending on FPS).

@jorgerosa Please upload a minimal reproduction project to make this easier to troubleshoot.

@Calinou Calinou changed the title [Godot 4 - Beta 8] Movie Writer: The VideoStreamPlayer doesn´t match FPS Movie Maker: VideoStreamPlayer doesn't match FPS due to --fixed-fps being enabled Dec 12, 2022
@jorgerosa
Copy link
Author

jorgerosa commented Dec 12, 2022

Minimal project: CINEMA.zip
Added a minimal project, however Movie Writer seems to be working fine in this one ... I am lost now ...

  • Still sometimes in the editor, this project ( exactly as the above ) it runs and other times not ... Just closes the window.
  • But it throws no errors in the output console.

@cyberpsyche
Copy link

As VideoStreamPlayer doesn't take Engine.time_scale into account, my question is how to solve this problem?

Do I have to modify the VideoStreamPlayer to let the video stream's FPS fit with Engine's time_scale ? Is there any other solutions to this issue ?

@Calinou
Copy link
Member

Calinou commented Mar 19, 2023

As VideoStreamPlayer doesn't take Engine.time_scale into account, my question is how to solve this problem?

Do I have to modify the VideoStreamPlayer to let the video stream's FPS fit with Engine's time_scale ? Is there any other solutions to this issue ?

Unfortunately, I don't see a way to work around this issue. VideoStreamPlayer has to handle a lot of things differently to other nodes because it needs to keep audio and video in sync (among other things). Video playback is hard.

@olivergs
Copy link
Contributor

olivergs commented Apr 16, 2024

Just came here to confirm this issue. I've stumbled upon this in a simple UI menu that uses a video as background using Godot 4.2.1.

@akx
Copy link
Contributor

akx commented Jun 8, 2024

VideoStreamPlayer has to handle a lot of things differently to other nodes because it needs to keep audio and video in sync (among other things). Video playback is hard.

As a concession/workaround, maybe we could have a mode for VideoStreamPlayer where it can ignore any audio in the source video, just so it's able to play the video frames with exact timing. (I suppose this would/could unlock arbitrary video seeking/retiming too...)

@olivergs
Copy link
Contributor

olivergs commented Jun 8, 2024

In my specific case that would work perfectly. I use the videoplayer for complex effects on top of a background, so they do not have audio.

@akx
Copy link
Contributor

akx commented Jun 8, 2024

@olivergs Yep, same here. I ended up only looking at the video as a preview in Godot and doing the postprocessing in ffmpeg. Luckily in my case I could just use an add blend from the Godot output with my background:

ffmpeg -i d24amv_v1_bg.mov -i godot-generated.avi -filter_complex "[0]format=gbrp[bg];[1]format=gbrp[fg];[fg][bg]blend=all_mode='addition':all_opacity=1[final];[final]format=yuv420p" output.mp4

@rakzin
Copy link

rakzin commented Oct 12, 2024

Yes. my workaround is use OBS to record video, not movie mode,
but the new problem is there is audio quality loss when record by OBS, though it's easier to solve.

Also another thing I should mention.
the Time.get_ticks_msec() is not accurate in movie mode.
the accurate time should sum from _physics_process's delta

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

6 participants