See
Note: You may have to modify the CMake script if you use a more recent version of FFMpeg than I described there.