Skip to content

[BUG] Non monotonically increasing dts #430

Open
@Sarang0218

Description

@Sarang0218

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinglibRelated to the library (a.k.a. module)waiting authorWaiting author response

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions