The 164 statement can be recorded before a magistrate either in the open court or in camera.
the provision is reproduced below:
Any Metropolitan Magistrate or Judicial Magistrate may, whether or not he has jurisdiction in the case, record any confession or statement made to him in the course of an investigation under this Chapter or under any other law for the time being in force, or at any time afterwards before the commencement of the inquiry or trial:
Provided that no confession shall be recorded by a police officer on whom any power of a Magistrate has been conferred under any law for the time being in force.
(2) The Magistrate shall, before recording any such confession, explain to the person making it that he is not bound to make a confession and that, if he does so, it may be used as evidence against him; and the Magistrate shall not record any such confession unless, upon questioning the person making it, he has reason to believe that it is being made voluntarily.
(3) If at any time before the confession is recorded, the person appearing before the Magistrate states that he is not willing to make the confession, the Magistrate shall not authorize the detention of such person in police custody.
Therefore they can depose before magistrate that the police is pressurising to give such statement.