Demonstrators have protested against racism outside a South African court where two white men face assault charges for allegedly forcing a black man into a coffin and threatening to set him on fire.

The two accused, Willem Oosthuizen and Theo Martins Jackson, appeared briefly in the Magistrates Court in Middelburg, east of Pretoria, on Wednesday before the case was postponed until January 25.

The men will remain in custody until the case resumes.

The 20-second video, which was widely circulated on social media, shows the victim, Victor Rethabile, cowering inside a coffin as one man pushes a lid on his head and the other threatens to put petrol and a snake inside the coffin.

Rethabile escaped, although it is not clear how. He told reporters outside court he wanted justice.

"They were accusing me of trespassing. They beat me up and forced me into the coffin," he said.

The left-wing Economic Freedom Fighters (EFF) party, which campaigns for a more even distribution of wealth between white and black South Africans, led a rally outside the court.

READ MORE: Memorial confronts US South's history of lynching

"This humiliation can be based on nothing else but his blackness, which means it is in actual fact a humiliation of black people as a whole," the EFF said in a statement.

Hundreds of South Africans condemned the white men's behaviour on social media under the hashtag #coffinAlive.

Black people make up 80 percent of South Africa's 54 million population. However, most of the economy remains in the hands of white people, who account for about 8 percent of the population.

Inside Story - The uprising that changed South Africa

Source: News Agencies