Velocity and Capacity are both critical metrics to consider in Sprint Planning. As a reminder...
Velocity is a running average of the amount of user story points a team manages to achieve in its sprints - a historical view of what has happened
Capacity is a way of forecasting the team's availability (in the future) to work on stories in the upcoming sprint(s). Capacity is measured in time.
Capacity is affected by activities which can be represented as overhead - fixed and variable.
Fixed overhead represents the routine activities that the team members must be involved in sprint to sprint - such as Sprint Planning, Daily Standups, Backlog Refinement, Showcases/Sprint Reviews and Retrospectives and preparation for those activities. This can be considered as 'Scrum overhead'. All of those activities take time and for a typical team using Scrum that adds up to around 20-25% of each team member's time each week
Variable overhead describes other occasions - this might be team offsites, town hall meetings, holidays, workshops and other non-Scrum/non-user story related work which affect the teams availability to get stuff done
So...consider this example:
Let's say a team has 4 team members that do the actual story work each sprint. The team works to a 2 week sprint cadence which represents 10 working days. A working day (for sake of easier calculations) is 8 hours long. Let's also assume too, that the team has an average velocity of 64 story points per 2-week sprint.
So, the team's capacity (incorporating Fixed overhead) can be determined as follows:
4 (team members) x 10 (days) x 6 (hours ie. 8 hours less 25% in fixed overhead) = 240 hours of time
This is the team's Normal capacity - which describes the maximum time the team has available to work on delivering User Stories.
Now, for an upcoming sprint you then deduct any Variable overhead that you're aware of. Eg. Steve is going to be on leave for one day (6 hours), and the whole team has a half day workshop (4 hours x 4 team members = 16 hours) for a total of 22 hours of Variable overhead.
The team's adjusted capacity for the next sprint is 240 hours (normal capacity) - 22 hours (variable overhead) = 218 hours adjusted capacity.
Now, armed with this information you can calculate expected velocity for the upcoming sprint. You do so with the following simple formula:
Adjusted Capacity/Normal Capacity * Average story point velocity = Expected story point velocity
e.g 218/240 * 64 = 58.13 points
During Sprint Planning you'd then look to bring into your sprint backlog about 58 points of work for the upcoming sprint.