Javis.jl icon indicating copy to clipboard operation
Javis.jl copied to clipboard

Supporting live streaming like Manim

Open freemin7 opened this issue 5 years ago • 8 comments

Manim has a python -m manim --livestream option and even options for Twitch python -m manim --livestream --to-twitch --with-key [streamkey] which allow to write the live rendered content to Twitch in real time.

It would be cool to be able to the same from Javis. This functionality might be better suited for a package on top of Javis. As far as i understand ffmpeg provides that functionality.

freemin7 avatar Aug 14 '20 23:08 freemin7

The related issue in Manim and how it was added is documented here: https://github.com/3b1b/manim/issues/335

freemin7 avatar Aug 14 '20 23:08 freemin7

Thanks for opening the issue. What I can see in the nearer future is the following: We can directly display the current frame in a window instead of saving it into a file. Then we can use OBS to stream our screen. I know it's dull but at least we would not need to wait to create a gif or later mp4 but instead could see directly what gets animated.

In general I plan on using an images array instead of saving every frame to an image file as this is what currently slows down Javis.

Wikunia avatar Aug 15 '20 05:08 Wikunia

Hey @freemin7, just following up here, any updates? I saw a post you made in the Julia Slack asking about ffmpeg regarding streaming:

ffmpeg -re -i input.mkv -c:v libx264 -preset veryfast -b:v 3000k -maxrate 3000k \
-bufsize 6000k -pix_fmt yuv420p -g 50 -c:a aac -b:a 160k -ac 2 \
-ar 44100 -f flv rtmp://live.twitch.tv/app/<stream key>

TheCedarPrince avatar Sep 13 '20 02:09 TheCedarPrince

It might be interesting to have minimal examples like this:

  • A clock widget which streams the current system time (not a calculated time) and displays an image of an cuckoo between X:00:00 - X:00:59
  • If possible an interactive demo where you can set functions in a Julia shell to change what is displayed in real time

Both demos should work with OBS.

freemin7 avatar Jun 15 '21 21:06 freemin7

@freemin7 - the latter should be in our documentation. The former idea is being worked on in #345

I know you requested this feature a while ago but I would love to see what animations you should come up with! :)

TheCedarPrince avatar Jun 15 '21 21:06 TheCedarPrince

I didn't find them a new one in https://wikunia.github.io/Javis.jl/dev/examples/#Examples .

https://wikunia.github.io/Javis.jl/dev/workflows/#Live-Streaming shows how to set it up with OBS. However i am unsure how to set up an background as 1:Inf seems dubious.

freemin7 avatar Jun 15 '21 22:06 freemin7

Hi @freemin7 , it's unfortunately not yet live streaming see #345 The animation is getting rendered before it is sent to obs. As it's sent as a gif such that the animation is just getting repeated.

Wikunia avatar Jun 16 '21 04:06 Wikunia

I would phrase the comment by @TheCedarPrince a bit differently about the interactive demo. It is only possible in the sense that you can change your code and render it again with which it will replace the old animation.

Wikunia avatar Jun 16 '21 08:06 Wikunia