mirror of
https://github.com/3b1b/manim.git
synced 2025-09-01 00:48:45 +00:00
Add point to point streaming from ffmpeg to mplayer via TCP
This commit is contained in:
parent
312c2b0243
commit
f898644a3c
2 changed files with 12 additions and 1 deletions
|
@ -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 True
|
||||
if os.name == 'nt':
|
||||
shutil.move(*self.args_to_rename_file)
|
||||
else:
|
||||
|
|
4
test1.py
4
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
|
||||
|
|
Loading…
Add table
Reference in a new issue