read camera without delay causes `Could not scale frame` on MacOS
Opened this issue · 4 comments
The code:
import VideoIO
cam = VideoIO.opencamera()
while true
img = read(cam)
end
Throws the error:
ERROR: LoadError: Could not scale frame
Stacktrace:
[1] error(s::String)
@ Base ./error.jl:33
[2] exec!(s::VideoIO.SwsTransform)
@ VideoIO ~/.julia/packages/VideoIO/EsW3Z/src/frame_graph.jl:115
[3] execute_graph!
@ ~/.julia/packages/VideoIO/EsW3Z/src/avio.jl:456 [inlined]
[4] _retrieve!(r::VideoIO.VideoReader{true, VideoIO.SwsTransform, String}, buf::PermutedDimsArray{ColorTypes.RGB{FixedPointNumbers.N0f8}, 2, (2, 1), (2, 1), Matrix{ColorTypes.RGB{FixedPointNumbers.N0f8}}})
@ VideoIO ~/.julia/packages/VideoIO/EsW3Z/src/avio.jl:467
[5] retrieve(r::VideoIO.VideoReader{true, VideoIO.SwsTransform, String})
@ VideoIO ~/.julia/packages/VideoIO/EsW3Z/src/avio.jl:506
[6] read(::VideoIO.VideoReader{true, VideoIO.SwsTransform, String})
@ VideoIO ~/.julia/packages/VideoIO/EsW3Z/src/avio.jl:610
[7] top-level scope
@ ~/repo/julia-awesomeness/camera.test.jl:84
in expression starting at /Users/macpro/repo/julia-awesomeness/Boilerplate.jl/rtsp.test.jl:83
The issue is interesting in that sense read
does run 10-20 times before in always just returns this error.
I tried to dig into the issue, but I didn't really know how I could debug the sws_scale
function. Thank you in advance.
As for now, I guess the issue was because I used read too often. Probably its limited by the camera FPS?
We could get what causes the limit, and maybe state it in the error code.
If its not worth the pain, then I am closing the issue. :)
I can reproduce this.
It does seem like a bug. IMO reading in a loop like this is a reasonable thing to do
Any ideas on what might be causing this, and is this platform specific(is it a issue on linux too or not)? I face it on windows despite sleep times of 2 sec