Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow editing multiple videos at the same time. #480

Open
Eggiverse opened this issue Apr 26, 2022 · 3 comments
Open

Allow editing multiple videos at the same time. #480

Eggiverse opened this issue Apr 26, 2022 · 3 comments
Labels
enhancement New feature or request

Comments

@Eggiverse
Copy link

Problem

I am trying to make several videos that share some logics.
I realize I have to completely finish 1 video before starting making another one since CURRENT_VIDEO contains only 1 video object.
This makes my code less neat since I want to create several similar objects that belong to different video in a loop.

My solution

If objects can be created by naming the video object where they should be explicitly, it will enable making several videos at the same time. For example:

videos = [Video(500, 500) for i in 1:10]

......

obs = []
for (i, video) in enumerate(videos)
    ob = Object(video, frames, create_fun, Point(0,0))
    push!(obs, ob)
end

......

for (i, video) in enumerate(videos)
    render(video; "output/$i.mp4")
end

New Object api should work with existing api well because of multiple dispatch.
A new method of Object and other related functions like Background can be added.

For example:

function Object(video::Video, frames, func::Function, start_pos::Union{Object,Point}; kwargs...)
# Do not check if CURRENT_VIDEO is empty or not.
......

end

Construction of Video should also be altered to meet the new requirement. I haven't come up with a good idea about how.

@Eggiverse Eggiverse added the enhancement New feature or request label Apr 26, 2022
@Wikunia
Copy link
Member

Wikunia commented Jun 12, 2022

I'm sorry that I missed this issue for so long. Yes I think that is a reasonable approach. I think there are a few more changes that need to be made like it would be good to store the video struct in every Object then and let it default to the current video.
Your approach would also make it easier to run Javis in Pluto as Pluto needs to figure out which cells depend on each other.

Are you yourself interested in working on a PR for this?

@Eggiverse
Copy link
Author

I might have time for PR next month if that is fine with your plan.

@ArbitRandomUser
Copy link
Contributor

ArbitRandomUser commented Jun 24, 2022

that'd be neat , until then if one wants to just re-use objects between videos one can still append one videos objects to another video

using Javis
video1=Video(500,500)
Background(1:5,(v,o,f) -> (background("white")))
line1 = Object(1:5,(v,o,f) -> line(O,O+100,:stroke))
line2 = Object(1:5,(v,o,f) -> line(Point(100,0),Point(0,100),:stroke))
render(video1,pathname="vid.mp4")

video2 = Video(600,600)
Background(1:5,(v,o,f) -> (background("white")))
append!(video2.objects,line2)
line3 = Object(1:5,(v,o,f) -> line(O,Point(0,100),:stroke))
render(video2,pathname="vid2.mp4")

vid.mp4 will have line1 and line2 , but vid2.mp4 will have line2 and line3
you can also import all the objects using video1.objects[2:end] if you ensure that the first Object you create in video1 is Background

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants