The ones you’ll see in films and TV are, for the most part, blanks. These are cartridges that lack a projectile. They’ll have a full, or mostly full, powder charge, with some paper wadding to keep the powder in the shell before firing.
These are much safer than firing live rounds, for somewhat obvious reasons.
When you fire a normal, modern, cartridge: the primer detonates, igniting the powder, pushing the bullet into motion. The muzzle flash you see is burning powder escaping the barrel.
With a blank: the primer detonates, igniting the powder, ejecting most of the still burning powder down the barrel. Propellant that would normally be consumed pushing the projectile gets to wander free and burn in the open atmosphere.
At least, that’s my recollection. I haven’t spent much time with blanks, and all of that was with nail guns, so I could be wrong about exactly why this happens.
It’s probably worth pointing out that blanks can actually be quite dangerous at close range. The biggest risk is the burning powder. With a normal round, fired at close ranges, burning powder can cause minor injuries. Called “stipling,” this is often useful in establishing if the shooter and the victim were within a few yards of each other. It can also result in minor burns from a short range near miss.
With a blank, you’re looking at the entire load of powder being dumped into someone’s face, the burns can be nasty. It’s not quite the same as pumping a round into them, these burns can be lethal. At very close ranges, the kinetic shock from high power blanks can break bones. In some cases, the wading (usually paper or light plastic) can penetrate and function as an impromptu bullet.
Incidentally, you could scale back the powder to produce a more “realistic” muzzle flash. But, with any automatically cycling firearm, under-powered cartridges have a nasty habit of not delivering enough force to cycle the mechanism. A good example of this would be loading 12 gauge flare shells or dragon’s breath shells into a semi-automatic shotgun. The gun can fire them, but you’ll need to manually cycle it between shots, because neither produces enough force to actually cycle the action. This can also happen when crossloading rounds, like chambering a .380 in a 9x19mm pistol or a .40 in a 10mm pistol (do not try this, the results can be far worse than the pistol not cycling).