BEIJING — The top Chinese military official in Hong Kong has called the violent protests of recent weeks “absolutely intolerable,” in a threatening speech that coincides with the release of an extraordinary video showing Chinese soldiers practicing firing on demonstrators.

Together, the speech and the video served as a thinly veiled warning to the protesters in Hong Kong that China’s patience is growing thin and that it is becoming increasingly willing to use force to quell the demonstrations in the semiautonomous territory.

“We resolutely support the action to maintain Hong Kong’s rule of law by the people who love the nation and the city, and we are determined to protect national sovereignty, security, stability and the prosperity of Hong Kong,” said Maj. Gen. Chen Daoxiang, commander of the People’s Liberation Army garrison in Hong Kong.

He described the demonstrations, which have continued for eight consecutive weekends, as “absolutely intolerable.” The protests began as demonstrations against an extradition bill but have morphed into wider calls for democracy.

The demonstrations have turned violent at times and have become increasingly disruptive, but protesters have vowed to continue agitating for greater rights and fewer restrictions imposed by Beijing.

Chen made the remarks at a reception in Hong Kong on Wednesday night to mark the 92nd anniversary of the PLA’s founding, which fell on Thursday. Carrie Lam, the Beijing-backed chief executive of Hong Kong, attended the event.

“The incidents have seriously threatened the life and safety of Hong Kong citizens and violated the bottom line of ‘one country, two systems,’ ” Chen said, referring to the principle that Hong Kong is supposed to enjoy a high degree of autonomy from China.

At the same time, the Hong Kong garrison released a provocative video on its Weibo microblogging page that showed soldiers shouting into a loudspeaker in Cantonese, the language spoken in Hong Kong: “At your own peril!”

The soldiers, dressed in combat gear and holding shields, march forward and fire warning shots to disperse a pretend crowd in the streets. Some of the soldiers are carrying red banners that read, in English and Chinese, “Stop charging, or we use force.”

The caption on the video says: “The PLA’s Hong Kong Garrison is an important embodiment of China’s national sovereignty, a vital force of safeguarding the ‘One Country, Two Systems,’ and a cornerstone in maintaining Hong Kong’s prosperity and stability. What we have been doing is preparing for war, training hard on enemy-killing skills, and keep our weapons ready and always ready to attack!” 

The foreign minister of Taiwan, Jaushieh Joseph Wu, wrote on Twitter that “Beijing is celebrating Armed Forces Day in a most uncivilized fashion.” 

“The people of #HongKong are gifted a video of vile threats! The PLA is supposed to protect the people, not pound them into submission. It’s time for authoritarian China to back off!” Wu wrote in remarks that were sure to antagonize Beijing.

The Communist Party views Taiwan as a renegade province that belongs to China. Beijing has been making its unhappiness with the island’s independence-minded government increasingly clear in recent days, especially as Taiwan and Hong Kong’s protesters appear to band together in the name of democracy.

Asked how the world should interpret the video, Chinese Foreign Ministry spokeswoman Hua Chunying said people should “go ask the military.” She added, “We believe the PLA garrison in Hong Kong will continue to be the anchor for stability and prosperity in Hong Kong.”

Separately, about 190,000 armed police officers have been conducting summer drills in Guangdong, the southern Chinese province bordering Hong Kong, in exercises designed to prepare for National Day celebrations to be held in October that honor the country’s founding. The exercises involved armored vehicles and helicopters.

Although the drills are not unusual, the location is. Analysts noted that the celebrations will be concentrated in Beijing, in the north of the country, and that the soldiers began their drills by swearing to increase security in the days leading up to the grand parade in Beijing.

Lyric Li contributed to this report.