def _escape_ffarg(arg):
    """
    Escape FFmpeg filter argument. See ffmpeg-filters(1), "Notes on
    filtergraph escaping".
    """
    arg = arg.replace('\\', '\\\\')
    arg = arg.replace("'", "'\\\\\\''")
    arg = arg.replace(':', '\\:')
    return "'{}'".format(arg)
