Skip to content

(Re) implementing livestreaming feature #441

@huguesdevimeux

Description

@huguesdevimeux

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 :
alt text
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 write play calls, and therefore it is not possible to live-render a play call. The best idea would be to have SpecialScene that would include ThreeDScene, 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 to manimlive). 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    SuggestionRequesting a feature or change for Manim

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions