Add point to point streaming from ffmpeg to mplayer via TCP

This commit is contained in:
Mehmet Mert Yildiran 2018-10-31 11:16:18 +03:00
parent 312c2b0243
commit f898644a3c
2 changed files with 12 additions and 1 deletions

View file

@ -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:

View file

@ -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