video file I/O

I am writing a demo program on TK1 which involves reading a mp4 video file. The mp4 file has 3M pixel resolution.

I use Opencv VideoCapture, and it takes about 45 ms for each frame to load without display.

What is the most efficient way to load a mp4 video on TK1 ?


Hi Peter, FYI, you might have a better shot at getting an answer if you post some example code.

Hi cstotts,

I thought the code with VideoCapture should be straightforward. Anyway, it is mostly attached as follows. Note that the GPU version is not supported by TK1.

Someone suggested that OpenCV VideoCapture is based on FFMPEG, which may not be optimized on ARM cpu.

NVIDIA claims that TK1 is a monster board for computer vision. But if it takes ~45 ms per frame just to load a video, it is a very slow monster. :-)

I also read some random materials on Gstreamer, which seems to use the codec chip. But I cannot find any useful sample code to do the very basic task, which is to load a video file into a program for processing.


int ProcessFile(string fn_cfg, string fn_video, int process_framerate)

#if GPU_TK1

gpu::VideoReader_GPU m_Cap;


VideoCapture m_Cap;


int i=0;

#if GPU_TK1;
if (m_Cap.isOpened()) {
if ( {

int key, pause_key;
key = cvWaitKey(1);
pause_key = key;

Mat m_InputMat;

#if GPU_TK1

while ( == true && key != 'q' && pause_key != 'q') {;

while ( == true && key != ‘q’ && pause_key != ‘q’) {

    Mat display;

        resize(m_InputMat, display, Size(0,0), 0.4, 0.4);
        cv::imshow("input", display);

    key = cvWaitKey(1);

    if (key==' ' || pause_key==' ')
        pause_key = cvWaitKey(-1);

#if GPU_TK1
m_Cap.release(); // reset the video, to generate the desired results images

return 0;


visionworks fetch is even slower …

nvgstplayer can play the video fast enough , but no source code is available ?

Hello, peter:
In visionworks sample, there’s a program called nvx_sample_player.
You can refer to that demo. It runs faster.