OpenCV4Tegra Video Input

I am getting started with OpenCV4Tegra by following cudacast-20 (

I installed the latest versions of the drivers and OpenCV4Tegra via JetPack (

After everything was installed I built the bgfg_segm sample. However I can’t get it to run because it can’t open 768x575.avi. I am assuming this is because OpenCV4Tegra is not built with the necessary codecs but I could be wrong.

Is it possible to read encoded video with OpenCV4Tegra?


I flash R21.3 and install OpenCV4Tegra from this link (, and I test the bgfg_segm sample by using the source tarball from OpenCV official website (

To compile it (at opencv-2.4.10/samples/cpp):

$ g++ bgfg_segm.cpp -lopencv_core -lopencv_imgproc -lopencv_highgui -lopencv_calib3d -lopencv_contrib -lopencv_features2d -lopencv_flann -lopencv_
gpu -lopencv_legacy -lopencv_ml -lopencv_objdetect -lopencv_photo -lopencv_stitching -lopencv_superres -lopencv_video -lopencv_videostab -o bgfg_segm

Test with 768x575.avi (test video is not in the same folder):
$ ./bgfg_segm -c false -fn=…/gpu/768x576.avi

It works well. Could you check if the file exists in your specified path and put the error message here?

Thanks. I was missing the -c false argument.