A community-maintained Python framework for creating mathematical animations.
Add point to point streaming from ffmpeg to mplayer via TCP
Mehmet Mert Yildiranf898644a3cfe
diff --git a/scene/scene.py b/scene/scene.pyindex f116cf525..5b65b9f08 100644--- a/scene/scene.py+++ b/scene/scene.py@@ -624,13 +624,20 @@ class Scene(Container):'-vcodec', 'libx264','-pix_fmt', 'yuv420p',]- command += [temp_file_path]+ if self.is_live_streaming:+ command += ['-f', 'mpegts']+ command += ['tcp://127.0.0.1:2000']+ else:+ command += [temp_file_path]+ print(' '.join(command))# self.writing_process = sp.Popen(command, stdin=sp.PIPE, shell=True)self.writing_process = sp.Popen(command, stdin=sp.PIPE)def close_movie_pipe(self):self.writing_process.stdin.close()self.writing_process.wait()+ if self.is_live_streaming:+ return Trueif os.name == 'nt':shutil.move(*self.args_to_rename_file)else:diff --git a/test1.py b/test1.pyindex ab2e173b6..169eb3414 100644--- a/test1.py+++ b/test1.py@@ -16,3 +16,7 @@ manim.play(GrowFromCenter(square))manim.play(Transform(square,triangle))manim.close_movie_pipe()++# mplayer -cache 8092 ffmpeg://tcp://127.0.0.1:2000?listen+# for listening the stream+# start mplayer before running this script