JuliaAnimators / Javis.jl

Julia Animations and Visualizations
https://juliaanimators.github.io/Javis.jl/stable/
MIT License
829 stars 51 forks source link

Supporting live streaming like Manim #91

Open freemin7 opened 4 years ago

freemin7 commented 4 years ago

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 commented 4 years ago

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

Wikunia commented 4 years ago

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.

TheCedarPrince commented 4 years ago

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>
freemin7 commented 3 years ago

It might be interesting to have minimal examples like this:

Both demos should work with OBS.

TheCedarPrince commented 3 years ago

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

freemin7 commented 3 years ago

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.

Wikunia commented 3 years ago

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 commented 3 years ago

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.