Installing the video package

Hi, I’m not sure how to access the VideoReader() function–on Ubuntu 20.04 here. If I run ‘pkg install -forge video’ it fails although I have ffmpeg installed but it gives me an error that it doesn’t recognize it. This is for octave 6.3.0 installed from snap. Is there another package I should be installing?
I’m doing this for a researcher on an HPC cluster who needs the VideoReader function to read in data from a video. Ultimately I’d like to do this in a singularity container built Ubuntu20.04 and build from source and am getting the same errors there.

IIUC, snap applications run in a sandbox and cannot access binaries installed on the host.
I don’t know if there is a way to break out of that confinement.
But you could ask at octave-snap/octave-snap: Octave snap packaging (github.com) if the maintainer of the snap package would consider packaging the necessary dependencies to install the video package…

I don’t know much about singularity containers. But I would imagine that it might work if you included all dependencies in that container.

Hi, thank you for responding! Although it was staring me in the face in the documentation, the video package is a wrapper for some functions from OpenCV, which I had not yet installed. Once I installed OpenCV on my laptop, then the video package was able to be installed.

1 Like

Great you could resolve the issue :slightly_smiling_face: :+1:

Usually, pkg throws an error message, which is in many cases helpful and also in this case hopefully pointed to the missing package dependencies.

If possible, can you replicate the missing OpenCV condition and post the pkg-error message here? Then if the message is gibberish, the video package maintainer can improve it to avoid other users to run into the same problem again :slightly_smiling_face:

Thanks for following up. Without OpenCV installed, the error message I received was:

configure: error: FFmpeg libswscale, libavformat, libavcodec or libavutil not found
checking whether the C++ compiler works… yes
checking for C++ compiler default output file name… a.out
checking for suffix of executables…
checking whether we are cross compiling… no
checking for suffix of object files… o
checking whether we are using the GNU C++ compiler… yes
checking whether g++ accepts -g… yes
checking for mkoctfile… yes
checking for pkg-config… /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0… yes
checking for FFMPEG… no

pkg: error running the configure script for video.
error: called from
configure_make at line 82 column 9
install at line 192 column 7
pkg at line 441 column 9

Note that OpenCV was not mentioned in the error message and I had installed ffmpeg and libav* libraries on the system.

Once I installed libopencv-dev (and python3-opencv although not related to Octave), the package install worked.

While the package information directly mentions that it’s a wrapper for OpenCV functions, the only prereqs are ffmpeg and libav. Perhaps OpenCV could be listed as a prereq.

Most likely you were missing ffmpeg-dev and opencv-dev just pull it in as dependency.

Thanks for the information @jthiels. @andy can you clarify what is needed to install the video package?

https://octave.sourceforge.io/video/index.html

@dasergatskov On Ubuntu 20.04, there does not seem to exist a single ffmpeg-dev package, it is split into many dev packages :sweat:

https://packages.ubuntu.com/en/source/focal/ffmpeg

There is no need to install any OpenCV libraries. ffmpeg-dev on Debian, ffmpeg-devel on fedora and centos should be sufficient.

I don’t have Ubuntu 20.04 in the dockerfile tests yet but from the configure messages above you need libswscale, libavformat, libavcodec or libavutil

1 Like

I’ve checked in ubuntu 20.04 (Octave Forge / video / Commit [937a51])

NAME=“Ubuntu”
VERSION=“20.04.3 LTS (Focal Fossa)”
OCTAVE_VERSION = 5.2.0
FFmpeg_versions = Lavu56.31.100, SwS5.5.100, Lavc58.54.100, Lavf58.29.100
PASSES 1 out of 1 test

So “apt install libswscale-dev libavformat-dev libavcodec-dev” is enough

1 Like

@andy Thank you very much for checking :slightly_smiling_face:

1 Like

Thank you indeed. I’m not getting the above error anymore, but I do get (Octave 5.2.0, Ubuntu 20.04):

octave:2> v = VideoReader(“atrium.avi”)
error: ‘cap_open’ undefined near line 77 column 15
error: called from
VideoReader at line 77 column 13

Any thoughts? Thank you for your help and especially for your patience.