Selecting uniform number of trials before Time-frequency

The online averager embedded in the time-frequency process allows to compute averages of TF maps on the fly, but does not include all the features of the process "Average > Average files". In particular, it does not offer the option to sort the files by trial groups or folders: everything in input will be averaged together, as you noticed.

For producing two averages with the processes in the "Frequency" category, you need to call the process twice. Depending on how your data is organized, it might not be easy to do with the interface, and you might have to write a script for handling your file selection.

To get started with scripting with Brainstorm:
https://neuroimage.usc.edu/brainstorm/Tutorials/Scripting