Watch This When You're High - CRAM CWIS and Phalanx Weapon System Videos.

This shit is insane. 

Here's an FAQ and videos with details about how these things work.

-5:01-6:12 the boat is estimated to be about 2 miles / 3300 meters

-6:15 a base is attacked and multiple C-RAMs engage, as they detect incoming fire they can also pinpoint the general location of the enemy fire. As the video continues, the C-RAMs begin to get overwhelmed by the incoming fire and we can see the shots spraying wildly trying to get as many incoming shots as they can. As the C-RAMs generate data on the incoming fire and pinpoint locations of the enemy, a fire mission is called in response to the enemy. The cameramen are most likely one of the people that are given the fire mission to take out the enemy, the cameraman can be heard yelling "Get some H.E. (High. Explosive. rounds) now!"

- These are used to shoot incoming mortars/rockets and stuff

- Russia has a system similar called the kashtan, inspired by the US system.

- These turrets are a last resort, there are many other defenses to shoot stuff down

-The big red line you see are 20mm self-destructing tracer bullets, the Iraqis actually thought this and the AC130 were shooting lasers when they first saw them in action.

-The C-RAM ammunition self destructs on impact or after its traveled a certain distance (you can see the red line turn to white circles before disappearing, that's the self destruct). The self-destruction basically turns the round into very tiny debris and is pretty much carried away by the wind.

-The CIWS (the one on the ship) shoots 20mm tungsten armor-penetrating bullets with NO self destruct, they will fall down back to earth. (RIP fish)

The Phalanx Close-In Weapons System (CIWS) was developed as the last line of automated weapons defense (terminal defense or point defense) against anti-ship missiles (AShMs), including high-g and maneuvering sea-skimmers. The basis of the system is the M61 Vulcan Gatling gun autocannon. Consisting of a radar-guided 20 mm (0.79 in) Gatling gun mounted on a swiveling base, the Phalanx has been used by Navies around the world. 

The gun mount moves at a very high speed and with great precision. The system takes minimal inputs from the ship, making it capable of functioning despite potential damage to the ship.

Shoutout to Hahucks and LiberalTears for the suggestion. Keep them coming. And keep them classy. No butt stuff.