Video playback in C++

4.20.09

Video (as well as audio) are very hairy things in C++ usually forcing one to revert back to C if not even Assembly as the SDL audio library does. FFMPEG is no exception, it is designed fully intentionally with a C mentality, full of pointers and structures. I only do not complain more due to the fact that it is the only video playback library that works for C++. Getting started is very daunting and there is only about one tutorial that seems to work and even that is not very useful.

For the face tracking project I have been involved in I need something that could open a movie file and as quickly as possible return matrix of the current frame in RGB format. Since it took me two days to get the results I wanted I thought I would make it publicly available so other projects can benefit from it in the future. (I am sure I will be using it again!)

The code is documented and only depends on the FFMPEG library. There is some usage of the Eigen library, but that can be easily removed for it is only used at the last step of getting a frame (for creating the RGB matrix).

The code can be downloaded from here