Video playback in terminal via. ImageInTerminal.jl and VideoIO.jl
Experimental! Owes a lot to ImageInTerminal!
julia> using VideoInTerminal
julia> framestack = map(i->rand(Gray{N0f8},60,40), 1:200); # a vector of images of the same type and dims
julia> play(framestack) # play through the framestack
julia> colorcube = rand(Gray{N0f8},60,40,30);
julia> play(colorcube, 2) # play slices along dim 2
julia> play("path/to/video.mp4")
kwargs:
fps::Real
: play the framestack back at a target fps (default 30)maxsize::Tuple
: specify a max video size in terminal characters. Default is determined from terminal window size
p
orspace-bar
: pauseleft-
orup-arrow
: step backward (in framestack mode)right-
ordown-arrow
: step forward (in framestack mode)ctrl-c
orq
: exit
explore
methods mimic play
methods except starting paused.
Control keys enable stepping through the selected dimension
julia> using VideoInTerminal, TestImages
julia> img = testimage("mri-stack");
julia> explore(img, 3) # explore img along the 3rd dimension, use arrow keys to move
View the primary system camera
julia> showcam()
or choose another capture device:
julia> VideoIO.init_camera_devices()
julia> VideoIO.init_camera_settings()
julia> devs = VideoInTerminal.VideoIO.CAMERA_DEVICES
2-element Vector{String}:
"FaceTime HD Camera (Built-in)"
"Capture screen 0"
julia> showcam(device=devs[2])
VideoIO's test videos can also be accessed by name, which will be automatically downloaded
julia> testvideo("annie_oakley")
-
Exit the video with an interrupt via.
ctrl-c
-
If video playback isn't reaching the desired fps, try stopping the video and reduce the size of your terminal, or specify the
maxsize
kwarg as a tuple of width and height in terminal characters.If it's still slow, the internal downscaling in ImageInTerminal may be the limiting factor
-
ImageInTerminal
is exported, so color depth settings can be controlled as per the manual