If you photograph or film on-duty police officers in Illinois, you would probably be within your rights. Your First-Amendment right to free speech includes taking audiovisual recordings, and the Illinois eavesdropping laws that require consent of both parties before recording would not apply to police who are performing their duties in a public space.
However, this does not mean that you would have complete immunity while taking video. Officers could still arrest you for a crime unrelated to your filming. Furthermore, as outlined in the Atlantic, a recent Supreme Court decision could make it more difficult for you to prove in court that your arrest was motivated by your recording of the police.
The decision has the potential to reduce the limitations placed on officers in an arrest situation, protecting them from counter-action. The court decided that the motivation of your arresting officer as it pertains to the First Amendment would not be relevant in most cases. The exception would be if other people were engaged in the same actions as you, were not exercising their First-Amendment rights and did not end up arrested.
Of course, most police respect these constitutional rights, as they are an essential element of the laws that every officer swears to uphold. In fact, one of the main reasons the police might tell you to stop filming is for your own safety. The types of police situations you might find noteworthy enough to record typically contain an unknown level of risk to everyone in the vicinity.
To summarize, your recordings of the police are protected by the First Amendment of the U.S. Constitution and not prohibited by Illinois law. However, you may want to consider any officer’s request to stop filming in a broader context — especially if it comes along with a request to leave the area.