Collective behaviour of animals has been a main focus of recent research, yet few empirical studies deal with this issue in the context of predation, a major driver of social complexity in many animal species. When starling (Sturnus vulgaris) flocks are under attack by a raptor, such as a peregrine falcon (Falco peregrinus), they show a great diversity of patterns of collective escape. The corresponding structural complexity concerns rapid variation in density and shape of the flock over time. Here, we present a first step towards unravelling this complexity. We apply a time series analysis to video footage of 182 sequences of hunting by falcons on flocks of thousands of starlings close to two urban roosts during winter. We distinguish several types of collective escape by determining the position and movement of individuals relative to each other (which determines darkness and shape of the flock over time) as well as relative to the predator, namely flash expansion', blackening', wave event', vacuole', cordon' and split'. We show that the specific type of collective escape depends on the collective pattern that precedes it and on the level of threat posed by the raptor. A wave event was most likely to occur when the predator attacked at medium speed. Flash expansion occurred more frequently when the predator approached the flock at faster rather than slower speed and attacked from above rather than from the side or below. Flash expansion was often followed by split, but in many cases, the flock showed resilience by remaining intact. During a hunting sequence, the frequencies of different patterns of collective escape increased when the frequency of attack by the raptor was higher. Despite their complexity, we show that patterns of collective escape depend on the predatory threat, which resembles findings in fish.Significance statementPatterns of collective escape in flocks of starlings have always intrigued laymen and scientists. A detailed analysis of their complex dynamics has been lacking so far, and is the focus of our present study: we analysed video footage of hunting by falcons on flocks of thousands of starlings and show how patterns of collective escape (namely flash expansion, blackening, wave event, vacuole, cordon and split) depend on the preceding pattern and on details of attack. A higher frequency of attack during a hunting sequence resulted in a higher frequency of collective escape events. Flash expansion happened most often when the predator attacks at greater speed. A wave event was most likely when the raptor attacks at medium (rather than high or low) speed. These results provide a first quantitative approach to social complexity in collective avoidance of a predator.