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

[BUG] Non monotonically increasing dts #430

Open
Sarang0218 opened this issue May 16, 2024 · 5 comments
Open

[BUG] Non monotonically increasing dts #430

Sarang0218 opened this issue May 16, 2024 · 5 comments
Labels
bug Something isn't working lib Related to the library (a.k.a. module) waiting author Waiting author response

Comments

@Sarang0218
Copy link

Description

Renders fine. (the manim part works ok)
There are some files that last 0:00. maybe that's the problem.

ValueError: [Errno 22] Invalid argument: 'slides/files/Paragraph1/9a0e95b3fee2a04ed822a0b476064663528145f26b39900b189f486d99c14fb7.mp4'; last error log: [mp4] Application
provided invalid, non monotonically increasing dts to muxer in stream 0: 810000 >= 808500

Current Code:

from manim import *
from manim.typing import *
import math

from manim_slides import ThreeDSlide



class Paragraph1(ThreeDSlide):
    
    def construct(self):
        
        title = VGroup(
            Text("test테스트", t2c={"test": BLUE}).scale(1.5),
            Text("special chars", t2c={"char": YELLOW}),
            Text("test", t2w={"test": BOLD}).scale(0.5),
        ).arrange(DOWN)
        
        
        
        newton = MathTex(r"F = G \frac{m_1 m_2}{r^2}").shift(UP*2)
        EFE = MathTex(r"R_{\mu \nu} - {1 \over 2}g_{\mu \nu}\,R + g_{\mu \nu} \Lambda = {8 \pi G \over c^4} T_{\mu \nu}").shift(LEFT).shift(DOWN)
        SCHWART = MathTex(r"ds^{2}=\left(1-{\frac {2Gm}{c^{2}r}}\right)^{-1}dr^{2}+r^{2}(d\theta ^{2}+\sin ^{2}\theta d\phi ^{2})-c^{2}\left(1-{\frac {2Gm}{c^{2}r}}\right)dt^{2}").shift(LEFT).shift(DOWN)
        pnet1 = Circle(1, color=RED).shift(LEFT*2)
        pnet2 = Circle(1, color=BLUE).shift(RIGHT*2)
        pnet1_arrow = Arrow(start=LEFT*2, end=ORIGIN)
        pnet2_arrow = Arrow(start=RIGHT*2, end=ORIGIN)
        
        resolution_fa = 25
        self.camera.background_color = ManimColor.from_hex("#040c24")  
        axes = ThreeDAxes(x_range=(-20, 20, 1), y_range=(-20, 20, 1), z_range=(0, 20, 1))
        def param_trig(u, v, offset=(0,0), r_s=0.5):
            x = u
            y = v
            
            z = 2 * np.sqrt(r_s*(np.sqrt((x-offset[0])**2 + (y-offset[1])**2) - r_s))
            
            if np.isnan(z):
                return -5
            return z
        
        def param_trig_generator(A):
            return lambda u,v : param_trig(u,v)+param_trig(u,v,offset=A, r_s=0.05)
            

        
        trig_plane = axes.plot_surface(
            param_trig,
            resolution=(resolution_fa, resolution_fa),
            u_range = (-10, 10),
            v_range = (-10, 10),
            colorscale = [BLUE, GREEN],
        )
        
        trig_plane.set_style(fill_opacity=0)
        
        
        blackhole = Sphere(center=(0, 0, 1.4), radius=0.3, resolution=(18, 18), checkerboard_colors=False)
        blackhole.set_color(BLACK)
        
        blackhole_out = Sphere(center=(0, 0, 1.4), radius=0.31, resolution=(18, 18), checkerboard_colors=False)
        blackhole_out.set_color(BLUE)
        blackhole_out.set_style(fill_opacity=0.1)
        
        
        
        
        trajectory = Circle.from_three_points(axes.coords_to_point(3,3,0),axes.coords_to_point(-3,-3,0),axes.coords_to_point(3,-3,0))
        planet = Sphere(center=(0, 0, 1.4), radius=0.1, resolution=(18, 18), checkerboard_colors=False)
        planet.set_color(BLUE)
        
        ptracker = ValueTracker(0)
        planet.add_updater(
            lambda x: x.move_to([trajectory.point_from_proportion(ptracker.get_value() - math.floor(ptracker.get_value()))[0],trajectory.point_from_proportion(ptracker.get_value() - math.floor(ptracker.get_value()))[1],trajectory.point_from_proportion(ptracker.get_value() - math.floor(ptracker.get_value()))[2]+1.4])
        )
        
        def tempplane(x):
            s1 = axes.plot_surface(
                    param_trig_generator((planet.get_x(), planet.get_y())),
                    resolution=(resolution_fa, resolution_fa),
                    u_range = (-10, 10),
                    v_range = (-10, 10),
                    colorscale = [BLUE, GREEN],
                )
            s1.set_style(fill_opacity=0)
            return s1
            
        trig_plane.add_updater(
            lambda x: x.become(
                tempplane(x)
            )
        )
        
        self.play(FadeIn(title))
        self.next_slide()
        self.wait(0.01)
        self.wipe(title)
        
        self.play(Create(pnet1), Create(pnet2))
        self.play(Create(pnet1_arrow), Create(pnet2_arrow))
        
        self.play(Wiggle(pnet1_arrow), Wiggle(pnet2_arrow))
        #self.next_slide()
        self.play(Write(newton))
        phi, theta, focal_distance, gamma, zoom = self.camera.get_value_trackers()   
        self.play(zoom.animate.set_value(3.7), phi.animate.set_value(30*DEGREES), theta.animate.set_value(30*DEGREES), Uncreate(pnet1_arrow), Uncreate(pnet2_arrow), pnet1.animate.scale(0.5),pnet2.animate.scale(0.5))
        #EFE.set_opacity(0)
        self.add_fixed_in_frame_mobjects(EFE)
        self.play(Uncreate(pnet1), Uncreate(pnet2), Unwrite(newton), Create(axes))
        self.begin_ambient_camera_rotation(rate=0.1)
        self.play(Create(blackhole), Create(blackhole_out))
        self.wait(0.01)
        self.play(DrawBorderThenFill(trig_plane))
        self.play(DrawBorderThenFill(planet))
        self.wait(0.01)
        self.play(Write(EFE), EFE.animate.set_opacity(1))
        self.wait(0.01)
        self.next_slide(loop=True)
        self.play(ptracker.animate.set_value(2.01), run_time=10, rate_func=rate_functions.linear)
        self.play(ptracker.animate.set_value(2.5), run_time=2.5, rate_func=rate_functions.ease_out_sine)
        self.wait(1)
        self.stop_ambient_camera_rotation()

