Michael Nicholas shouted "n****" and "grass" at the victim, who was in a witness care room at South Tyneside Magistrates Court.
He used his mobile phone to record what he did, while peering in through a window pane in the internal door of the room the witness was in.
Newcastle Crown Court heard the footage he made inside the court was damning evidence against himself.
Prosecutor Shada Mellor told the court: "He was stood with his phone, peering through the window, recording the complainant and shouting phrases such as n**** and grass.
"He was also waving his arms angrily."
The court heard even after being removed from the building by security officers, Nicholas continued his intimidation by shouting outside the window of the private room that the witness was in.
Police then arrived and arrested Nicholas, who apologised and admitted "he didn't realise how serious this was".
The court heard the trial involving the witness could not go ahead that day.
Nicholas, 24, of Glasgow Road, Jarrow, admitted intimidation.
Mr Recorder Christopher Rose sentenced him to seven months behind bars with a five year restraining order and told him: "Complainants in any criminal case should be able to go to court and give their evidence unhindered and unintimidated."
The judge said intimidation towards any witness was a "serious matter" and told him: "Understandably, the courts always take that very seriously because it is effectively an attack on the system of justice.
"Justice can only be conducted and those who are in fact guilty of offences only tried properly and brought to justice if witnesses are able to give proper evidence."
The judge added that using a phone to record inside the building was a contempt of court itself and aggravated Nicholas' position.
Robin Turton, defending, said Nicholas' behaviour was a "sign of immaturity" and added: "He recorded it. It was a spur of the moment, thoughtless act.
"The evidence against the defendant was on his own phone."
Mr Turton said Nicholas, who has caring responsibilities for his mum and has children, realises his behaviour that day was "stupid".