In the fruit fly,Drosophila melanogaster, connectome data and genetic tools provide a unique opportunity to study complex behaviors including navigation, mating, aggression, and grooming in an organism with a tractable nervous system of 140,000 neurons. Here we present the Fly Disco, a flexible system for high quality video collection, optogenetic manipulation, and fine-grained behavioral analysis of freely walking and socializing fruit fly groups. The data collection hardware and software automates the collection of videos synced to programmable optogenetic stimuli. Key pipeline features include behavioral analysis based on trajectories of 21 keypoints and optogenetic-specific summary statistics and data visualization. We created themultiflydataset for pose estimation that includes 9701 examples enriched in complex behaviors. All hardware designs, software, and themultiflydataset are freely available.