Adjusted code for newer version of ffmpeg