Made some code general to use also in FFmpegWebVideo