This is much like a palletizer. Here's a mixed-case cage palletizer, which fills up wire cages open on one side with various boxes.[1] For rectangular boxes, palletizing is a solved problem with many companies selling systems.
Irregular items are a problem. In the baggage handling video, the last bag, the soft one with straps, is sticking out after being placed in the baggage container. That's the same problem which keeps Amazon from totally automating picking. They keep trying, but nothing works well enough yet.