Version

5.1.7

Platform

macOS

Screenshots

No response

Additional information

seems like rendering twice sometimes resolves the issue. rendering line by line sometimes doesn't cause issues. I tried to find the cause of error everywhere, but every line seems to generate an error, and then just something else decides to break??

I think it's because of the 0:00 files, but I have no idea how to remove them. please help.

@Sarang0218 Sarang0218 added the bug Something isn't working label May 16, 2024
@Sarang0218
Copy link
Author

:128: RuntimeWarning: 'manim.main' found in sys.modules after import of package 'manim', but prior to execution of 'manim.main'; this may result in unpredictable behaviour
Manim Community v0.18.1

[05/17/24 01:24:34] INFO Animation 0 : Using cached data (hash : 4236965120_1805888222_223132457) cairo_renderer.py:88
INFO Animation 1 : Partial movie file written in scene_file_writer.py:527
'/Users/sarangpark/Documents/Math/NEWMATH/media/videos/blackhole/1080p60/partial_movie_files/Paragraph1/3938426210_17179402
94_2784191530.mp4'
[05/17/24 01:24:35] INFO Animation 2 : Partial movie file written in scene_file_writer.py:527
'/Users/sarangpark/Documents/Math/NEWMATH/media/videos/blackhole/1080p60/partial_movie_files/Paragraph1/3938426210_38904440
11_4227516557.mp4'
INFO Animation 3 : Partial movie file written in scene_file_writer.py:527
'/Users/sarangpark/Documents/Math/NEWMATH/media/videos/blackhole/1080p60/partial_movie_files/Paragraph1/3938426210_34550047
03_4131132508.mp4'
[05/17/24 01:24:36] INFO Animation 4 : Partial movie file written in scene_file_writer.py:527
'/Users/sarangpark/Documents/Math/NEWMATH/media/videos/blackhole/1080p60/partial_movie_files/Paragraph1/3938426210_40909126
13_2929418954.mp4'
[05/17/24 01:24:37] INFO Animation 5 : Partial movie file written in scene_file_writer.py:527
'/Users/sarangpark/Documents/Math/NEWMATH/media/videos/blackhole/1080p60/partial_movie_files/Paragraph1/3938426210_38329135
63_1721333967.mp4'
INFO Animation 6 : Partial movie file written in scene_file_writer.py:527
'/Users/sarangpark/Documents/Math/NEWMATH/media/videos/blackhole/1080p60/partial_movie_files/Paragraph1/3938426210_86688292
0_308581961.mp4'
[05/17/24 01:24:38] INFO Animation 7 : Partial movie file written in scene_file_writer.py:527
'/Users/sarangpark/Documents/Math/NEWMATH/media/videos/blackhole/1080p60/partial_movie_files/Paragraph1/1488009128_21005827
3736244795.mp4'
[05/17/24 01:24:46] INFO Animation 8 : Partial movie file written in scene_file_writer.py:527
'/Users/sarangpark/Documents/Math/NEWMATH/media/videos/blackhole/1080p60/partial_movie_files/Paragraph1/537970046_179768007
7_3509761829.mp4'
[05/17/24 01:24:59] INFO Animation 9 : Partial movie file written in scene_file_writer.py:527
'/Users/sarangpark/Documents/Math/NEWMATH/media/videos/blackhole/1080p60/partial_movie_files/Paragraph1/6928265_1801050560

