Check if opencv is using the GPU enabled FFMPEG

asked 2018-06-22 00:07:13 -0600

Dyex719 gravatar image

updated 2018-06-22 00:08:22 -0600

I am trying to use the GPU version of ffmpeg with opencv. I got the GPU enabled version of FFMPEG from cloning https://git.ffmpeg.org/ffmpeg.git . I compiled opencv by specifying the paths of the GPU version.

When I run ffmpeg, I get: ffmpeg version N-91329-g830695b Copyright (c) 2000-2018 the FFmpeg developers built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.6) 20160609 configuration: --enable-cuda --enable-cuvid --enable-nvenc --enable-nonfree --enable-libnpp --extra-cflags=-I/usr/local/cuda/include --extra-ldflags=-L/usr/local/cuda/lib64 --enable-shared --disable-static libavutil 56. 18.102 / 56. 18.102 libavcodec 58. 20.103 / 58. 20.103 libavformat 58. 17.100 / 58. 17.100 libavdevice 58. 4.101 / 58. 4.101 libavfilter 7. 25.100 / 7. 25.100 libswscale 5. 2.100 / 5. 2.100 libswresample 3. 2.100 / 3. 2.100 Hyper fast Audio and Video encoder usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...

When I run getBuildInformation from opencv I get: Video I/O: DC1394 1.x: NO DC1394 2.x: YES (ver 2.2.4) FFMPEG: YES codec: YES (ver 58.20.103) format: YES (ver 58.17.100) util: YES (ver 56.18.102) swscale: YES (ver 5.2.100) resample: NO gentoo-style: YES GStreamer: NO OpenNI: NO OpenNI PrimeSensor Modules: NO OpenNI2: NO PvAPI: NO GigEVisionSDK: NO UniCap: NO UniCap ucil: NO V4L/V4L2: NO/YES XIMEA: NO Xine: NO gPhoto2: NO

I assume that everything is compiled properly because the ffmpeg versions match. However when I run a small decoding program to test whether ffmpeg uses GPU or not, I do not see the program on nvidia-smi.

As another observation, the FFMPEG version mentioned above appears on nvidia-smi (uses 378 MB) when running ffmpeg -vsync 0 -c:v h264_cuvid -i /home/user/video.mp4 -f rawvideo output.yuv

Is there any mistake in my procedure? How else can I validate my results? Any help would be greatly appreciated! Thank you!

edit retag flag offensive close merge delete