diff --git a/manimlib/scene/scene_file_writer.py b/manimlib/scene/scene_file_writer.py index 298339748c..74bcdd22a2 100644 --- a/manimlib/scene/scene_file_writer.py +++ b/manimlib/scene/scene_file_writer.py @@ -149,7 +149,7 @@ def get_resolution_directory(self): that immediately contains the video file will be 480p15. The file structure should look something like: - + MEDIA_DIR |--Tex |--texts @@ -175,7 +175,7 @@ def get_image_file_path(self): written to. It is usually named "images", but can be changed by changing "image_file_path". - + Returns ------- str @@ -186,7 +186,7 @@ def get_image_file_path(self): def get_next_partial_movie_path(self): """ Manim renders each play-like call in a short partial - video file. All such files are then concatenated with + video file. All such files are then concatenated with the help of FFMPEG. This method returns the path of the next partial movie. @@ -233,9 +233,9 @@ def add_audio_segment(self, new_segment, time=None, gain_to_background=None): """ - This method adds an audio segment from an + This method adds an audio segment from an AudioSegment type object and suitable parameters. - + Parameters ---------- new_segment (AudioSegment) @@ -277,7 +277,7 @@ def add_sound(self, sound_file, time=None, gain=None, **kwargs): ---------- sound_file (str) The path to the sound file. - + time (Union[float, int]) The timestamp at which the audio should be added. @@ -497,6 +497,19 @@ def combine_movie_files(self): combine_process = subprocess.Popen(commands) combine_process.wait() + mp4fpsmod_file_path = os.path.join( + os.getcwd(), + 'mp4fpsmod.exe' if os.name == 'nt' else 'mp4fpsmod' + ) + + fix_timestamps_process = subprocess.Popen([ + mp4fpsmod_file_path, + '--fps', '0:' + str(self.scene.camera.frame_rate), + '--timescale', '15360', + movie_file_path, '--inplace' + ]) + fix_timestamps_process.wait() + if self.includes_sound: sound_file_path = movie_file_path.replace( self.movie_file_extension, ".wav" diff --git a/mp4fpsmod b/mp4fpsmod new file mode 100644 index 0000000000..23b855ce60 Binary files /dev/null and b/mp4fpsmod differ diff --git a/mp4fpsmod.exe b/mp4fpsmod.exe new file mode 100644 index 0000000000..da8880697f Binary files /dev/null and b/mp4fpsmod.exe differ