68422478.mp4'
[05/17/24 01:25:00] INFO Animation 10 : Partial movie file written in scene_file_writer.py:527
'/Users/sarangpark/Documents/Math/NEWMATH/media/videos/blackhole/1080p60/partial_movie_files/Paragraph1/2545551389_16478769
6_3396317334.mp4'
[05/17/24 01:27:59] INFO Animation 11 : Partial movie file written in scene_file_writer.py:527
'/Users/sarangpark/Documents/Math/NEWMATH/media/videos/blackhole/1080p60/partial_movie_files/Paragraph1/2545551389_41619544
77_4082947390.mp4'
[05/17/24 01:29:59] INFO Animation 12 : Partial movie file written in scene_file_writer.py:527
'/Users/sarangpark/Documents/Math/NEWMATH/media/videos/blackhole/1080p60/partial_movie_files/Paragraph1/1795713699_13960491
33_955583506.mp4'
[05/17/24 01:30:02] INFO Animation 13 : Partial movie file written in scene_file_writer.py:527
'/Users/sarangpark/Documents/Math/NEWMATH/media/videos/blackhole/1080p60/partial_movie_files/Paragraph1/3502654941_16478769
6_1407044801.mp4'
[05/17/24 01:32:02] INFO Animation 14 : Partial movie file written in scene_file_writer.py:527
'/Users/sarangpark/Documents/Math/NEWMATH/media/videos/blackhole/1080p60/partial_movie_files/Paragraph1/3502654941_29870471
03_563793670.mp4'
[05/17/24 01:32:05] INFO Animation 15 : Partial movie file written in scene_file_writer.py:527
'/Users/sarangpark/Documents/Math/NEWMATH/media/videos/blackhole/1080p60/partial_movie_files/Paragraph1/4215485639_16478769
6_1076058024.mp4'
[05/17/24 01:41:39] INFO Animation 16 : Partial movie file written in scene_file_writer.py:527
'/Users/sarangpark/Documents/Math/NEWMATH/media/videos/blackhole/1080p60/partial_movie_files/Paragraph1/4215485639_13921239
14_1351219052.mp4'
[05/17/24 01:44:03] INFO Animation 17 : Partial movie file written in scene_file_writer.py:527
'/Users/sarangpark/Documents/Math/NEWMATH/media/videos/blackhole/1080p60/partial_movie_files/Paragraph1/1717509317_11987347
75_2615680775.mp4'
[05/17/24 01:45:04] INFO Animation 18 : Partial movie file written in scene_file_writer.py:527
'/Users/sarangpark/Documents/Math/NEWMATH/media/videos/blackhole/1080p60/partial_movie_files/Paragraph1/1337029147_48913810
0_2687687067.mp4'
INFO Combining to Movie file. scene_file_writer.py:617
INFO scene_file_writer.py:737
File ready at '/Users/sarangpark/Documents/Math/NEWMATH/media/videos/blackhole/1080p60/Paragraph1.mp4'

                INFO     Rendered Paragraph1                                                                                                                     scene.py:247
                         Played 19 animations                                                                                                                                

