exit with error code if av_encode failed