A judge who visited the Pedrinhas jail days after the decapitations demanded in a report the government of Maranhao state regain control of the inmate population, CNN reported Tuesday.
The video, recorded Dec. 17, shows inmates posing with the bodies. It was provided to the newspaper Folha de Sao Paulo by a union of jail workers.
Some 62 inmates were killed inside the prison in 2013.
The report by Judge Douglas Martins also documented that women visiting the prison were forced to have sex with leaders of prison gangs so that relatives in the prison wouldn't be killed.
Rival gangs from the capital of Maranhao state where the prison is located and the interior of the state are kept in Pedrinhas, which is severely overcrowded. Built to house 1,770 inmates, it now holds 2,196.
The state reached an agreement with the Brazilian government this week to transfer leaders of the gangs to federal prisons.