The Planning (or Sprint Planning meeting) is a bipartite meeting at the start of each iteration. The two parts are called Planning 1 and Planning 2.
In Planning 1 Product Owner and (development) team negotiate about which user stories will be implemented for the next product increment (i.e. during the next Sprint). Completing the set of user stories agreed upon defines the Sprint Goal. At the end of the meeting the team must commit to this goal.
The Planning 2 is a separate meeting after Planning 1 – usually held by (development) team members only – where all user stories are split up into Tasks, so that implementation can start immediately when a developer picks a user story.
Current team size (illnesses, vacations, etc.), available expertise, etc. affect the team capacity. The product owner takes this into account for stuffing user stories into the Sprint Backlog.