Shevuos, Chapter 4, Mishnah 1. This chapter opens with an in-depth discussion of the matters of the oath of testimony.
The Definition of the Oath of Testimony:
A person who claims to his friend that he knows testimony that would assist him, and his friend replies that he does not know it - the claimant may say to him: Even if you do not know, swear to me about it. If the friend swears that he does not know testimony, and ultimately it becomes clear that he did indeed know it - he is obligated to bring a korban oleh v'yored.
To Whom the Oath of Testimony Applies:
"Noheges ba'anashim velo banashim" - The oath applies only to men, as only they are valid for testimony, at least in monetary laws, whereas women are invalid for it. Because of this, one who administers an oath to a woman that she does not know testimony - there is no substance to it, since she would not have been able to testify anyway.
"Berachokin velo bikrovin" - The oath applies specifically to those who are not relatives, since a relative is invalid for testimony and is not fit to serve as a witness.
"Bikesherin velo bifesulin" - Only to those who are valid to testify, and not to those who are invalid for testimony, such as a wicked person who has transgressed the commandments of the Torah and the like.
"Ve'eino noheg ela bera'uy leha'id":
Seemingly, all of these were already included in the previous statements, so what does this addition come to teach? The Gemara explains that this statement comes to include - or more accurately, to exclude - the king, who cannot testify, as is explained in Tractate Sanhedrin. And in addition to the king, it comes to include even those who are invalid for testimony by rabbinic law, such as one who plays with dice and the like.
From His Own Mouth and From the Mouths of Others:
The oath applies "bifnei beis din veshelo bifnei beis din" - whether he swore and denied it in front of a beis din or not in front of it. However, this is said specifically when the oath is "mipi atzmo" - from his own mouth: The claimant demands that he testify, and he responds on his own accord "An oath that I do not know testimony for you" - this is an oath from his own mouth, and regarding this there is no difference whether it is in front of a beis din or not in front of it.
In contrast, when the oath is "mipi acherim" - from the mouths of others, meaning that it is issued from the mouth of another person: The claimant asks the witnesses if they know testimony for him, and they answer in the negative; he asks to administer an oath to them and says to them "I administer an oath to you that if you know testimony for him you will come and testify", and they reply "We do not know testimony for you". In this case, they do not issue an oath from their mouths but merely deny it in response to the oath, and they also do not answer "Amen" - since we have already learned in the tractate that one who answers "Amen" is considered as one who issues an oath from his mouth, and then it is no longer in the category of "from the mouths of others".
They disagreed regarding this law:
Rabbi Meir: With "from his own mouth", the oath applies whether in front of a beis din or not in front of it; but with "from the mouths of others", even if they did not answer "Amen" but merely denied it after "I administer an oath to you" - "einan chayavin ad sheyichperu bahen bebeis din" - they are not liable until they deny it in a beis din, for there is no liability unless the denial was made in front of a beis din.
And the Sages say: "Bein mipi atzmo uvein mipi acherim, einan chayavin ad sheyichperu bahen bebeis din" - whether from his own mouth or from the mouths of others, they are not liable until they deny it in a beis din - whether he swore on his own or others issued the oath before him and he denied it, there is no liability unless the denial was made in front of a beis din.
The Gemara explains that the oath itself can be administered even outside of beis din, and the claimant is permitted to say "I administer an oath to you" anywhere. The primary focus of the Sages' statement is directed at the denial: it is the denial that must be made in front of beis din, whether the oath is administered by others, and certainly when he swears on his own. However, when he swears on his own, the act performed in beis din is the oath itself, because there, the denial is not separate from the oath - the oath is the denial itself.
In summary: In this Mishnah, we learned the parameters of the oath of testimony - one who swears that he does not know testimony and it turns out that he did know it, becomes obligated to bring a korban oleh veyored. The oath applies to men and not women, to non-relatives and not relatives, to valid witnesses and not invalid witnesses, and it only applies to someone who is fit to testify, excluding the king and those who are rabbinically disqualified from testifying. We also discussed the distinction between an oath taken on one's own and an oath administered by others, and the dispute between Rabbi Meir and the Sages regarding when the denial is required to be made specifically in front of beis din.