YG & AD AK-47 Shots Rip Music Video Set

5/16/2016 2:10 PM PDT

YG & AD -- AK-47 Shots Rip Music Video Set

EXCLUSIVE

YG and AD were in the middle of filming a rap video in Compton when bullets sent more than 200 people running and ducking ... TMZ has learned.

It all unfolded Sunday afternoon as the rappers shot their video for "Thug." Production came to an immediate halt though when the shots started, and law enforcement sources tell us it appears to be gang related. Not coincidentally, we're told there were Bloods and Crips on the set.

We're also told officers found about 30 shell casings from an AK-47 on the ground, and a handgun was recovered. Cops haven't figured out who owns the gun. YG and his crew were briefly detained before getting released. 

So far no one's been arrested, and no one was hit in the hail of shots.

A rep for YG tells us he had no involvement and fully cooperated with cops.