Concatenating animation files to 'slides/files/Paragraph1' and generating reversed animations: 0%| | 0/3 [00:00<?, ?it/s][05/17/24 01:45:04] WARNING Skipping video file utils.py:22
/Users/sarangpark/Documents/Math/NEWMATH/media/videos/blackhole/1080p60/partial_movie_files/Paragraph1/3938426210_1717940294_2784191530.
mp4 because it does not contain any video stream. This is probably caused by Manim, see:
#390.
ERROR Application provided invalid, non monotonically increasing dts to muxer in stream 0: 810000 >= 808500 utils.py:60
╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
│ /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/manim/cli/render │
│ /commands.py:120 in render │
│ │
│ 117 │ │ │ try: │
│ 118 │ │ │ │ with tempconfig({}): │
│ 119 │ │ │ │ │ scene = SceneClass() │
│ ❱ 120 │ │ │ │ │ scene.render() │
│ 121 │ │ │ except Exception: │
│ 122 │ │ │ │ error_console.print_exception() │
│ 123 │ │ │ │ sys.exit(1) │
│ │
│ /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/manim_slides/sli │
│ de/manim.py:97 in render │
│ │
│ 94 │ │ │
│ 95 │ │ config["max_files_cached"] = max_files_cached │
│ 96 │ │ │
│ ❱ 97 │ │ self._save_slides() │
│ 98 │
│ 99 │
│ 100 class ThreeDSlide(Slide, ThreeDScene): # type: ignore[misc] │
│ │
│ /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/manim_slides/sli │
│ de/base.py:491 in _save_slides │
│ │
│ 488 │ │ │ │
│ 489 │ │ │ # We only concat animations if it was not present │
│ 490 │ │ │ if not use_cache or not dst_file.exists(): │
│ ❱ 491 │ │ │ │ concatenate_video_files(slide_files, dst_file) │
│ 492 │ │ │ │
│ 493 │ │ │ # We only reverse video if it was not present │
│ 494 │ │ │ if not use_cache or not rev_file.exists(): │
│ │
│ /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/manim_slides/uti │
│ ls.py:60 in concatenate_video_files │
│ │
│ 57 │ │ │ │ packet.stream = output_audio_stream │
│ 58 │ │ │ else: │
│ 59 │ │ │ │ continue # We don't support subtitles │
│ ❱ 60 │ │ │ output_container.mux(packet) │
│ 61 │ │
│ 62 │ os.unlink(tmp_file) # https://stackoverflow.com/a/54768241
│ 63 │
│ │
│ in av.container.output.OutputContainer.mux:207 │
│ │
│ in av.container.output.OutputContainer.mux_one:228 │
│ │
│ in av.container.core.Container.err_check:286 │
│ │
│ in av.error.err_check:328 │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
ValueError: [Errno 22] Invalid argument: 'slides/files/Paragraph1/9a0e95b3fee2a04ed822a0b476064663528145f26b39900b189f486d99c14fb7.mp4'; last error log: [mp4] Application
provided invalid, non monotonically increasing dts to muxer in stream 0: 810000 >= 808500

@Sarang0218
Copy link
Author

ah okay I've inspected the error more closely. I have checked out #390 , but that was supposed to be closed already.. what? I'm going to try reinstalling manim.

@Sarang0218
Copy link
Author

does not work on 0.18.1 either. is there any way to solve this quick?

@Sarang0218
Copy link
Author

I just decided to go over every single line of code, and remove what doesn't work. It works fine now, but I hope there will be a definite solution in the future

@jeertmans
Copy link
Owner

Hello @Sarang0218, can you check if one of partial movies files is an empty file?

Also, could it be possible to reduce the size of your example?

@jeertmans jeertmans added the lib Related to the library (a.k.a. module) label May 17, 2024
@jeertmans jeertmans added the waiting author Waiting author response label Dec 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working lib Related to the library (a.k.a. module) waiting author Waiting author response
Projects
None yet
Development

No branches or pull requests

2 participants