ffmpeg: Avoid null pointer dereferences