Closed abadredd closed 3 years ago
This should work:
using VideoIO
io = VideoIO.testvideo("annie_oakley")
f = VideoIO.openvideo(io)
img = read(f)
frames = Vector{typeof(copy(img))}(undef, 0)
push!(frames, copy(img))
while !eof(f)
read!(f, img)
push!(frames, copy(img))
end
close(f)
a = cat(frames..., dims = 3)
Note however that this is more of a help request than an actual issue with VideoIO.jl. Next time use Julia Discourse or the julia#video channel on slack for such cases.
There are some simpler ways to do this now in v0.9
Hey Guys,
Im relativity new to Julia and Im attempting to read a .mp4 video as a collection of frames. So far I have come across two methods to read the .mp4 data but having trouble reshaping them into the format I want.
The problem with this is the data read is in the form of
7606633-element Array{UInt8,1}
..... and I cant really make sense of it in terms of what portions of the data correspond to what frame,
The problem here the data is in this format
1080×1920 PermutedDimsArray(::Array{RGB{N0f8},2}, (2, 1)) with eltype RGB{FixedPointNumbers.Normed{UInt8,8}}:
Also when I try to play the video here I get
My GOAL: Find a way to convert the video data to a 3 dimensional matrix cube where the third dimension corresponds to the number of frames of the video and the colums and rows of each frame are of type Float64, to eventually utilize SVDS on the data and perform back substitution
svds(reshape(movie_cube, :, size(movie_cube, 3)), nsv=k)[1]