# Bins

A bin is a container element. You can add elements to a bin. Since a bin is an element itself, it can also be added to another bin.

Bins allow you to combine a group of linked elements into one logical element. You do not deal with the individual elements anymore but with just one element, the bin. We will see that this is extremely powerful when you are going to construct complex pipelines since it allows you to break up the pipeline in smaller chunks.

The bin will also manage the elements contained in it. It will figure out how the data will flow in the bin and generate an optimal plan for that data flow. Plan generation is one of the most complicated procedures in GStreamer.

## Visualisation of a bin with some elements in it

There are two specialized bins available to the GStreamer programmer:

- a pipeline: a generic container that allows scheduling of the containing elements. The toplevel bin has to be a pipeline. Every application thus needs at least one of these.

- a thread: a bin that will be run in a separate execution thread. You will have to use this bin if you have to carefully synchronize audio and video, or for buffering. You will learn more about threads in .