Reading video stream from IP camera

I’m working on a project where I need to read an Internet video stream. I have the URL needed to connect to the IP camera. The camera administrator tells me that I can use either HTTP or RTSP (Real Time Streaming Protocol) to access the camera. I have no familiarity with HTTP, but I know there’s a HTTP.jl package available.

Can VideoIO.jl be used to read such a video stream, maybe with the help of HTTP.jl?

VideoIO supports reading from rtsp streams directly.

using VideoIO
using Plots

function play_video(url)
    strm = VideoIO.openvideo(url)

    img = read(strm)
    fig = plot(img)

    while !eof(strm)
        read!(strm, img)
        plot!(fig, img)


I tested this with my URL and it indeed works! Thank you so much.

I was so close. This is basically the same code as the first example in “Reading Video Files” in VideoIO.jl’s documentation:

It would be very nice if the docs above had another example where the frames are read from an RTSP stream instead of a file. Or maybe that’s kind of obvious for people familiar with the area…

Thanks again.