Skip to content

Commit

Permalink
Made live rendering faster
Browse files Browse the repository at this point in the history
  • Loading branch information
TheCedarPrince committed Sep 8, 2020
1 parent 70c2d53 commit a6fa540
Showing 1 changed file with 18 additions and 17 deletions.
35 changes: 18 additions & 17 deletions src/Javis.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1210,25 +1210,26 @@ function javis(

if liveview == true
javis_viewer(video = video, frames = length(frames), action_list = actions)
end

isempty(pathname) && return
if ext == ".gif"
# generate a colorpalette first so ffmpeg does not have to guess it
ffmpeg_exe(`-loglevel panic -i $(tempdirectory)/%10d.png -vf
"palettegen=stats_mode=diff" -y "$(tempdirectory)/palette.bmp"`)
# then apply the palette to get better results
ffmpeg_exe(`-loglevel panic -framerate $framerate -i $(tempdirectory)/%10d.png -i
"$(tempdirectory)/palette.bmp" -lavfi
"paletteuse=dither=sierra2_4a" -y $pathname`)
elseif ext == ".mp4"
finishencode!(video_encoder, video_io)
close(video_io)
mux("temp.stream", pathname, framerate; silent = true)
return "Live preview of $pathname"
else
@error "Currently, only gif and mp4 creation is supported. Not a $ext."
isempty(pathname) && return
if ext == ".gif"
# generate a colorpalette first so ffmpeg does not have to guess it
ffmpeg_exe(`-loglevel panic -i $(tempdirectory)/%10d.png -vf
"palettegen=stats_mode=diff" -y "$(tempdirectory)/palette.bmp"`)
# then apply the palette to get better results
ffmpeg_exe(`-loglevel panic -framerate $framerate -i $(tempdirectory)/%10d.png -i
"$(tempdirectory)/palette.bmp" -lavfi
"paletteuse=dither=sierra2_4a" -y $pathname`)
elseif ext == ".mp4"
finishencode!(video_encoder, video_io)
close(video_io)
mux("temp.stream", pathname, framerate; silent = true)
else
@error "Currently, only gif and mp4 creation is supported. Not a $ext."
end
return pathname
end
return pathname
end

"""
Expand Down

0 comments on commit a6fa540

Please sign in to comment.