There is a lot of misunderstanding about rights during a traffic stop. You may know your general rights, such as remaining silent. However, you may not understand your rights for taking a video of the stop.
According to FindLaw, you have the right to video the interaction. An officer may ask you to stop doing so, but this is not a request you must comply with.
The right to video an interaction with a law enforcement officer is something the courts have said falls under your First Amendment rights. To stop you from doing so is a violation.
Of course, there are exceptions. In a situation where an officer pulls you over, you generally are ok to video. However, if you are in a public space, you only have the right when you are legally allowed in the area where the situation is occurring and you are not trying to hide your recording activities. Officers can ask you to stop if your actions interfere with their ability to do their job.
You also may lose the right to video an interaction if you are on private property. The owner can make his or her own rules, which may include no videotaping.
To keep things legal, you should inform officers that you are recording and ensure that it does not become evasive and prevent officers from conducting their duties. If an officer tells you to stop recording, you can state your rights under the First Amendment. Do not get combative. Stay calm, and assert your rights verbally in a firm yet respectful manner.