In theory you should be able to do it, as it's similar to how pumped-storage hydroelectric stations work. You just have a flow of people rather than water.
Perhaps more similar is the situation with cable car systems. When there's a lot of load coming down a mountain, it's not unusual for ballast to be added to the cars at the bottom station, (and removed at the top station) to help counterweight the mass coming down. This ballast absorbs power in its climb. When it's allowed back down this power is released.
The mass of belt/steps/ropes/cables/cars etc doesn't need to be considered as that going "up" balances that coming "down" (unless there's stretch of course)
The raw power released when a object falls is as follows
"Gravitational"_Power[W]= mass_flow_rate[Kg/s] * gravitational_constant[N/kg]
(use a negative value for flow if mass going UP)
For an escalator/cable car you plug it into the follow power equation to determine if you need to add, or take power out, of the system to maintain a constant speed.
Gravitational_power+Motor_power_IN - Power_to_overcome friction=0
If the gravitational_power is greater than friction then energy HAS to be extracted from the system or else the escalator would speed up. If the gravitational_power is less than friction then energy HAS to be added.
A brake simply transfers energy out of the moving system (which why brakes they heat up!).
So the problem would be one of extracting useful power...
Motors can be arranged to produce power when they are driven by a load (rather than driving the load) Problem is these dual purpose machines aren't as efficient as dedicated motors/generators. Costs are likely to higher, and there's more to go/wrong fix. Probably isn't economically viable.