-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Description
This issue is mostly a reminder for myself, and a place to discuss about what we want and what we don't.
First of all, livestreaming with manim looks very powerful to my eyes, as it looks like this :
This gif has been taken from a previous PR in 3b1b/manim, meant to fix this feature : 3b1b/manim#786.
Unfortunalty, everything about livestreaming got broken at some point and was eventually removed, exepted streaming settings, ruins of the old world. Everything was removed in 3b1b/manim#985, so if you want to see how it used to be implemented, go there.
TL;DR : how could it work ? Well, it is actually pretty simple as ffmpeg
has lot of livestreaming features.
Proposal :
Here is what I propose to (re)implement, and how.
- Launching
manim --livestreaming
will pop an interactive python shell dedicated to get manim play/wait/etc calls. Pretty much what is on the gif sent above. - The InteractiveShell will got for variables a special scene. Why ? because if it's a regular
Scene
object, one has to write a Scene definition and a construct method in order to writeplay
calls, and therefore it is not possible to live-render aplay
call. The best idea would be to haveSpecialScene
that would includeThreeDScene
,GraphSCene
, etc. Indeed, there won't be no scene defintion in the shell so the user won't be able to specify which type of scene does they want. See stream_starter.py in this PR here to see how it used to work (it was pretty much how I described except using the old ans ugly CONFIG dict.). So, it would be possible to do :
>>> SpecialScene.play(Transform(object))
# Then it would appear on the live stream.
- I think there should be sort of "commands" of the live. For example, a command that would go back from x animations, render an existing scene (so, one would be able to keep working on a Scene while seeing changes in live), etc. I'm not sure how to implement that. The most obvious idea is to implement some methods to the
SpecialScene
(renamed here tomanimlive
). E.g :
>>> manimlive.go_back(animations = 2)
>>> manimlive.add_scene_from_file()
The problem is about variables. Going back in the video stream is fairly easy thanks to scene-caching ( ;) ), but if we decide that when one goes back, all the variables are set to their original values, then it won't be fairly easy. Same for adding an existing scene with all the variables that the new SCene will bring. (Note : for the last idea, it's likely impossible but it is worth trying).
- Speaking of config : it won't change anything, the streaming will use a
.cfg
. The idea is to have a [streaming] section in the .cfg. - Speaking of scene-caching, I think it will be possible to use it, which is cool.
- This will open the door to (re) implementing manim live-streaming on .. twitch. Which is cool as well.