C, C++ and Ffmpeg

Over the past week and a bit I have been battling with the problems of using a managed Java wrapper to interact with the FFmpeg (a video library). In short, all of the wrappers I have found only extend the higher-level functionality of the library – I need to interact with lower-level packet/frame data.

So, to cut a long story short, trying to link a simple C++ file using the g++ compiler seemed to be somewhat problematic. However, after significant experimentation, I have been able to link to the library from a C file using gcc and a makefile to build the source.

I can now iterate the frames of a video file in C, identifying aspects such as keyframes, motion vectors and DCT coefficients. I have worked out the basics of video decoding, particularly for h264 (which is the format of my test video).

I am experimenting with attempting to re-encode the video in the same format without any modification. Once I have established how to encode a video during the decoding process, I can experiment with data manipulation.